Skip to content

Commit 7856a40

Browse files
authoredMay 6, 2020
Merge pull request openshift#34 from awgreene/update-webhook-description
Update webhook description
2 parents 363b6d8 + 19a9724 commit 7856a40

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed
 

‎crds/operators.coreos.com_clusterserviceversions.yaml

+6-3
Original file line numberDiff line numberDiff line change
@@ -8687,7 +8687,7 @@ spec:
86878687
type: object
86888688
required:
86898689
- admissionReviewVersions
8690-
- name
8690+
- generateName
86918691
- sideEffects
86928692
- type
86938693
properties:
@@ -8702,11 +8702,11 @@ spec:
87028702
type: string
87038703
failurePolicy:
87048704
type: string
8705+
generateName:
8706+
type: string
87058707
matchPolicy:
87068708
description: MatchPolicyType specifies the type of match policy
87078709
type: string
8708-
name:
8709-
type: string
87108710
objectSelector:
87118711
description: A label selector is a label query over a set of
87128712
resources. The result of matchLabels and matchExpressions
@@ -8821,6 +8821,9 @@ spec:
88218821
description: WebhookAdmissionType is the type of admission webhooks
88228822
supported by OLM
88238823
type: string
8824+
enum:
8825+
- ValidatingAdmissionWebhook
8826+
- MutatingAdmissionWebhook
88248827
webhookPath:
88258828
type: string
88268829
status:

‎crds/zz_defs.go

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎pkg/operators/v1alpha1/clusterserviceversion_types.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ const (
164164
// WebhookDescription provides details to OLM about required webhooks
165165
// +k8s:openapi-gen=true
166166
type WebhookDescription struct {
167-
Name string `json:"name"`
167+
GenerateName string `json:"generateName"`
168+
// +kubebuilder:validation:Enum=ValidatingAdmissionWebhook;MutatingAdmissionWebhook
168169
Type WebhookAdmissionType `json:"type"`
169170
DeploymentName string `json:"deploymentName,omitempty"`
170171
ContainerPort int32 `json:"containerPort,omitempty"`
@@ -182,7 +183,7 @@ type WebhookDescription struct {
182183
// GetValidatingWebhook returns a ValidatingWebhook generated from the WebhookDescription
183184
func (w *WebhookDescription) GetValidatingWebhook(namespace string, namespaceSelector *metav1.LabelSelector, caBundle []byte) admissionregistrationv1.ValidatingWebhook {
184185
return admissionregistrationv1.ValidatingWebhook{
185-
Name: w.Name,
186+
Name: w.GenerateName,
186187
Rules: w.Rules,
187188
FailurePolicy: w.FailurePolicy,
188189
MatchPolicy: w.MatchPolicy,
@@ -205,7 +206,7 @@ func (w *WebhookDescription) GetValidatingWebhook(namespace string, namespaceSel
205206
// GetMutatingWebhook returns a MutatingWebhook generated from the WebhookDescription
206207
func (w *WebhookDescription) GetMutatingWebhook(namespace string, namespaceSelector *metav1.LabelSelector, caBundle []byte) admissionregistrationv1.MutatingWebhook {
207208
return admissionregistrationv1.MutatingWebhook{
208-
Name: w.Name,
209+
Name: w.GenerateName,
209210
Rules: w.Rules,
210211
FailurePolicy: w.FailurePolicy,
211212
MatchPolicy: w.MatchPolicy,
@@ -365,7 +366,7 @@ const (
365366
CSVReasonInterOperatorGroupOwnerConflict ConditionReason = "InterOperatorGroupOwnerConflict"
366367
CSVReasonCannotModifyStaticOperatorGroupProvidedAPIs ConditionReason = "CannotModifyStaticOperatorGroupProvidedAPIs"
367368
CSVReasonDetectedClusterChange ConditionReason = "DetectedClusterChange"
368-
CSVReasonUnsupportedWebhookRules ConditionReason = "UnsupportedWebhookRules"
369+
CSVReasonInvalidWebhookDescription ConditionReason = "InvalidWebhookDescription"
369370
)
370371

371372
// HasCaResources returns true if the CSV has owned APIServices or Webhooks.

0 commit comments

Comments
 (0)
Please sign in to comment.