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 StatefulSet pod index as pod label #119232
Conversation
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The 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. |
Reviewer note: please only look at commit 42302f3 and beyond, since this branch is based off the branch where I implemented the corresponding changes for indexed jobs. |
This PR may require API review. If so, when the changes are ready, complete the pre-review checklist and request an API review. Status of requested reviews is tracked in the API Review project. |
/assign @soltysh |
/label api-review |
@@ -29,6 +29,7 @@ const ( | |||
DeprecatedRollbackTo = "deprecated.deployment.rollback.to" | |||
DeprecatedTemplateGeneration = "deprecated.daemonset.template.generation" | |||
StatefulSetPodNameLabel = "statefulset.kubernetes.io/pod-name" | |||
StatefulSetPodIndexLabel = "statefulset.kubernetes.io/pod-index" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The agreement is to use "statefulset.kubernetes.io/pod-index", can we please change this?
@soltysh what do you suggest we do with the existing pod name label? add a corresponding one using the key apps.kubernetes.io/pod-name
and start the deprecation process (I bet it will be painful to deprecate since it is widely used)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to use apps
prefix instead of statefulset
.
@@ -227,6 +228,28 @@ func CreatesPods(t *testing.T, set *apps.StatefulSet, invariants invariantFunc) | |||
if set.Status.UpdatedReplicas != 3 { | |||
t.Error("Failed to set UpdatedReplicas correctly") | |||
} | |||
// Check all pods have correct pod index label. | |||
if feature.DefaultFeatureGate.Enabled(features.PodIndexLabel) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewer note: I thought about adding a podIndexLabelEnabled bool
as a test case parameter, but that would then require changing the function signature of all 11 test functions (e.g. CreatePods, ScalesUp, ScalesDown, etc.) to add this parameter. This seemed like I would be shoe-horning it in and making the test code uglier, so I opted to just check if the feature gate itself is enabled in the test code, even though I don't see this pattern used much elsewhere in the codebase.
Since the code freeze is in 2 days I also created a PR with an alternative testing implementation #119355 which does refactor the unit test code to allow for toggling the feature gate on/off based on the test case and includes test cases with the feature gate enabled/disabled, so that we can move forward quickly with whichever approach is prefered.
Let me know if there is ok or if there is a different/preferred pattern to do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @soltysh on above comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
LGTM label has been added. Git tree hash: 8a0005fe54efda88bccc50f6ffc25f707bd31769
|
/retest |
/lgtm |
can you squash pls |
LGTM label has been added. Git tree hash: e36cc60fe740580b588f4dbd1785fc2a1da29017
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: danielvegamyhre, liggitt 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 |
not necessary, merge-method-squash label was applied |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Implementing StatefulSet changes for KEP-4017.
Reviewer note: please only look at commit 42302f3 and beyond, since this branch is based off the branch where I implemented the corresponding changes for indexed jobs.
Which issue(s) this PR fixes:
Part of kubernetes/enhancements#4017
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Yes, the pod index of a StatefulSet pod will now be added as a pod a label,
statefulset.kubernetes.io/pod-index
.Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: