Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test to guard unset fields in deployer pod #17471

Merged
merged 1 commit into from
Nov 28, 2017

Conversation

mfojtik
Copy link
Contributor

@mfojtik mfojtik commented Nov 27, 2017

This should protect is from "missing fields" in deployer pods for those fields we don't copy.

@openshift-ci-robot openshift-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 27, 2017
@openshift-merge-robot openshift-merge-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 27, 2017
p.Spec.ServiceAccountName = "sa:test"

// FIXME: These are weird or missing. If you get an error below, consider
// adding this field into deployer controller or to this list:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Kargakis @tnozicka @smarterclayton we probably need to decide which fields we want to copy from the deployment config template to deployer pod (some of these are not copied for reason (like Volume...), some of them we should copy? (like NodeName?)..))

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think any of these should be copied except for volumes only in case of customStrategy otherwise that would be a security hole

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feels like it should be the cluster admin who gets to choose deployers scheduling, not the user

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running pods on the users behalf is always fraught - we have to be careful what we allow. We have gradually given users more control over deployer pods including location of scheduling, but our current API won’t scale by one off adding fields.

Toleration improve scheduling (give the pod more options) in most cases, so it’s probably correct to copy them. However, we might have to filter some of the conditions to be safe. For now, I’m a bit concerned about adding them without some design time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smarterclayton i'm fine keeping this test as it is (it will alert us if new fields are added to PodSpec) with a follow up issue where we can discuss what fields we want to copy.

@mfojtik mfojtik force-pushed the add-deployer-test branch 2 times, most recently from eb61653 to 961c7e8 Compare November 27, 2017 14:18
p.Spec.HostAliases = nil
p.Spec.Priority = nil
p.Spec.PriorityClassName = ""
p.Spec.SecurityContext = nil
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@php-coder @pweil- is this something we want to copy into deployer pod?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

user shouldn't be able to set this on deployer pods I think; we control the image hence this as well

p.Spec.SchedulerName = ""
p.Spec.HostAliases = nil
p.Spec.Priority = nil
p.Spec.PriorityClassName = ""
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smarterclayton reminds me that we should maybe populate this to SYSTEM for deployer pods?

p.Spec.DeprecatedServiceAccount = ""
p.Spec.AutomountServiceAccountToken = nil
p.Spec.Volumes = nil
p.Spec.NodeName = ""
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably need to be copied if user want to run the deployment on isolated node?

p.Spec.HostIPC = false
p.Spec.Hostname = ""
p.Spec.Subdomain = ""
p.Spec.Affinity = nil
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably need to be copied as well?

Copy link
Contributor

@tnozicka tnozicka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
but needs followup issue linked

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 28, 2017
@openshift-merge-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mfojtik, tnozicka

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot
Copy link
Contributor

Automatic merge from submit-queue (batch tested with PRs 17299, 17482, 17471).

@openshift-merge-robot openshift-merge-robot merged commit 2463543 into openshift:master Nov 28, 2017
@0xmichalis
Copy link
Contributor

/cherrypick release-3.7

@openshift-cherrypick-robot

@Kargakis: #17471 failed to apply on top of branch "release-3.7": exit status 128

In response to this:

/cherrypick release-3.7

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@mfojtik mfojtik deleted the add-deployer-test branch September 5, 2018 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants