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

Only default Job fields when feature gates are enabled #100188

Merged
merged 1 commit into from Mar 15, 2021

Conversation

alculquicondor
Copy link
Member

What type of PR is this?

/kind bug
/kind api-change

What this PR does / why we need it:

Only default Job fields when feature gates are enabled and use pointer for completionMode enum.
This avoids rendering the field when the feature gates are disabled.
/sig apps

Which issue(s) this PR fixes:

Fixes #100187

kubernetes/enhancements#2214
kubernetes/enhancements#2232

Does this PR introduce a user-facing change?

Features not released yet

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/bug Categorizes issue or PR as related to a bug. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. 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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Mar 12, 2021
@k8s-ci-robot
Copy link
Contributor

@alculquicondor: 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 Mar 12, 2021
@alculquicondor
Copy link
Member Author

FYI @adtac

@k8s-ci-robot k8s-ci-robot added area/kubectl sig/cli Categorizes an issue or PR as relevant to SIG CLI. labels Mar 12, 2021
@fejta-bot
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.

@@ -153,21 +153,10 @@ func testJobStrategy(t *testing.T) {
t.Errorf("Expected a validation error")
}

// Existing gated fields should be preserved
Copy link
Member

Choose a reason for hiding this comment

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

why was this removed?

Copy link
Member Author

Choose a reason for hiding this comment

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

To keep the test simple. Other fields are already tested above.
It would be ideal to have a test table so that we don't have to repeat the checks, but kind of late to do such refactoring.

Copy link
Member

Choose a reason for hiding this comment

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

I don't know if removing the TTL test is a good idea though

Copy link
Member

Choose a reason for hiding this comment

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

I don't know if removing the TTL test is a good idea though

/hold
just saw this... agree that this should not change unrelated fields

Copy link
Member Author

Choose a reason for hiding this comment

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

changes in TTL is already tested above

Copy link
Member

Choose a reason for hiding this comment

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

ack

/hold cancel

Copy link
Member

Choose a reason for hiding this comment

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

not for PrepareForUpdate though

Copy link
Member Author

Choose a reason for hiding this comment

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

TTLSecondsAfterFinished: pointer.Int32Ptr(1),

if !utilfeature.DefaultFeatureGate.Enabled(features.IndexedJob) && oldJob.Spec.CompletionMode == batch.NonIndexedCompletion {
newJob.Spec.CompletionMode = batch.NonIndexedCompletion
if !utilfeature.DefaultFeatureGate.Enabled(features.IndexedJob) && oldJob.Spec.CompletionMode == nil {
newJob.Spec.CompletionMode = nil
Copy link
Member

Choose a reason for hiding this comment

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

this would allow updating from NonIndexed->Indexed even when the feature gate is disabled, no?

Copy link
Member Author

Choose a reason for hiding this comment

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

It would... but field is immutable (checked in ValidateJobSpecUpdate)

Also, the feature gate is, in a way, protecting the field to not be set, without caring about the value.

@alculquicondor
Copy link
Member Author

/assign @liggitt

@liggitt
Copy link
Member

liggitt commented Mar 12, 2021

you need to update the API compatibility fixtures to v1.19 and v1.20 fixtures, which will effectively undo the changes made in #98441

In general, changes to the "after_roundtrip" fixtures from previous versions is a big red flag and should not be expected in PRs adding new API fields (e.g. https://github.com/kubernetes/kubernetes/pull/98441/files#diff-5c45c5bb5dd4a8b59eceff1c90f520425cac8fa64599ecf5d37f03da37ad6549)

@liggitt liggitt added this to API review completed, 1.21 in API Reviews Mar 12, 2021
@liggitt
Copy link
Member

liggitt commented Mar 12, 2021

The API change itself lgtm

Also use pointer for completionMode enum
@dims
Copy link
Member

dims commented Mar 15, 2021

/cc @palnabarun @nikhita

Copy link
Member

@adtac adtac left a comment

Choose a reason for hiding this comment

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

controller and test changes lgtm

@liggitt
Copy link
Member

liggitt commented Mar 15, 2021

/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 Mar 15, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alculquicondor, 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 approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Mar 15, 2021
@alculquicondor
Copy link
Member Author

/retest

@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 Mar 15, 2021
@k8s-ci-robot k8s-ci-robot merged commit b345913 into kubernetes:master Mar 15, 2021
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. area/kubectl 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/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-none Denotes a PR that doesn't merit a release note. sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/cli Categorizes an issue or PR as relevant to SIG CLI. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
Status: API review completed, 1.21
Development

Successfully merging this pull request may close these issues.

Job suspend and completionMode fields should be left empty when features are disabled
6 participants