Skip to content

Commit

Permalink
Merge pull request #34 from awgreene/update-webhook-description
Browse files Browse the repository at this point in the history
Update webhook description
  • Loading branch information
awgreene authored May 6, 2020
2 parents 363b6d8 + 19a9724 commit 7856a40
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
9 changes: 6 additions & 3 deletions crds/operators.coreos.com_clusterserviceversions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8687,7 +8687,7 @@ spec:
type: object
required:
- admissionReviewVersions
- name
- generateName
- sideEffects
- type
properties:
Expand All @@ -8702,11 +8702,11 @@ spec:
type: string
failurePolicy:
type: string
generateName:
type: string
matchPolicy:
description: MatchPolicyType specifies the type of match policy
type: string
name:
type: string
objectSelector:
description: A label selector is a label query over a set of
resources. The result of matchLabels and matchExpressions
Expand Down Expand Up @@ -8821,6 +8821,9 @@ spec:
description: WebhookAdmissionType is the type of admission webhooks
supported by OLM
type: string
enum:
- ValidatingAdmissionWebhook
- MutatingAdmissionWebhook
webhookPath:
type: string
status:
Expand Down
14 changes: 7 additions & 7 deletions crds/zz_defs.go

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions pkg/operators/v1alpha1/clusterserviceversion_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ const (
// WebhookDescription provides details to OLM about required webhooks
// +k8s:openapi-gen=true
type WebhookDescription struct {
Name string `json:"name"`
GenerateName string `json:"generateName"`
// +kubebuilder:validation:Enum=ValidatingAdmissionWebhook;MutatingAdmissionWebhook
Type WebhookAdmissionType `json:"type"`
DeploymentName string `json:"deploymentName,omitempty"`
ContainerPort int32 `json:"containerPort,omitempty"`
Expand All @@ -182,7 +183,7 @@ type WebhookDescription struct {
// GetValidatingWebhook returns a ValidatingWebhook generated from the WebhookDescription
func (w *WebhookDescription) GetValidatingWebhook(namespace string, namespaceSelector *metav1.LabelSelector, caBundle []byte) admissionregistrationv1.ValidatingWebhook {
return admissionregistrationv1.ValidatingWebhook{
Name: w.Name,
Name: w.GenerateName,
Rules: w.Rules,
FailurePolicy: w.FailurePolicy,
MatchPolicy: w.MatchPolicy,
Expand All @@ -205,7 +206,7 @@ func (w *WebhookDescription) GetValidatingWebhook(namespace string, namespaceSel
// GetMutatingWebhook returns a MutatingWebhook generated from the WebhookDescription
func (w *WebhookDescription) GetMutatingWebhook(namespace string, namespaceSelector *metav1.LabelSelector, caBundle []byte) admissionregistrationv1.MutatingWebhook {
return admissionregistrationv1.MutatingWebhook{
Name: w.Name,
Name: w.GenerateName,
Rules: w.Rules,
FailurePolicy: w.FailurePolicy,
MatchPolicy: w.MatchPolicy,
Expand Down Expand Up @@ -365,7 +366,7 @@ const (
CSVReasonInterOperatorGroupOwnerConflict ConditionReason = "InterOperatorGroupOwnerConflict"
CSVReasonCannotModifyStaticOperatorGroupProvidedAPIs ConditionReason = "CannotModifyStaticOperatorGroupProvidedAPIs"
CSVReasonDetectedClusterChange ConditionReason = "DetectedClusterChange"
CSVReasonUnsupportedWebhookRules ConditionReason = "UnsupportedWebhookRules"
CSVReasonInvalidWebhookDescription ConditionReason = "InvalidWebhookDescription"
)

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

0 comments on commit 7856a40

Please sign in to comment.