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

switch scheduler to generate the merge patch on pod status instead of the full pod #103133

Merged

Conversation

marwanad
Copy link
Member

@marwanad marwanad commented Jun 24, 2021

What type of PR is this?

/kind bug
/sig scheduling

What this PR does / why we need it:

When the scheduler fails to schedule pods (due to insufficient resources for example) and calls into recordSchedulingFailure, it attempts to update pod conditions through a strategic merge patch. This patching logic fails if the pod has ImagePullSecrets with no name since the patchMergeKey is set to the name field. An imagePullSecrets input of [{}] is valid in k8s.

As a result certain components that depend on those scheduler conditions to issue a scale-up, fail to do so or even acknowledge the pending pods (for example cluster-autoscaler).

This switches scheduler patching logic to generate the 2-way merge patch on the pod.Status instead of the full pod object.

Which issue(s) this PR fixes:

Fixes #101697

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Switch scheduler to generate the merge patch on pod status instead of the full pod

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jun 24, 2021
@k8s-ci-robot
Copy link
Contributor

@marwanad: This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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.

@k8s-ci-robot k8s-ci-robot added needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Jun 24, 2021
@marwanad
Copy link
Member Author

/cc @ahg-g

@k8s-ci-robot k8s-ci-robot requested a review from ahg-g June 24, 2021 01:26
@marwanad marwanad changed the title allow scheduler to update pod conditions when imagePullSecrets have no names allow scheduler to update pod conditions when imagePullSecrets have no name field Jun 24, 2021
@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 24, 2021
@marwanad marwanad force-pushed the allow-scheduler-to-patch-conditions branch from bc66728 to 2772506 Compare June 24, 2021 22:23
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 24, 2021
@marwanad marwanad force-pushed the allow-scheduler-to-patch-conditions branch from 2772506 to 06909d9 Compare June 24, 2021 22:52
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 24, 2021
@marwanad marwanad force-pushed the allow-scheduler-to-patch-conditions branch from 06909d9 to 33611b4 Compare June 24, 2021 23:31
Copy link
Member

@alculquicondor alculquicondor left a comment

Choose a reason for hiding this comment

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

/approve
/lgtm

/hold
in case you want to solve the recommendations I left.

pkg/scheduler/scheduler_test.go Outdated Show resolved Hide resolved
pkg/scheduler/scheduler_test.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 25, 2021
@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jun 25, 2021
@marwanad marwanad force-pushed the allow-scheduler-to-patch-conditions branch from 33611b4 to d3e14f6 Compare June 28, 2021 13:45
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 28, 2021
@marwanad marwanad changed the title allow scheduler to update pod conditions when imagePullSecrets have no name field switch scheduler to generate the merge patch on pod status instead of the full pod Jun 28, 2021
pkg/scheduler/util/utils_test.go Outdated Show resolved Hide resolved
pkg/scheduler/util/utils_test.go Outdated Show resolved Hide resolved
pkg/scheduler/util/utils_test.go Outdated Show resolved Hide resolved
@marwanad marwanad force-pushed the allow-scheduler-to-patch-conditions branch from d3e14f6 to 8a044cf Compare June 28, 2021 16:34
@marwanad marwanad force-pushed the allow-scheduler-to-patch-conditions branch from 8a044cf to 48dfa2a Compare June 28, 2021 16:36
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 28, 2021
@alculquicondor
Copy link
Member

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 28, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alculquicondor, marwanad

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

@marwanad
Copy link
Member Author

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 28, 2021
@k8s-ci-robot k8s-ci-robot merged commit 51e1969 into kubernetes:master Jun 28, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.22 milestone Jun 28, 2021
@alculquicondor
Copy link
Member

Please cherry pick to all supported versions (1.19, 1.20, 1.21) https://github.com/kubernetes/community/blob/master/contributors/devel/sig-release/cherry-picks.md

k8s-ci-robot added a commit that referenced this pull request Jul 10, 2021
…3133-upstream-release-1.19

Automated cherry pick of #103133 on 1.19: switch scheduler to generate the merge patch on pod status instead of the full pod
k8s-ci-robot added a commit that referenced this pull request Jul 10, 2021
…3133-upstream-release-1.20

Automated cherry pick of #103133 on 1.20: switch scheduler to generate the merge patch on pod status instead of the full pod
k8s-ci-robot added a commit that referenced this pull request Jul 10, 2021
…3133-upstream-release-1.21

Automated cherry pick of #103133 on 1.21: switch scheduler to generate the merge patch on pod status instead of the full pod
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. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. 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.

Empty imagePullSecrets leads to status.conditions never being set
3 participants