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 StatefulSet pod index as pod label #119232

Merged
merged 4 commits into from Jul 17, 2023

Conversation

danielvegamyhre
Copy link
Member

@danielvegamyhre danielvegamyhre commented Jul 11, 2023

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.

StatefulSet pods now have the pod index set as a pod label `statefulset.kubernetes.io/pod-index`.

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

[KEP](https://github.com/kubernetes/enhancements/pull/4019)

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. 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. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jul 11, 2023
@k8s-ci-robot
Copy link
Contributor

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 the needs-priority Indicates a PR lacks a `priority/foo` label and requires one. label Jul 11, 2023
@k8s-ci-robot k8s-ci-robot added kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API sig/apps Categorizes an issue or PR as relevant to SIG Apps. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jul 11, 2023
@danielvegamyhre
Copy link
Member Author

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.

@k8s-triage-robot
Copy link

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.

@ahg-g
Copy link
Member

ahg-g commented Jul 11, 2023

/assign @soltysh

@ahg-g
Copy link
Member

ahg-g commented Jul 11, 2023

/label api-review

@k8s-ci-robot k8s-ci-robot added the api-review Categorizes an issue or PR as actively needing an API review. label Jul 11, 2023
@@ -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"
Copy link
Member

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)?

Copy link
Member Author

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) {
Copy link
Member Author

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.

Copy link
Member Author

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

Copy link
Member

@ahg-g ahg-g left a comment

Choose a reason for hiding this comment

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

/lgtm

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

LGTM label has been added.

Git tree hash: 8a0005fe54efda88bccc50f6ffc25f707bd31769

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 16, 2023
@danielvegamyhre
Copy link
Member Author

/retest

@liggitt liggitt added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Jul 17, 2023
@liggitt
Copy link
Member

liggitt commented Jul 17, 2023

/lgtm
/approve

@liggitt liggitt self-assigned this Jul 17, 2023
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 17, 2023
@ahg-g
Copy link
Member

ahg-g commented Jul 17, 2023

can you squash pls

@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: e36cc60fe740580b588f4dbd1785fc2a1da29017

@liggitt liggitt added this to API review completed, 1.28 in API Reviews Jul 17, 2023
@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 17, 2023
@ahg-g
Copy link
Member

ahg-g commented Jul 17, 2023

can you squash pls

not necessary, merge-method-squash label was applied

@liggitt liggitt added this to the v1.28 milestone Jul 17, 2023
@k8s-ci-robot k8s-ci-robot merged commit 7698fe7 into kubernetes:master Jul 17, 2023
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-review Categorizes an issue or PR as actively needing an API review. 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/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API kind/feature Categorizes issue or PR as related to a new feature. 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/apps Categorizes an issue or PR as relevant to SIG Apps. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
Status: API review completed, 1.28
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

6 participants