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

Graduate JobTrackingWithFinalizers to stable #113510

Merged
merged 1 commit into from Nov 7, 2022

Conversation

alculquicondor
Copy link
Member

@alculquicondor alculquicondor commented Nov 1, 2022

What type of PR is this?

/kind feature
/kind api-change

/sig apps

What this PR does / why we need it:

Graduate JobTrackingWithFinalizers to stable:

  • Fix feature gate to true
  • Declare job tracking annotation as deprecated
  • Allow adding job tracking annotation but add it back if users try to remove it.
  • Simplify tests where possible.

Which issue(s) this PR fixes:

Refs kubernetes/enhancements#2307

Special notes for your reviewer:

The other graduation criteria are completed in #113478 and #113176.

Legacy tracking is still supported. However, now it can only be tested in unit tests and not integration tests, because apiserver disallows creating a job without job tracking annotation.

Does this PR introduce a user-facing change?

Graduate JobTrackingWithFinalizers to stable.
Jobs created before the feature was enabled are still tracked without finalizers. Jobs tracked with finalizers have the annotation batch.kubernetes.io/job-tracking.
If the annotation is present and the user attempts to remove it, the control plane adds it back.
The annotation batch.kubernetes.io/job-tracking is deprecated. The control plane will ignore it and stop adding it for new Jobs in v1.27.

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

- [KEP]: https://github.com/kubernetes/enhancements/tree/a4b5f5c8e9aa857f9bf1f7df2a9a8b9ee660ed1e/keps/sig-apps/2307-job-tracking-without-lingering-pods#beta---ga-graduation
- [Usage]: https://kubernetes.io/docs/concepts/workloads/controllers/job/#job-tracking-with-finalizers

@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/XL Denotes a PR that changes 500-999 lines, ignoring generated files. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. sig/apps Categorizes an issue or PR as relevant to SIG Apps. 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 Nov 1, 2022
@k8s-ci-robot k8s-ci-robot added area/code-generation area/test sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/testing Categorizes an issue or PR as relevant to SIG Testing. labels Nov 1, 2022
@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.

@alculquicondor
Copy link
Member Author

/assign @soltysh

@@ -689,7 +689,9 @@ func testResourceUpdate(c *testContext) {
if err != nil {
return err
}
obj.SetAnnotations(map[string]string{"update": "true"})
annotations := obj.GetAnnotations()
Copy link
Member Author

Choose a reason for hiding this comment

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

If somebody had a buggy mutating webhook that did something like this, it will start failing on upgrade to 1.26.

I would consider this WAI: we don't want users to disable tracking with finalizers.

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed the behavior to always add the annotation back

@alculquicondor
Copy link
Member Author

/retest

@alculquicondor alculquicondor force-pushed the finalizers-stable branch 2 times, most recently from 932e894 to b17dae2 Compare November 1, 2022 21:50
@alculquicondor
Copy link
Member Author

/label api-review

@k8s-ci-robot k8s-ci-robot added api-review Categorizes an issue or PR as actively needing an API review. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Nov 2, 2022
@soltysh
Copy link
Contributor

soltysh commented Nov 4, 2022

/triage accepted
/priority important-longterm

@k8s-ci-robot k8s-ci-robot added the triage/accepted Indicates an issue or PR is ready to be actively worked on. label Nov 4, 2022
@k8s-ci-robot k8s-ci-robot removed the needs-priority Indicates a PR lacks a `priority/foo` label and requires one. label Nov 4, 2022
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

@@ -546,8 +546,8 @@ func ValidateJobTemplateSpec(spec *batch.JobTemplateSpec, fldPath *field.Path, o

type JobValidationOptions struct {
apivalidation.PodValidationOptions
// Allow Job to have the annotation batch.kubernetes.io/job-tracking
AllowTrackingAnnotation bool
// Allow Job to not have the annotation batch.kubernetes.io/job-tracking
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Allow Job to not have the annotation batch.kubernetes.io/job-tracking
// Allow Job to not to have the annotation batch.kubernetes.io/job-tracking

Copy link
Member Author

Choose a reason for hiding this comment

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

ok, I didn't like either option, so I changed to logic to be RequireTrackingAnnotation=true by default, and false if the old job didn't have it.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 4, 2022
@k8s-ci-robot k8s-ci-robot removed lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Nov 4, 2022
@liggitt liggitt added this to Assigned in API Reviews Nov 4, 2022
@liggitt liggitt self-assigned this Nov 4, 2022
@liggitt
Copy link
Member

liggitt commented Nov 4, 2022

if the goal is to make sure new jobs have the tracking annotation and updates to jobs don't remove it, is there a reason not to add/preserve the annotation in PrepareForCreate/PrepareForUpdate, rather than rejecting previously working API requests?

@liggitt liggitt moved this from Assigned to In progress in API Reviews Nov 4, 2022
@alculquicondor alculquicondor force-pushed the finalizers-stable branch 2 times, most recently from 19bb0d1 to cdeb40c Compare November 4, 2022 18:08
@alculquicondor
Copy link
Member Author

is there a reason not to add/preserve the annotation in PrepareForCreate/PrepareForUpdate, rather than rejecting previously working API requests?

I just didn't think of that, thanks! That's much simpler.

@liggitt liggitt added this to the v1.26 milestone Nov 4, 2022
@liggitt liggitt moved this from In progress to Changes requested in API Reviews Nov 4, 2022
Change-Id: Ifc749a85b1270c0155ac511b91d4681d53236820
Copy link
Member Author

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

Reverted the validation to disallow adding the tracking annotation

@@ -418,17 +423,6 @@ func testJobStrategy(t *testing.T) {
t.Errorf("Expected a validation error")
}

// Ensure going from legacy tracking Job to tracking with finalizers is
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 now tested in TestJobStrategyValidateUpdate

staging/src/k8s.io/api/batch/v1/types.go Show resolved Hide resolved
@liggitt liggitt moved this from Changes requested to In progress in API Reviews Nov 4, 2022
Copy link
Member

@liggitt liggitt left a comment

Choose a reason for hiding this comment

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

only comment was on PrepareForUpdate

@liggitt liggitt moved this from In progress to Changes requested in API Reviews Nov 5, 2022
@liggitt
Copy link
Member

liggitt commented Nov 7, 2022

/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 Nov 7, 2022
@liggitt liggitt moved this from Changes requested to API review completed, 1.26 in API Reviews Nov 7, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alculquicondor, liggitt, 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 Nov 7, 2022
@k8s-ci-robot k8s-ci-robot merged commit ac95e5b into kubernetes:master Nov 7, 2022
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. area/code-generation area/test 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. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Status: API review completed, 1.26
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

5 participants