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

Adding sort to reorder webhookDescription based on webhookType #5177

Merged
merged 3 commits into from
Sep 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions changelog/fragments/fix_order_of_generated_webhooks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
entries:
- description: >
Preserve the order of `webhookdefinitions` while generating bundles,
by sorting `webhookDescriptions` in CSV generator.

kind: bugfix

breaking: false
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,10 @@ func applyWebhooks(c *collector.Manifests, csv *operatorsv1alpha1.ClusterService
webhookDescriptions = append(webhookDescriptions, des...)
}
}
// Sorts the WebhookDescriptions based on natural order of webhookDescriptions Type
sort.Slice(webhookDescriptions, func(i, j int) bool {
return webhookDescriptions[i].Type < webhookDescriptions[j].Type
})
csv.Spec.WebhookDefinitions = webhookDescriptions
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,23 @@ spec:
url: https://your.domain
version: 0.0.1
webhookdefinitions:
- admissionReviewVersions: null
containerPort: 443
conversionCRDs:
- memcacheds.cache.example.com
deploymentName: memcached-operator-controller-manager
generateName: cmemcacheds.kb.io
sideEffects: None
targetPort: 9443
type: ConversionWebhook
webhookPath: /convert
- admissionReviewVersions:
- v1
- v1beta1
containerPort: 443
deploymentName: memcached-operator-controller-manager
failurePolicy: Fail
generateName: vmemcached.kb.io
generateName: mmemcached.kb.io
rules:
- apiGroups:
- cache.example.com
Expand All @@ -227,15 +237,15 @@ spec:
- memcacheds
sideEffects: None
targetPort: 9443
type: ValidatingAdmissionWebhook
webhookPath: /validate-cache-example-com-v1alpha1-memcached
type: MutatingAdmissionWebhook
webhookPath: /mutate-cache-example-com-v1alpha1-memcached
- admissionReviewVersions:
- v1
- v1beta1
containerPort: 443
deploymentName: memcached-operator-controller-manager
failurePolicy: Fail
generateName: mmemcached.kb.io
generateName: vmemcached.kb.io
rules:
- apiGroups:
- cache.example.com
Expand All @@ -248,15 +258,5 @@ spec:
- memcacheds
sideEffects: None
targetPort: 9443
type: MutatingAdmissionWebhook
webhookPath: /mutate-cache-example-com-v1alpha1-memcached
- admissionReviewVersions: null
containerPort: 443
conversionCRDs:
- memcacheds.cache.example.com
deploymentName: memcached-operator-controller-manager
generateName: cmemcacheds.kb.io
sideEffects: None
targetPort: 9443
type: ConversionWebhook
webhookPath: /convert
type: ValidatingAdmissionWebhook
webhookPath: /validate-cache-example-com-v1alpha1-memcached
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,23 @@ spec:
type: AllNamespaces
version: 0.0.1
webhookdefinitions:
- admissionReviewVersions:
- v1beta1
containerPort: 443
conversionCRDs:
- memcacheds.cache.example.com
deploymentName: memcached-operator-controller-manager
generateName: cmemcacheds.kb.io
sideEffects: None
targetPort: 9443
type: ConversionWebhook
webhookPath: /convert
- admissionReviewVersions:
- v1beta1
containerPort: 443
deploymentName: memcached-operator-controller-manager
failurePolicy: Fail
generateName: vmemcached.kb.io
generateName: mmemcached.kb.io
rules:
- apiGroups:
- cache.example.com
Expand All @@ -175,14 +186,14 @@ spec:
- memcacheds
sideEffects: None
targetPort: 9443
type: ValidatingAdmissionWebhook
webhookPath: /validate-cache-my-domain-v1alpha1-memcached
type: MutatingAdmissionWebhook
webhookPath: /mutate-cache-my-domain-v1alpha1-memcached
- admissionReviewVersions:
- v1beta1
containerPort: 443
deploymentName: memcached-operator-controller-manager
failurePolicy: Fail
generateName: mmemcached.kb.io
generateName: vmemcached.kb.io
rules:
- apiGroups:
- cache.example.com
Expand All @@ -195,16 +206,5 @@ spec:
- memcacheds
sideEffects: None
targetPort: 9443
type: MutatingAdmissionWebhook
webhookPath: /mutate-cache-my-domain-v1alpha1-memcached
- admissionReviewVersions:
- v1beta1
containerPort: 443
conversionCRDs:
- memcacheds.cache.example.com
deploymentName: memcached-operator-controller-manager
generateName: cmemcacheds.kb.io
sideEffects: None
targetPort: 9443
type: ConversionWebhook
webhookPath: /convert
type: ValidatingAdmissionWebhook
webhookPath: /validate-cache-my-domain-v1alpha1-memcached
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,23 @@ spec:
url: https://your.domain
version: 0.0.1
webhookdefinitions:
- admissionReviewVersions:
- v1beta1
containerPort: 443
conversionCRDs:
- memcacheds.cache.example.com
deploymentName: memcached-operator-controller-manager
generateName: cmemcacheds.kb.io
sideEffects: None
targetPort: 9443
type: ConversionWebhook
webhookPath: /convert
- admissionReviewVersions:
- v1beta1
containerPort: 443
deploymentName: memcached-operator-controller-manager
failurePolicy: Fail
generateName: vmemcached.kb.io
generateName: mmemcached.kb.io
rules:
- apiGroups:
- cache.example.com
Expand All @@ -231,14 +242,14 @@ spec:
- memcacheds
sideEffects: None
targetPort: 9443
type: ValidatingAdmissionWebhook
webhookPath: /validate-cache-my-domain-v1alpha1-memcached
type: MutatingAdmissionWebhook
webhookPath: /mutate-cache-my-domain-v1alpha1-memcached
- admissionReviewVersions:
- v1beta1
containerPort: 443
deploymentName: memcached-operator-controller-manager
failurePolicy: Fail
generateName: mmemcached.kb.io
generateName: vmemcached.kb.io
rules:
- apiGroups:
- cache.example.com
Expand All @@ -251,16 +262,5 @@ spec:
- memcacheds
sideEffects: None
targetPort: 9443
type: MutatingAdmissionWebhook
webhookPath: /mutate-cache-my-domain-v1alpha1-memcached
- admissionReviewVersions:
- v1beta1
containerPort: 443
conversionCRDs:
- memcacheds.cache.example.com
deploymentName: memcached-operator-controller-manager
generateName: cmemcacheds.kb.io
sideEffects: None
targetPort: 9443
type: ConversionWebhook
webhookPath: /convert
type: ValidatingAdmissionWebhook
webhookPath: /validate-cache-my-domain-v1alpha1-memcached
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ spec:
containerPort: 443
deploymentName: memcached-operator-controller-manager
failurePolicy: Fail
generateName: vmemcached.kb.io
generateName: mmemcached.kb.io
rules:
- apiGroups:
- cache.example.com
Expand All @@ -210,14 +210,14 @@ spec:
- memcacheds
sideEffects: None
targetPort: 9443
type: ValidatingAdmissionWebhook
webhookPath: /validate-cache-example-com-v1alpha1-memcached
type: MutatingAdmissionWebhook
webhookPath: /mutate-cache-example-com-v1alpha1-memcached
- admissionReviewVersions:
- v1beta1
containerPort: 443
deploymentName: memcached-operator-controller-manager
failurePolicy: Fail
generateName: mmemcached.kb.io
generateName: vmemcached.kb.io
rules:
- apiGroups:
- cache.example.com
Expand All @@ -230,5 +230,5 @@ spec:
- memcacheds
sideEffects: None
targetPort: 9443
type: MutatingAdmissionWebhook
webhookPath: /mutate-cache-example-com-v1alpha1-memcached
type: ValidatingAdmissionWebhook
webhookPath: /validate-cache-example-com-v1alpha1-memcached
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ spec:
containerPort: 443
deploymentName: memcached-operator-controller-manager
failurePolicy: Fail
generateName: vmemcached.kb.io
generateName: mmemcached.kb.io
rules:
- apiGroups:
- cache.example.com
Expand All @@ -235,15 +235,15 @@ spec:
- memcacheds
sideEffects: None
targetPort: 9443
type: ValidatingAdmissionWebhook
webhookPath: /validate-cache-example-com-v1alpha1-memcached
type: MutatingAdmissionWebhook
webhookPath: /mutate-cache-example-com-v1alpha1-memcached
- admissionReviewVersions:
- v1
- v1beta1
containerPort: 443
deploymentName: memcached-operator-controller-manager
failurePolicy: Fail
generateName: mmemcached.kb.io
generateName: vmemcached.kb.io
rules:
- apiGroups:
- cache.example.com
Expand All @@ -256,5 +256,5 @@ spec:
- memcacheds
sideEffects: None
targetPort: 9443
type: MutatingAdmissionWebhook
webhookPath: /mutate-cache-example-com-v1alpha1-memcached
type: ValidatingAdmissionWebhook
webhookPath: /validate-cache-example-com-v1alpha1-memcached