-
Notifications
You must be signed in to change notification settings - Fork 260
HIVE-3133: VWHC for ClusterDeploymentCustomization #2882
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| --- | ||
| apiVersion: admissionregistration.k8s.io/v1 | ||
| kind: ValidatingWebhookConfiguration | ||
| metadata: | ||
| name: clusterdeploymentcustomizationvalidators.admission.hive.openshift.io | ||
| webhooks: | ||
| - name: clusterdeploymentcustomizationvalidators.admission.hive.openshift.io | ||
| admissionReviewVersions: | ||
| - v1beta1 | ||
| clientConfig: | ||
| service: | ||
| # reach the webhook via the registered aggregated API | ||
| namespace: default | ||
| name: kubernetes | ||
| path: /apis/admission.hive.openshift.io/v1/clusterdeploymentcustomizationvalidators | ||
| rules: | ||
| - operations: | ||
| - CREATE | ||
| - UPDATE | ||
| apiGroups: | ||
| - hive.openshift.io | ||
| apiVersions: | ||
| - v1 | ||
| resources: | ||
| - clusterdeploymentcustomizations | ||
| failurePolicy: Fail | ||
| sideEffects: None |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,7 +17,6 @@ webhooks: | |
| - operations: | ||
| - CREATE | ||
| - UPDATE | ||
| - DELETE | ||
| apiGroups: | ||
| - hive.openshift.io | ||
| apiVersions: | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,7 +19,7 @@ import ( | |
| const ( | ||
| clusterDeploymentCustomizationGroup = "hive.openshift.io" | ||
| clusterDeploymentCustomizationVersion = "v1" | ||
| clusterDeploymentCustomizationResource = "clusterdeploymentcustomization" | ||
| clusterDeploymentCustomizationResource = "clusterdeploymentcustomizations" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "1) Find ClusterDeploymentCustomization validating hook tests"
fd 'clusterdeploymentcustomization.*_test\.go$' pkg || true
echo
echo "2) Find test coverage for this hook/resource/operations"
rg -nP --type=go '(ClusterDeploymentCustomizationValidatingAdmissionHook|clusterdeploymentcustomizations|admissionv1beta1\.(Create|Update))' pkg -g '*_test.go' || trueRepository: openshift/hive Length of output: 31435 🏁 Script executed: cat -n pkg/validating-webhooks/hive/v1/clusterdeploymentcustomization_validating_admission_hook.go | head -80Repository: openshift/hive Length of output: 4442 🏁 Script executed: find config -name '*clusterdeploymentcustomization*' -o -name '*webhook*' | grep -i customization || echo "No webhook config found for customization"Repository: openshift/hive Length of output: 189 🏁 Script executed: rg -l 'clusterdeploymentcustomizations|ClusterDeploymentCustomization' config/ || echo "No matches in config/"Repository: openshift/hive Length of output: 358 🏁 Script executed: cat -n pkg/validating-webhooks/hive/v1/clusterdeploymentcustomization_validating_admission_hook.go | tail -100Repository: openshift/hive Length of output: 4476 🏁 Script executed: cat -n config/hiveadmission/clusterdeploymentcustomization-webhook.yamlRepository: openshift/hive Length of output: 982 🏁 Script executed: rg -n 'ClusterDeploymentCustomization' pkg/ -g 'hiveadmission.go' -A 3 -B 3Repository: openshift/hive Length of output: 40 🏁 Script executed: find pkg -name 'hiveadmission.go' -type fRepository: openshift/hive Length of output: 92 🏁 Script executed: rg -n 'NewClusterDeploymentCustomization|clusterdeploymentcustomization' pkg/ --type go -i | grep -i admissionRepository: openshift/hive Length of output: 8251 🏁 Script executed: rg -A 10 -B 5 'clusterdeploymentcustomization-webhook.yaml' pkg/operator/hive/hiveadmission.goRepository: openshift/hive Length of output: 835 Add dedicated test file for ClusterDeploymentCustomization validating webhook. This hook lacks regression tests despite other similar hooks (clusterdeployment, syncset, dnszone, etc.) having comprehensive test coverage. Create a
🤖 Prompt for AI Agents |
||
|
|
||
| clusterDeploymentCustomizationAdmissionGroup = "admission.hive.openshift.io" | ||
| clusterDeploymentCustomizationAdmissionVersion = "v1" | ||
|
|
@@ -124,7 +124,7 @@ func (a *ClusterDeploymentCustomizationValidatingAdmissionHook) shouldValidate(a | |
| } | ||
|
|
||
| if admissionSpec.Resource.Resource != clusterDeploymentCustomizationResource { | ||
| contextLogger.Info("Returning False, it's our group and version, but not the right resource") | ||
| contextLogger.WithField("resource", admissionSpec.Resource.Resource).Info("Returning False, it's our group and version, but not the right resource") | ||
| return false | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.