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

Introduce minReadySeconds in StatefulSets #2607

Merged

Conversation

ravisantoshgudimetla
Copy link
Contributor

Introduce minReadySeconds in StatefulSets

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Apr 7, 2021
@k8s-ci-robot k8s-ci-robot added kind/kep Categorizes KEP tracking issues and PRs modifying the KEP directory sig/apps Categorizes an issue or PR as relevant to SIG Apps. labels Apr 7, 2021
@ravisantoshgudimetla ravisantoshgudimetla force-pushed the kep-minReadySeconds-ss branch 8 times, most recently from 6f1aedb to a43d4b6 Compare April 12, 2021 15:25
@ravisantoshgudimetla ravisantoshgudimetla changed the title [wip] Introduce minReadySeconds in StatefulSets Introduce minReadySeconds in StatefulSets Apr 12, 2021
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 12, 2021

### Non-Goals

Moving minReadySeconds to Pod Spec is beyond the scope of this KEP
Copy link
Contributor

Choose a reason for hiding this comment

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

I would describe why, and maybe say a future story could address it based on consistent use. First, the effort to change pod spec would be large (impact). Second, currently our workload controllers are inconsistent and we prioritize consistent of experience over desirable future state (consistency). Third, stateful sets are just different enough from daemonsets and deployments that real world use of minReadySeconds for stateful sets might influence any future design or point in a more appropriate direction (completeness)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried explaining second point in the motivation section. I will add first. Can you expand a bit on completeness(third point) like why do you think the real world use of minReadySeconds for sts might point in a more appropriate direction? I can add that in the use-case section.

@ehashman
Copy link
Member

/assign

@ravisantoshgudimetla ravisantoshgudimetla force-pushed the kep-minReadySeconds-ss branch 4 times, most recently from 5bcf727 to 1dd1a00 Compare April 16, 2021 18:07
Copy link
Contributor Author

@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.

@ehashman - Thank you for the review. I tried answering your questions, can you PTAL

ravisantoshgudimetla added a commit to ravisantoshgudimetla/website that referenced this pull request Apr 23, 2021
- The effort to change pod spec would be large.
- Currently our workload controllers are inconsistent and we prioritize consistency of experience.
- StatefulSets are just different enough from daemonsets and deployments that real world use of minReadySeconds
for stateful sets might influence any future design or point in a more appropriate direction (completeness).
Copy link
Contributor

Choose a reason for hiding this comment

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

Link to that k/k issue where this was discussed, for reference.


We are proposing a new field called `minReadySeconds` whose default value will
be 0. In this mode, StatefulSet will behave exactly like its current behavior.
Its possible we introduce a bug in the implementation. The mitigation
Copy link
Contributor

Choose a reason for hiding this comment

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

Be more specific about the risk of a bug, namely that we either:

  • mark a pod as ready too soon
  • mark as ready too late.
    and what that might potentially mean.

// Defaults to 0 (pod will be considered available as soon as it is ready)
// This is an alpha field and requires enabling StatefulSetMinReadySeconds feature gate.
// +optional
MinReadySeconds *int32
Copy link
Contributor

Choose a reason for hiding this comment

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

For consistency with other controllers this should not be a pointer, especially that 0 and nil have the same meaning.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ya, I was thinking about the same but in the apiconventions, it was mentioned that:

  • ensure the field is entirely absent from API responses when empty (optional fields should be pointers, anyway) which made me think I should use a pointer. It also helps in setting default values easily as we can distinguish between being set and the default value.

This was also mentioned in the api conventions doc.

Do use pointers to scalars when you need to distinguish between an unset value and an automatic zero value. For example, PodSpec.TerminationGracePeriodSeconds is defined as *int64 the go type definition. A zero value means 0 seconds, and a nil value asks the system to pick a default.

I think the above is the case for us too say if we choose to a non-zero default value in future.

Copy link
Contributor

Choose a reason for hiding this comment

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

We spoke with @smarterclayton on slack, and the agreement is that we'll go with non-pointer version.

// Total number of available pods (ready for at least minReadySeconds) targeted by this statefulset.
// This is an alpha field and requires enabling StatefulSetMinReadySeconds feature gate.
// +optional
AvailabileReplicas *int32
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto.

Copy link
Contributor

@soltysh soltysh left a comment

Choose a reason for hiding this comment

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

/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 Apr 29, 2021
Copy link
Member

@ehashman ehashman left a comment

Choose a reason for hiding this comment

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

/approve
for PRR

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ehashman, ravisantoshgudimetla, soltysh

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 Apr 29, 2021
@k8s-ci-robot k8s-ci-robot merged commit 54e4141 into kubernetes:master Apr 29, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.22 milestone Apr 29, 2021
@chrisnegus
Copy link

chrisnegus commented May 19, 2021

Hi @ravisantoshgudimetla 👋 1.22 Docs Shadow here.
This enhancement is marked as Needs Docs for the 1.22 release.

Please follow the steps detailed in the documentation to open a PR against dev-1.22 in the kubernetes/website repo. This PR can be just a placeholder at this time and must be created before Fri July 9, 11:59 PM PDT.

Also, take a look at Documenting for a release to familiarize yourself with the docs requirement for the release.

Thank you!

ravisantoshgudimetla added a commit to ravisantoshgudimetla/website that referenced this pull request Jun 15, 2021
ravisantoshgudimetla added a commit to ravisantoshgudimetla/website that referenced this pull request Jun 15, 2021
Add docs for StatefulSet minReadySeconds.

xref: kubernetes/enhancements#2607
ravisantoshgudimetla added a commit to ravisantoshgudimetla/website that referenced this pull request Jun 21, 2021
Add docs for StatefulSet minReadySeconds.

xref: kubernetes/enhancements#2607
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/kep Categorizes KEP tracking issues and PRs modifying the KEP directory lgtm "Looks good to me", indicates that a PR is ready to be merged. sig/apps Categorizes an issue or PR as relevant to SIG Apps. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants