HIVE-3132: Switch to Admission v1#2881
HIVE-3132: Switch to Admission v1#2881openshift-merge-bot[bot] merged 1 commit intoopenshift:masterfrom
Conversation
|
@2uasimojo: This pull request references HIVE-3132 which is a valid jira issue. DetailsIn response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughReplaced admission.k8s.io/v1beta1 with admission.k8s.io/v1 across webhook YAMLs, embedded assets, scheme registration, validating-webhook implementations, unit/e2e tests, and AdmissionReview fixtures; added a new clusterdeploymentcustomization webhook asset and removed DELETE from the clusterpool webhook operations. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@2uasimojo: This pull request references HIVE-3132 which is a valid jira issue. DetailsIn response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
pkg/validating-webhooks/hive/v1/clusterdeployment_validating_admission_hook.go (1)
978-1029:⚠️ Potential issue | 🟠 MajorGuard empty ingress domains before wildcard validation.
Line 992 can still reach
validateIngressDomainsNotWildcard, and that helper indexesingress.Domain[0]. An emptyspec.ingress[*].domainwill panic the webhook instead of returning a validation error.🛠️ Suggested hardening
func validateIngress(cd *hivev1.ClusterDeployment, contextLogger *log.Entry) *admissionv1.AdmissionResponse { if !validateIngressList(&cd.Spec) { message := "Ingress list must include a default entry" contextLogger.Infof("Failed validation: %v", message) return &admissionv1.AdmissionResponse{ Allowed: false, Result: &metav1.Status{ Status: metav1.StatusFailure, Code: http.StatusBadRequest, Reason: metav1.StatusReasonBadRequest, Message: message, }, } } + + for _, ingress := range cd.Spec.Ingress { + if ingress.Domain == "" { + message := "Ingress domain must not be empty" + contextLogger.Infof("Failed validation: %v", message) + return &admissionv1.AdmissionResponse{ + Allowed: false, + Result: &metav1.Status{ + Status: metav1.StatusFailure, Code: http.StatusBadRequest, Reason: metav1.StatusReasonBadRequest, + Message: message, + }, + } + } + } if !validateIngressDomainsNotWildcard(&cd.Spec) { message := "Ingress domains must not lead with *" contextLogger.Infof("Failed validation: %v", message) return &admissionv1.AdmissionResponse{🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@pkg/validating-webhooks/hive/v1/clusterdeployment_validating_admission_hook.go` around lines 978 - 1029, The webhook can panic because validateIngressDomainsNotWildcard assumes ingress.Domain[0] exists; update the validation to guard empty domain slices (either add a pre-check in validateIngress to reject ingress entries with len(ingress.Domain)==0 before calling validateIngressDomainsNotWildcard, or modify validateIngressDomainsNotWildcard itself to first check each ingress.Domain length and return false if any are empty) so that accessing ingress.Domain[0] is safe and an appropriate AdmissionResponse is returned; refer to validateIngress and validateIngressDomainsNotWildcard to locate the change.
🧹 Nitpick comments (1)
pkg/validating-webhooks/hive/v1/selector_syncset_validating_admission_hook_test.go (1)
100-109: Remove duplicate table cases to reduce noise.Line 100 and Line 106 duplicate the earlier SecretReference create/update cases (Line 88 and Line 94) with the same setup and expected result.
♻️ Proposed cleanup
- { - name: "Test valid SecretReference create", - operation: admissionv1.Create, - selectorSyncSet: testSecretReferenceSelectorSyncSet(), - expectedAllowed: true, - }, - { - name: "Test valid SecretReference update", - operation: admissionv1.Update, - selectorSyncSet: testSecretReferenceSelectorSyncSet(), - expectedAllowed: true, - },🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@pkg/validating-webhooks/hive/v1/selector_syncset_validating_admission_hook_test.go` around lines 100 - 109, Remove the duplicate table-driven test cases that repeat the SecretReference create/update checks: locate the test entries using selectorSyncSet: testSecretReferenceSelectorSyncSet() with operation: admissionv1.Create and admissionv1.Update and expectedAllowed: true and delete the redundant instances (they mirror the earlier cases). Ensure only the original create/update cases remain so the test table has no duplicate entries and the test name strings ("Test valid SecretReference create"/"Test valid SecretReference update") are unique.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@pkg/validating-webhooks/hive/v1/clusterdeploymentcustomization_validating_admission_hook.go`:
- Line 72: Create a ValidatingWebhookConfiguration manifest named
clusterdeploymentcustomization-webhook.yaml that matches the migrated v1 hook
(ensure the webhook rules, clientConfig URL/Service, admissionReviewVersions:
["v1"], and the same metadata as the
ClusterDeploymentCustomizationValidatingAdmissionHook Validate handler expect),
place it in config/hiveadmission/, and add the new file to the embed list in
pkg/operator/assets/bindata.go so it is bundled into the operator binary and the
apiserver can route AdmissionReview v1 requests to the
ClusterDeploymentCustomizationValidatingAdmissionHook.Validate endpoint.
---
Outside diff comments:
In
`@pkg/validating-webhooks/hive/v1/clusterdeployment_validating_admission_hook.go`:
- Around line 978-1029: The webhook can panic because
validateIngressDomainsNotWildcard assumes ingress.Domain[0] exists; update the
validation to guard empty domain slices (either add a pre-check in
validateIngress to reject ingress entries with len(ingress.Domain)==0 before
calling validateIngressDomainsNotWildcard, or modify
validateIngressDomainsNotWildcard itself to first check each ingress.Domain
length and return false if any are empty) so that accessing ingress.Domain[0] is
safe and an appropriate AdmissionResponse is returned; refer to validateIngress
and validateIngressDomainsNotWildcard to locate the change.
---
Nitpick comments:
In
`@pkg/validating-webhooks/hive/v1/selector_syncset_validating_admission_hook_test.go`:
- Around line 100-109: Remove the duplicate table-driven test cases that repeat
the SecretReference create/update checks: locate the test entries using
selectorSyncSet: testSecretReferenceSelectorSyncSet() with operation:
admissionv1.Create and admissionv1.Update and expectedAllowed: true and delete
the redundant instances (they mirror the earlier cases). Ensure only the
original create/update cases remain so the test table has no duplicate entries
and the test name strings ("Test valid SecretReference create"/"Test valid
SecretReference update") are unique.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 30d18991-2a7e-4431-9d72-c15861c63590
📒 Files selected for processing (27)
config/hiveadmission/clusterdeployment-webhook.yamlconfig/hiveadmission/clusterimageset-webhook.yamlconfig/hiveadmission/clusterprovision-webhook.yamlconfig/hiveadmission/dnszones-webhook.yamlconfig/hiveadmission/machinepool-webhook.yamlconfig/hiveadmission/selectorsyncset-webhook.yamlconfig/hiveadmission/syncset-webhook.yamlpkg/operator/assets/bindata.gopkg/util/scheme/scheme.gopkg/validating-webhooks/hive/v1/clusterdeployment_validating_admission_hook.gopkg/validating-webhooks/hive/v1/clusterdeployment_validating_admission_hook_test.gopkg/validating-webhooks/hive/v1/clusterdeploymentcustomization_validating_admission_hook.gopkg/validating-webhooks/hive/v1/clusterimageset_validating_admission_hook.gopkg/validating-webhooks/hive/v1/clusterimageset_validating_admission_hook_test.gopkg/validating-webhooks/hive/v1/clusterpool_validating_admission_hook.gopkg/validating-webhooks/hive/v1/clusterpool_validating_admission_hook_test.gopkg/validating-webhooks/hive/v1/clusterprovision_validating_admission_hook.gopkg/validating-webhooks/hive/v1/clusterprovision_validating_admission_hook_test.gopkg/validating-webhooks/hive/v1/dnszone_validating_admission_hook.gopkg/validating-webhooks/hive/v1/dnszone_validating_admission_hook_test.gopkg/validating-webhooks/hive/v1/machinepool_validating_admission_hook.gopkg/validating-webhooks/hive/v1/machinepool_validating_admission_hook_test.gopkg/validating-webhooks/hive/v1/selector_syncset_validating_admission_hook.gopkg/validating-webhooks/hive/v1/selector_syncset_validating_admission_hook_test.gopkg/validating-webhooks/hive/v1/syncset_validating_admission_hook.gopkg/validating-webhooks/hive/v1/syncset_validating_admission_hook_test.gotest/e2e/postdeploy/admission/admission_test.go
pkg/validating-webhooks/hive/v1/clusterdeploymentcustomization_validating_admission_hook.go
Show resolved
Hide resolved
|
Okay @coderabbitai, we're seeing the exact same e2e failure here as we were in #2880, despite there being no remnants of v1beta1 in our code. Why is the server still sending v1beta1? |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 263475 🏁 Script executed: Length of output: 0 🏁 Script executed: Length of output: 0 🏁 Script executed: Length of output: 24053
Given the e2e is still seeing v1beta1, the most likely cause is stale webhook configuration on the cluster that wasn’t updated yet by the operator during the test run. Can you grab these from the failing job’s cluster to confirm?
If any of them still include v1beta1 (or have both with v1beta1 first), that explains the behavior. Ensuring the operator rolls out first and reconciles these objects so they read ["v1"] only should make the apiserver send v1. Repo evidence:
If you’d like, I can also dig into the operator reconcile to verify it patches admissionReviewVersions on existing resources during upgrades. |
|
@coderabbitai Well, each CI run builds the code from scratch, installs a fresh cluster, and deploys the webhook configs from bindata.go, so there should be zero chance anything is stale. The test cluster gets torn down immediately, so I can't query the VWHCs live, but we do save several of them, e.g. this one and you can see it lists Interestingly, e2e-pool passed here, whereas it encountered this error in #2880. What say you to that? |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 32 🏁 Script executed: Length of output: 8158 🏁 Script executed: Length of output: 9502
The The fix is a one-line change in each file: - "apiVersion": "admission.k8s.io/v1beta1",
+ "apiVersion": "admission.k8s.io/v1",Applied to all three files. For example, {
"apiVersion": "admission.k8s.io/v1",
"kind": "AdmissionReview",
"request": {
"kind": {
"group": "hive.openshift.io",
"version": "v1",
"kind": "DNSZone"
},
"resource": {
"group": "hive.openshift.io",
"version": "v1",
"resource": "dnszones"
},
"operation": "CREATE",
"object": {
"metadata": {
"name": "twiest"
},
"spec": {
"zone": "this_is_invalid_dns"
}
}
}
}As for why e2e-pool passes here but failed in |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 2847 The e2e test reads JSON testdata files and posts them as 🏁 Script executed: Length of output: 2412
The e2e test reads those files as The fix is a one-liner in each of the three files: - "apiVersion": "admission.k8s.io/v1beta1",
+ "apiVersion": "admission.k8s.io/v1",That also explains the e2e-pool asymmetry: e2e-pool tests ClusterPool admission through a different path that doesn't touch these testdata files, so it passes cleanly. |
|
Gah! Thanks @coderabbitai -- I caught that in #2880 but missed it here! Fixing. |
f8d8e86 to
f03a4c0
Compare
|
Tip For best results, initiate chat on the files or code changes.
|
|
@2uasimojo: This pull request references HIVE-3132 which is a valid jira issue. DetailsIn response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
f03a4c0 to
2c0a2b9
Compare
|
@2uasimojo: This pull request references HIVE-3132 which is a valid jira issue. DetailsIn response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
pkg/operator/assets/bindata.go (1)
361-389:⚠️ Potential issue | 🔴 CriticalCritical:
bindata.goout of sync—clusterpool webhook still contains stalev1beta1.The source file
config/hiveadmission/clusterpool-webhook.yamlhas been correctly updated toadmissionReviewVersions: [v1], butpkg/operator/assets/bindata.gowas not regenerated. Line 369 still contains the stalev1beta1value, while all other webhooks in bindata.go correctly showv1.Since bindata.go is auto-generated (
@generatedmarker), you must regenerate it from the source YAML files. The clusterpool webhook will otherwise advertise v1beta1 support to the API server despite the Go implementation expecting v1 admission requests.Regenerate the bindata.go file using the appropriate go-bindata command (typically
go generate ./...or similar tooling as defined in your Makefile/build scripts).🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@pkg/operator/assets/bindata.go` around lines 361 - 389, The embedded YAML in variable _configHiveadmissionClusterpoolWebhookYaml in pkg/operator/assets/bindata.go still advertises admissionReviewVersions: v1beta1; regenerate the generated bindata to sync with the updated source config/hiveadmission/clusterpool-webhook.yaml (which uses v1). Run the project’s generation step (e.g. the Makefile/build script or go generate ./... / the repo-specific go-bindata invocation) to recreate bindata.go so the _configHiveadmissionClusterpoolWebhookYaml byte slice contains admissionReviewVersions: [v1]; verify the file is updated and commit the regenerated file.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@pkg/operator/assets/bindata.go`:
- Around line 361-389: The embedded YAML in variable
_configHiveadmissionClusterpoolWebhookYaml in pkg/operator/assets/bindata.go
still advertises admissionReviewVersions: v1beta1; regenerate the generated
bindata to sync with the updated source
config/hiveadmission/clusterpool-webhook.yaml (which uses v1). Run the project’s
generation step (e.g. the Makefile/build script or go generate ./... / the
repo-specific go-bindata invocation) to recreate bindata.go so the
_configHiveadmissionClusterpoolWebhookYaml byte slice contains
admissionReviewVersions: [v1]; verify the file is updated and commit the
regenerated file.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 7f19f9ab-269c-4305-b3d9-b94dcb04c7f3
📒 Files selected for processing (31)
config/hiveadmission/clusterdeployment-webhook.yamlconfig/hiveadmission/clusterimageset-webhook.yamlconfig/hiveadmission/clusterpool-webhook.yamlconfig/hiveadmission/clusterprovision-webhook.yamlconfig/hiveadmission/dnszones-webhook.yamlconfig/hiveadmission/machinepool-webhook.yamlconfig/hiveadmission/selectorsyncset-webhook.yamlconfig/hiveadmission/syncset-webhook.yamlpkg/operator/assets/bindata.gopkg/util/scheme/scheme.gopkg/validating-webhooks/hive/v1/clusterdeployment_validating_admission_hook.gopkg/validating-webhooks/hive/v1/clusterdeployment_validating_admission_hook_test.gopkg/validating-webhooks/hive/v1/clusterdeploymentcustomization_validating_admission_hook.gopkg/validating-webhooks/hive/v1/clusterimageset_validating_admission_hook.gopkg/validating-webhooks/hive/v1/clusterimageset_validating_admission_hook_test.gopkg/validating-webhooks/hive/v1/clusterpool_validating_admission_hook.gopkg/validating-webhooks/hive/v1/clusterpool_validating_admission_hook_test.gopkg/validating-webhooks/hive/v1/clusterprovision_validating_admission_hook.gopkg/validating-webhooks/hive/v1/clusterprovision_validating_admission_hook_test.gopkg/validating-webhooks/hive/v1/dnszone_validating_admission_hook.gopkg/validating-webhooks/hive/v1/dnszone_validating_admission_hook_test.gopkg/validating-webhooks/hive/v1/machinepool_validating_admission_hook.gopkg/validating-webhooks/hive/v1/machinepool_validating_admission_hook_test.gopkg/validating-webhooks/hive/v1/selector_syncset_validating_admission_hook.gopkg/validating-webhooks/hive/v1/selector_syncset_validating_admission_hook_test.gopkg/validating-webhooks/hive/v1/syncset_validating_admission_hook.gopkg/validating-webhooks/hive/v1/syncset_validating_admission_hook_test.gotest/e2e/postdeploy/admission/admission_test.gotest/e2e/postdeploy/admission/testdata/hiveadmission-review-failure.jsontest/e2e/postdeploy/admission/testdata/hiveadmission-review-success.jsontest/e2e/postdeploy/admission/testdata/hiveadmission-review-update-failure.json
✅ Files skipped from review due to trivial changes (15)
- config/hiveadmission/clusterprovision-webhook.yaml
- config/hiveadmission/clusterimageset-webhook.yaml
- test/e2e/postdeploy/admission/testdata/hiveadmission-review-failure.json
- test/e2e/postdeploy/admission/admission_test.go
- config/hiveadmission/dnszones-webhook.yaml
- config/hiveadmission/clusterpool-webhook.yaml
- config/hiveadmission/syncset-webhook.yaml
- test/e2e/postdeploy/admission/testdata/hiveadmission-review-update-failure.json
- pkg/util/scheme/scheme.go
- config/hiveadmission/clusterdeployment-webhook.yaml
- pkg/validating-webhooks/hive/v1/machinepool_validating_admission_hook_test.go
- pkg/validating-webhooks/hive/v1/clusterpool_validating_admission_hook_test.go
- pkg/validating-webhooks/hive/v1/selector_syncset_validating_admission_hook_test.go
- pkg/validating-webhooks/hive/v1/clusterdeployment_validating_admission_hook_test.go
- pkg/validating-webhooks/hive/v1/syncset_validating_admission_hook_test.go
🚧 Files skipped from review as they are similar to previous changes (13)
- config/hiveadmission/machinepool-webhook.yaml
- pkg/validating-webhooks/hive/v1/clusterimageset_validating_admission_hook_test.go
- config/hiveadmission/selectorsyncset-webhook.yaml
- pkg/validating-webhooks/hive/v1/clusterprovision_validating_admission_hook_test.go
- pkg/validating-webhooks/hive/v1/syncset_validating_admission_hook.go
- pkg/validating-webhooks/hive/v1/clusterdeployment_validating_admission_hook.go
- test/e2e/postdeploy/admission/testdata/hiveadmission-review-success.json
- pkg/validating-webhooks/hive/v1/dnszone_validating_admission_hook_test.go
- pkg/validating-webhooks/hive/v1/clusterdeploymentcustomization_validating_admission_hook.go
- pkg/validating-webhooks/hive/v1/clusterpool_validating_admission_hook.go
- pkg/validating-webhooks/hive/v1/dnszone_validating_admission_hook.go
- pkg/validating-webhooks/hive/v1/clusterprovision_validating_admission_hook.go
- pkg/validating-webhooks/hive/v1/clusterimageset_validating_admission_hook.go
7cee0ee to
d72cf4c
Compare
|
@2uasimojo: This pull request references HIVE-3132 which is a valid jira issue. DetailsIn response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@pkg/operator/assets/bindata.go`:
- Around line 279-280: Update the webhook assets and scheme to support a staged
migration: in the generated asset that contains the admission webhook config
(the block with admissionReviewVersions in pkg/operator/assets/bindata.go) add
v1beta1 so it advertises ["v1","v1beta1"], and in the scheme initialization
(where admission.k8s.io/v1 is registered in pkg/util/scheme/scheme.go) call
admissionv1beta1.AddToScheme() as well; this lets old pods accept v1beta1 during
a rolling upgrade so v1-only pods and v1beta1-expecting pods coexist for one
release, after which you can remove admissionv1beta1.AddToScheme() and drop
v1beta1 from admissionReviewVersions in a subsequent release.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: bf074f98-47f0-4ede-ba2a-675f864baab9
📒 Files selected for processing (31)
config/hiveadmission/clusterdeployment-webhook.yamlconfig/hiveadmission/clusterimageset-webhook.yamlconfig/hiveadmission/clusterpool-webhook.yamlconfig/hiveadmission/clusterprovision-webhook.yamlconfig/hiveadmission/dnszones-webhook.yamlconfig/hiveadmission/machinepool-webhook.yamlconfig/hiveadmission/selectorsyncset-webhook.yamlconfig/hiveadmission/syncset-webhook.yamlpkg/operator/assets/bindata.gopkg/util/scheme/scheme.gopkg/validating-webhooks/hive/v1/clusterdeployment_validating_admission_hook.gopkg/validating-webhooks/hive/v1/clusterdeployment_validating_admission_hook_test.gopkg/validating-webhooks/hive/v1/clusterdeploymentcustomization_validating_admission_hook.gopkg/validating-webhooks/hive/v1/clusterimageset_validating_admission_hook.gopkg/validating-webhooks/hive/v1/clusterimageset_validating_admission_hook_test.gopkg/validating-webhooks/hive/v1/clusterpool_validating_admission_hook.gopkg/validating-webhooks/hive/v1/clusterpool_validating_admission_hook_test.gopkg/validating-webhooks/hive/v1/clusterprovision_validating_admission_hook.gopkg/validating-webhooks/hive/v1/clusterprovision_validating_admission_hook_test.gopkg/validating-webhooks/hive/v1/dnszone_validating_admission_hook.gopkg/validating-webhooks/hive/v1/dnszone_validating_admission_hook_test.gopkg/validating-webhooks/hive/v1/machinepool_validating_admission_hook.gopkg/validating-webhooks/hive/v1/machinepool_validating_admission_hook_test.gopkg/validating-webhooks/hive/v1/selector_syncset_validating_admission_hook.gopkg/validating-webhooks/hive/v1/selector_syncset_validating_admission_hook_test.gopkg/validating-webhooks/hive/v1/syncset_validating_admission_hook.gopkg/validating-webhooks/hive/v1/syncset_validating_admission_hook_test.gotest/e2e/postdeploy/admission/admission_test.gotest/e2e/postdeploy/admission/testdata/hiveadmission-review-failure.jsontest/e2e/postdeploy/admission/testdata/hiveadmission-review-success.jsontest/e2e/postdeploy/admission/testdata/hiveadmission-review-update-failure.json
✅ Files skipped from review due to trivial changes (17)
- config/hiveadmission/clusterprovision-webhook.yaml
- test/e2e/postdeploy/admission/testdata/hiveadmission-review-failure.json
- config/hiveadmission/clusterimageset-webhook.yaml
- test/e2e/postdeploy/admission/admission_test.go
- test/e2e/postdeploy/admission/testdata/hiveadmission-review-success.json
- pkg/validating-webhooks/hive/v1/machinepool_validating_admission_hook_test.go
- pkg/validating-webhooks/hive/v1/syncset_validating_admission_hook_test.go
- config/hiveadmission/clusterdeployment-webhook.yaml
- config/hiveadmission/selectorsyncset-webhook.yaml
- pkg/validating-webhooks/hive/v1/clusterimageset_validating_admission_hook_test.go
- test/e2e/postdeploy/admission/testdata/hiveadmission-review-update-failure.json
- pkg/validating-webhooks/hive/v1/clusterprovision_validating_admission_hook_test.go
- pkg/validating-webhooks/hive/v1/clusterdeployment_validating_admission_hook_test.go
- config/hiveadmission/clusterpool-webhook.yaml
- pkg/validating-webhooks/hive/v1/selector_syncset_validating_admission_hook_test.go
- pkg/util/scheme/scheme.go
- pkg/validating-webhooks/hive/v1/clusterdeploymentcustomization_validating_admission_hook.go
🚧 Files skipped from review as they are similar to previous changes (11)
- config/hiveadmission/dnszones-webhook.yaml
- config/hiveadmission/machinepool-webhook.yaml
- config/hiveadmission/syncset-webhook.yaml
- pkg/validating-webhooks/hive/v1/clusterpool_validating_admission_hook_test.go
- pkg/validating-webhooks/hive/v1/syncset_validating_admission_hook.go
- pkg/validating-webhooks/hive/v1/clusterpool_validating_admission_hook.go
- pkg/validating-webhooks/hive/v1/dnszone_validating_admission_hook_test.go
- pkg/validating-webhooks/hive/v1/clusterdeployment_validating_admission_hook.go
- pkg/validating-webhooks/hive/v1/dnszone_validating_admission_hook.go
- pkg/validating-webhooks/hive/v1/selector_syncset_validating_admission_hook.go
- pkg/validating-webhooks/hive/v1/machinepool_validating_admission_hook.go
|
/assign @suhanime |
d72cf4c to
3569285
Compare
| - name: clusterdeploymentcustomizationvalidators.admission.hive.openshift.io | ||
| admissionReviewVersions: | ||
| - v1beta1 | ||
| - v1 |
|
@2uasimojo: This pull request references HIVE-3132 which is a valid jira issue. DetailsIn response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
|
Now stacked on #2882, which should merge after retesting. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
pkg/validating-webhooks/hive/v1/clusterdeploymentcustomization_validating_admission_hook.go (1)
22-22: Please pin this fix with a regression test.A typo here turns the webhook into a silent no-op, so a small
ValidateorshouldValidateunit test forclusterdeploymentcustomizationswould be worth adding.Also applies to: 107-129
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@pkg/validating-webhooks/hive/v1/clusterdeploymentcustomization_validating_admission_hook.go` at line 22, The constant clusterDeploymentCustomizationResource is mis-typed causing the webhook to no-op; fix the constant value to exactly match the resource name your shouldValidate/Validate logic expects and any GroupVersionResource checks, then add a regression unit test that constructs an admission request for "clusterdeploymentcustomizations" (the exact expected resource) and asserts shouldValidate(...) returns true and Validate(...) runs non-trivially (returns expected error/allow decision). Update tests covering the logic in the same area referenced (the code around shouldValidate/Validate, previously noted lines ~107-129) so the test will fail if the resource string regresses again.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In
`@pkg/validating-webhooks/hive/v1/clusterdeploymentcustomization_validating_admission_hook.go`:
- Line 22: The constant clusterDeploymentCustomizationResource is mis-typed
causing the webhook to no-op; fix the constant value to exactly match the
resource name your shouldValidate/Validate logic expects and any
GroupVersionResource checks, then add a regression unit test that constructs an
admission request for "clusterdeploymentcustomizations" (the exact expected
resource) and asserts shouldValidate(...) returns true and Validate(...) runs
non-trivially (returns expected error/allow decision). Update tests covering the
logic in the same area referenced (the code around shouldValidate/Validate,
previously noted lines ~107-129) so the test will fail if the resource string
regresses again.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: bb4ce6e5-db28-4170-91d2-fdb005b7eaba
📒 Files selected for processing (34)
.coderabbit.yamlconfig/hiveadmission/clusterdeployment-webhook.yamlconfig/hiveadmission/clusterdeploymentcustomization-webhook.yamlconfig/hiveadmission/clusterimageset-webhook.yamlconfig/hiveadmission/clusterpool-webhook.yamlconfig/hiveadmission/clusterprovision-webhook.yamlconfig/hiveadmission/dnszones-webhook.yamlconfig/hiveadmission/machinepool-webhook.yamlconfig/hiveadmission/selectorsyncset-webhook.yamlconfig/hiveadmission/syncset-webhook.yamlpkg/operator/assets/bindata.gopkg/operator/hive/hiveadmission.gopkg/util/scheme/scheme.gopkg/validating-webhooks/hive/v1/clusterdeployment_validating_admission_hook.gopkg/validating-webhooks/hive/v1/clusterdeployment_validating_admission_hook_test.gopkg/validating-webhooks/hive/v1/clusterdeploymentcustomization_validating_admission_hook.gopkg/validating-webhooks/hive/v1/clusterimageset_validating_admission_hook.gopkg/validating-webhooks/hive/v1/clusterimageset_validating_admission_hook_test.gopkg/validating-webhooks/hive/v1/clusterpool_validating_admission_hook.gopkg/validating-webhooks/hive/v1/clusterpool_validating_admission_hook_test.gopkg/validating-webhooks/hive/v1/clusterprovision_validating_admission_hook.gopkg/validating-webhooks/hive/v1/clusterprovision_validating_admission_hook_test.gopkg/validating-webhooks/hive/v1/dnszone_validating_admission_hook.gopkg/validating-webhooks/hive/v1/dnszone_validating_admission_hook_test.gopkg/validating-webhooks/hive/v1/machinepool_validating_admission_hook.gopkg/validating-webhooks/hive/v1/machinepool_validating_admission_hook_test.gopkg/validating-webhooks/hive/v1/selector_syncset_validating_admission_hook.gopkg/validating-webhooks/hive/v1/selector_syncset_validating_admission_hook_test.gopkg/validating-webhooks/hive/v1/syncset_validating_admission_hook.gopkg/validating-webhooks/hive/v1/syncset_validating_admission_hook_test.gotest/e2e/postdeploy/admission/admission_test.gotest/e2e/postdeploy/admission/testdata/hiveadmission-review-failure.jsontest/e2e/postdeploy/admission/testdata/hiveadmission-review-success.jsontest/e2e/postdeploy/admission/testdata/hiveadmission-review-update-failure.json
✅ Files skipped from review due to trivial changes (18)
- config/hiveadmission/clusterimageset-webhook.yaml
- config/hiveadmission/clusterprovision-webhook.yaml
- config/hiveadmission/machinepool-webhook.yaml
- config/hiveadmission/syncset-webhook.yaml
- config/hiveadmission/clusterdeployment-webhook.yaml
- config/hiveadmission/dnszones-webhook.yaml
- test/e2e/postdeploy/admission/testdata/hiveadmission-review-success.json
- test/e2e/postdeploy/admission/testdata/hiveadmission-review-update-failure.json
- test/e2e/postdeploy/admission/admission_test.go
- config/hiveadmission/selectorsyncset-webhook.yaml
- config/hiveadmission/clusterdeploymentcustomization-webhook.yaml
- pkg/validating-webhooks/hive/v1/clusterimageset_validating_admission_hook_test.go
- pkg/validating-webhooks/hive/v1/clusterprovision_validating_admission_hook_test.go
- .coderabbit.yaml
- test/e2e/postdeploy/admission/testdata/hiveadmission-review-failure.json
- pkg/validating-webhooks/hive/v1/clusterdeployment_validating_admission_hook.go
- pkg/validating-webhooks/hive/v1/clusterdeployment_validating_admission_hook_test.go
- pkg/validating-webhooks/hive/v1/clusterpool_validating_admission_hook.go
🚧 Files skipped from review as they are similar to previous changes (9)
- pkg/util/scheme/scheme.go
- pkg/validating-webhooks/hive/v1/clusterpool_validating_admission_hook_test.go
- pkg/validating-webhooks/hive/v1/dnszone_validating_admission_hook_test.go
- pkg/validating-webhooks/hive/v1/selector_syncset_validating_admission_hook_test.go
- config/hiveadmission/clusterpool-webhook.yaml
- pkg/validating-webhooks/hive/v1/syncset_validating_admission_hook_test.go
- pkg/validating-webhooks/hive/v1/selector_syncset_validating_admission_hook.go
- pkg/validating-webhooks/hive/v1/clusterimageset_validating_admission_hook.go
- pkg/operator/assets/bindata.go
|
I have a few questions:
|
This PR only addresses What AgentClusterInstall piece are you referring to? What syncset sample are you referring to? Again, suspect these ⬆️ are talking about different APIs. |
|
/lgtm |
v1beta1 has been deprecated, and the last k8s that didn't support v1 (1.16, I think) has been "out of support", for long enough that we should be safe to move fully to v1 now.
3569285 to
5a53841
Compare
|
/lgtm |
1 similar comment
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: 2uasimojo, suhanime The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@2uasimojo: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions 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. |
v1beta1 has been deprecated, and the last k8s that didn't support v1 (1.16, I think) has been "out of support", for long enough that we should be safe to move fully to v1 now.
Summary by CodeRabbit