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

fix scheduler client construction from configuration files #65507

Merged
merged 1 commit into from
Jun 27, 2018

Conversation

liggitt
Copy link
Member

@liggitt liggitt commented Jun 27, 2018

fixes #65483

clients were being constructed from options prior to loading the specified configuration file. this is a regression from 1.10 behavior.

/sig scheduling
/kind bug
/priority critical-urgent
/milestone v1.11

fixes a regression in kube-scheduler to properly load client connection information from a `--config` file that references a kubeconfig file

@k8s-ci-robot k8s-ci-robot added the sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. label Jun 27, 2018
@k8s-ci-robot k8s-ci-robot added this to the v1.11 milestone Jun 27, 2018
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. kind/bug Categorizes issue or PR as related to a bug. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jun 27, 2018
@@ -197,37 +197,37 @@ func (o *Options) Validate() []error {

// Config return a scheduler config object
func (o *Options) Config() (*schedulerappconfig.Config, error) {
c := &schedulerappconfig.Config{}
if err := o.ApplyTo(c); err != nil {
Copy link
Member Author

@liggitt liggitt Jun 27, 2018

Choose a reason for hiding this comment

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

we apply the options to the config struct first (which handles loading config from a file), then use the c.ComponentConfig.... for the rest of the function

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Jun 27, 2018

func TestSchedulerOptions(t *testing.T) {
// temp dir
tmpDir, err := ioutil.TempDir("", "scheduler-options")
Copy link
Contributor

Choose a reason for hiding this comment

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

q: Is it safe to assume that tempdir always exists especially when running in containers?

Copy link
Member Author

Choose a reason for hiding this comment

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

Many unit tests already do this, so yes

}

// Insulate this test from picking up in-cluster config when run inside a pod
// We can't assume we have permissions to write to /var/run/secrets/... from a unit test to mock in-cluster config for testing
Copy link
Contributor

Choose a reason for hiding this comment

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

This is pretty clever!!

Copy link
Contributor

@ravisantoshgudimetla ravisantoshgudimetla left a comment

Choose a reason for hiding this comment

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

/lgtm

Thanks @liggitt.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 27, 2018
@liggitt
Copy link
Member Author

liggitt commented Jun 27, 2018

/retest

1 similar comment
@liggitt
Copy link
Member Author

liggitt commented Jun 27, 2018

/retest

@k82cn
Copy link
Member

k82cn commented Jun 27, 2018

/approve

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 27, 2018
Copy link
Member

@bsalamat bsalamat left a comment

Choose a reason for hiding this comment

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

Thanks a lot, @liggitt! I only have minor comment about the test, but it is not important and given the urgency of this fix, I approve it.

/lgtm

} else if !strings.Contains(err.Error(), tc.expectedError) {
t.Errorf("expected %q, got %q", tc.expectedError, err.Error())
}
return
Copy link
Member

Choose a reason for hiding this comment

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

it would be better to continue instead of return here and below.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is inside a t.Run function… returning continues to the next test case

Copy link
Member

Choose a reason for hiding this comment

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

Yes, you are right! I missed that it is inside t.Run.
Thanks again!

"k8s.io/kubernetes/pkg/apis/componentconfig"
)

func TestSchedulerOptions(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

Impressive! Thanks for writing the test.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bsalamat, k82cn, liggitt, ravisantoshgudimetla

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

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-github-robot
Copy link

[MILESTONENOTIFIER] Milestone Pull Request: Up-to-date for process

@bsalamat @liggitt @ravisantoshgudimetla

Pull Request Labels
  • sig/scheduling: Pull Request will be escalated to these SIGs if needed.
  • priority/critical-urgent: Never automatically move pull request out of a release milestone; continually escalate to contributor and SIG through all available channels.
  • kind/bug: Fixes a bug discovered during the current release.
Help

@k8s-github-robot
Copy link

/test all [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here.

@k8s-github-robot k8s-github-robot merged commit 2b18760 into kubernetes:master Jun 27, 2018
rfranzke added a commit to gardener/gardener that referenced this pull request Jun 27, 2018
k8s-github-robot pushed a commit that referenced this pull request Jun 27, 2018
…7-upstream-release-1.11

Automatic merge from submit-queue.

Automated cherry pick of #65507: fix scheduler client construction from configuration files

Cherry pick of #65507 on release-1.11.

#65507: fix scheduler client construction from configuration files
@liggitt liggitt deleted the scheduler-config-client branch June 28, 2018 20:34
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scheduler does not respect clientConnection of KubeSchedulerConfiguration in 1.11
6 participants