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

[MultiKueue] Introduce Admission Check Validation feature gate #3254

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mszadkow
Copy link
Contributor

@mszadkow mszadkow commented Oct 17, 2024

What type of PR is this?

/kind bug

What this PR does / why we need it:

SingleInstanceInClusterQueue and FlavorIndependent are confusing to the multi-cluster users.
We need to wrap them with feature gate, but preserve the logic for MultiKueue Admission Checks constraints without those status conditions.

Which issue(s) this PR fixes:

Fixes #3094

Special notes for your reviewer:

Does this PR introduce a user-facing change?

ACTION REQUIRED: the Admission check status conditions “FlavorIndependent” and “SingleInstanceInClusterQueue” are no longer supported by default.
If you were using any of these conditions for your external AdmissionCheck you need to enable the `AdmissionCheckValidationRules` feature gate. 
For the future releases you will need to provide validation by an external controller.

@k8s-ci-robot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@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. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Oct 17, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mszadkow
Once this PR has been reviewed and has the lgtm label, please assign alculquicondor for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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 cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 17, 2024
Copy link

netlify bot commented Oct 17, 2024

Deploy Preview for kubernetes-sigs-kueue ready!

Name Link
🔨 Latest commit c8c32ad
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-kueue/deploys/67123b0f6e516600080851a1
😎 Deploy Preview https://deploy-preview-3254--kubernetes-sigs-kueue.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@mszadkow
Copy link
Contributor Author

/ok-to-test

@k8s-ci-robot k8s-ci-robot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Oct 17, 2024
@mimowo
Copy link
Contributor

mimowo commented Oct 17, 2024

/cc

@mszadkow mszadkow force-pushed the feature/disable-confusing-ac-conditions branch from 705820a to 219414b Compare October 18, 2024 10:29
@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. release-note-action-required Denotes a PR that introduces potentially breaking changes that require user action. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Oct 18, 2024
@mszadkow mszadkow changed the title [WIP] Admission Check Validation Checks [MultiKueue] Admission Check Validation Checks Oct 18, 2024
…tAdmissionCheck status conditions with a feature gate.

Preserve the logic without the status conditions.
@mszadkow mszadkow force-pushed the feature/disable-confusing-ac-conditions branch from 219414b to c8c32ad Compare October 18, 2024 10:40
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 18, 2024
@mszadkow mszadkow changed the title [MultiKueue] Admission Check Validation Checks [MultiKueue] Introduce Admission Check Validation feature gate Oct 18, 2024
@mszadkow mszadkow marked this pull request as ready for review October 18, 2024 11:10
@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 Oct 18, 2024
@k8s-ci-robot
Copy link
Contributor

@mszadkow: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-kueue-test-unit-main c8c32ad link true /test pull-kueue-test-unit-main

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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-sigs/prow repository. I understand the commands that are listed here.

Copy link
Contributor

@mimowo mimowo left a comment

Choose a reason for hiding this comment

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

Overall this looks good.

I'm leaning to use dedicated fields in the cache for the checks so that there is a clear separation of the new and old mechanism. It will make it easier to drop the old mechanism in 0.10. Maybe it would also give us more control over the reasons, it will be better to have dedicated reasons.

// TBD: This might not be needed, but we could keep it for readability
// because SingleInstanceInClusterQueue and FlavorIndependent will be false if AdmissionCheckValidationRules is off
singleInstanceInClusterQueue, flavorIndependent := false, false
if features.Enabled(features.AdmissionCheckValidationRules) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Gating this code makes sense, but I think for reasability we can do:

newAC :=  AdmissionCheck{
  Active
  Controller 
  // by default SingleInstanceInClusterQueue and FlavorIndependent to false
}
if features.Enabled(features.AdmissionCheckValidationRules) {
  newAC. SingleInstanceInClusterQueue =apimeta.IsStatusConditionTrue(ac.Status.Conditions, kueue.AdmissionChecksSingleInstanceInClusterQueue)
  newAC.FlavorIndependent = apimeta.IsStatusConditionTrue(ac.Status.Conditions, kueue.FlavorIndependentAdmissionCheck)
}
c.admissionChecks[ac.Name] = newAC

reasons = append(reasons, kueue.ClusterQueueActiveReasonMultipleSingleInstanceControllerAdmissionChecks)
for _, controller := range utilmaps.SortedKeys(c.multipleSingleInstanceControllersChecks) {
messages = append(messages, fmt.Sprintf("only one AdmissionCheck of %v can be referenced for controller %q", c.multipleSingleInstanceControllersChecks[controller], controller))
if features.Enabled(features.AdmissionCheckValidationRules) {
Copy link
Contributor

Choose a reason for hiding this comment

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

IIUC we don't need any diff here if we used a dedicated cache field.
Then we can also easier drop the code in 0.10. For the hard-coded validation we can use
multipleMultiKueueChecks and perFlavorMultiKueueChecks

@@ -333,11 +346,22 @@ func (c *clusterQueue) updateWithAdmissionChecks(checks map[string]AdmissionChec
inactive = append(inactive, acName)
}
checksPerController[ac.Controller] = append(checksPerController[ac.Controller], acName)
if ac.SingleInstanceInClusterQueue {

if features.Enabled(features.AdmissionCheckValidationRules) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Similarly here, avoid the diff by using dedicated cache fields for the new checks

Comment on lines +799 to +800
wantReason: "MultipleSingleInstanceControllerAdmissionChecks",
wantMessage: "Can't admit new workloads: Cannot use multiple MultiKueue AdmissionChecks on the same ClusterQueue.",
Copy link
Contributor

Choose a reason for hiding this comment

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

When the feature is disabled set reason as MultipleMultiKueueAdmissionChecks

Comment on lines +814 to +815
wantReason: "FlavorIndependentAdmissionCheckAppliedPerFlavor",
wantMessage: "Can't admit new workloads: MultiKueue AdmissionCheck cannot be specified per flavor.",
Copy link
Contributor

Choose a reason for hiding this comment

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

When the gate is disabled use reason MutliKueueAdmissionCheckAppliedPerFlavor

{
Type: kueue.ClusterQueueActive,
Status: metav1.ConditionFalse,
Reason: "MultipleSingleInstanceControllerAdmissionChecks",
Copy link
Contributor

Choose a reason for hiding this comment

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

Make this specific as in the other comment.

@trasc
Copy link
Contributor

trasc commented Oct 18, 2024

/uncc

@k8s-ci-robot k8s-ci-robot removed the request for review from trasc October 18, 2024 13:25
Comment on lines +190 to +193

ginkgo.By("Disabling AdmissionCheckValidationRules feature", func() {
gomega.Expect(features.SetEnable(features.AdmissionCheckValidationRules, false)).To(gomega.Succeed())
})
Copy link
Contributor

@mbobrovskyi mbobrovskyi Oct 18, 2024

Choose a reason for hiding this comment

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

I think it should be disabled by default, no?

Comment on lines +343 to +345
ginkgo.By("Enabling AdmissionCheckValidationRules feature", func() {
gomega.Expect(features.SetEnable(features.AdmissionCheckValidationRules, true)).To(gomega.Succeed())
})
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
ginkgo.By("Enabling AdmissionCheckValidationRules feature", func() {
gomega.Expect(features.SetEnable(features.AdmissionCheckValidationRules, true)).To(gomega.Succeed())
})
ginkgo.By("Enabling AdmissionCheckValidationRules feature", func() {
features.SetFeatureGateDuringTest(ginkgo.GinkgoTB(), features.ConfigurableResourceTransformations, true)
})

@@ -255,6 +255,7 @@ The currently supported features are:
| `TopologyAwareScheduling` | `false` | Alpha | 0.9 | |
| `ConfigurableResourceTransformations` | `false` | Alpha | 0.9 | |
| `WorkloadResourceRequestsSummary` | `false` | Alpha | 0.9 | |
| `AdmissionCheckValidationRules` | `false` | Alpha | 0.9 | 0.9 |
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
| `AdmissionCheckValidationRules` | `false` | Alpha | 0.9 | 0.9 |
| `AdmissionCheckValidationRules` | `false` | Deprecated | 0.9 | 0.9 |

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 19, 2024
@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

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-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note-action-required Denotes a PR that introduces potentially breaking changes that require user action. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[MultiKueue] AdmissionCheck conditions are confusing
5 participants