HIVE-3131: Add ValidatingWebhookConfiguration for ClusterPool#2879
Conversation
Turns out we've been running without this... forever, despite having plenty of code for it in our admission server.
|
@2uasimojo: This pull request references HIVE-3131 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. |
|
/assign @suhanime |
📝 WalkthroughWalkthroughAdds a new Kubernetes ValidatingWebhookConfiguration for clusterpool resource validation. The webhook manifest is embedded as a binary asset and integrated into the HiveAdmission operator's deployment flow to validate CREATE, UPDATE, and DELETE operations on clusterpools. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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-3131 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. |
|
👀 e2e-pool... |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
config/hiveadmission/clusterpool-webhook.yaml (1)
8-9: Addv1toadmissionReviewVersionsfor forward compatibility.The webhook only specifies
v1beta1for admission review versions. Modern Kubernetes best practice is to listv1as the preferred version, optionally includingv1beta1for backward compatibility with older clients. The project targets Kubernetes 1.34, which fully supportsv1for admission review versions.Suggested change
admissionReviewVersions: + - v1 - v1beta1🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@config/hiveadmission/clusterpool-webhook.yaml` around lines 8 - 9, The manifest currently lists only admissionReviewVersions: - v1beta1; update the admissionReviewVersions array to include v1 (preferably first) for forward compatibility with Kubernetes 1.34 while optionally keeping v1beta1 for older clients — e.g., change the admissionReviewVersions entries to include "v1" and "v1beta1" (reference the admissionReviewVersions key and the existing "v1beta1" entry to locate the change).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@config/hiveadmission/clusterpool-webhook.yaml`:
- Around line 8-9: The manifest currently lists only admissionReviewVersions: -
v1beta1; update the admissionReviewVersions array to include v1 (preferably
first) for forward compatibility with Kubernetes 1.34 while optionally keeping
v1beta1 for older clients — e.g., change the admissionReviewVersions entries to
include "v1" and "v1beta1" (reference the admissionReviewVersions key and the
existing "v1beta1" entry to locate the change).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 8b095168-3632-47e6-b42e-228ac6494450
📒 Files selected for processing (3)
config/hiveadmission/clusterpool-webhook.yamlpkg/operator/assets/bindata.gopkg/operator/hive/hiveadmission.go
|
@coderabbitai if possible, it sure would be helpful for you to hop on over to pkg/validating-webhooks/hive/v1/clusterpool_validating_admission_hook.go and trace the validations we're going to suddenly be performing as the result of this PR. Since we haven't been running this code in production, there is a chance it has drifted and that some of it is incorrect. We're less worried about missing checks at the moment -- after all, we've been missing everything up to now -- but rather, we're concerned that there may be checks in place that will reject valid configurations, thereby causing regressions in behavior in the field. |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chainLet me pull up the validation hook file and any relevant types so I can trace through all the checks. 🏁 Script executed: Length of output: 9519 The key function 🏁 Script executed: Length of output: 17638 🏁 Script executed: Length of output: 49493
CREATE checks1. Name length ( 2. Platform configuration (all platforms below) The
|
|
Thanks, @coderabbitai. The paths you've flagged also exist for ClusterDeployment, which we have been validating, and all seem appropriate. I think we're good here. |
|
Tip For best results, initiate chat on the files or code changes.
|
|
@coderabbitai Meanwhile, I've opened https://redhat.atlassian.net/browse/HIVE-3132 to track adding |
|
Tip For best results, initiate chat on the files or code changes.
|
|
/hold for QE /cc @jianping-shu |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2879 +/- ##
==========================================
- Coverage 50.31% 50.29% -0.02%
==========================================
Files 280 280
Lines 34314 34323 +9
==========================================
Hits 17264 17264
- Misses 15689 15698 +9
Partials 1361 1361
🚀 New features to boost your workflow:
|
|
@2uasimojo ClusterPool shares the real validation functions with ClusterDeployment so I only ran a lightweight test with test case OCP-88412, PTAL |
|
Thanks @jianping-shu. Based on the error you saw from the vSphere test ( /hold cancel /assign @dlom |
|
From a code maintenance standpoint, this change doesn't introduce any new business logic; we're just calling into code we already have. I imagine there could be repercussions down the line (people potentially relying on malformed cluster pool specs? unlikely tbh), but we need to have this for completeness. /lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: 2uasimojo, dlom 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. |
@2uasimojo Yes |
This was missed in openshift#1672. Side quest: Dropping `DELETE` from the ClusterPool VWHC added in openshift#2879. It didn't have functional impact, but would have been wastefully sending Delete requests to our hiveadmission service. Also adding some coderabbit config intended to catch this kind of miss in the future.
Turns out we've been running without this... forever, despite having plenty of code for it in our admission server.
Summary by CodeRabbit