Skip to content

Commit

Permalink
Revert "fix: remove unused defaulting webhook from promise" (#180)
Browse files Browse the repository at this point in the history
This reverts commit c441235.
  • Loading branch information
aclevername authored Jun 26, 2024
1 parent 75e02a3 commit 4a81794
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 13 deletions.
7 changes: 7 additions & 0 deletions api/v1alpha1/promise_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ func (p *Promise) SetupWebhookWithManager(mgr ctrl.Manager, cs *clientset.Client
Complete()
}

var _ webhook.Defaulter = &Promise{}

// Default implements webhook.Defaulter so a webhook will be registered for the type
func (p *Promise) Default() {
promiselog.Info("default", "name", p.Name)
}

// +kubebuilder:webhook:path=/validate-platform-kratix-io-v1alpha1-promise,mutating=false,failurePolicy=fail,sideEffects=None,groups=platform.kratix.io,resources=promises,verbs=create;update,versions=v1alpha1,name=vpromise.kb.io,admissionReviewVersions=v1
var _ webhook.Validator = &Promise{}

Expand Down
26 changes: 13 additions & 13 deletions config/default/webhookcainjection_patch.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# This patch add annotation to admission webhook config and
# the variables $(CERTIFICATE_NAMESPACE) and $(CERTIFICATE_NAME) will be substituted by kustomize.
#apiVersion: admissionregistration.k8s.io/v1
#kind: MutatingWebhookConfiguration
#metadata:
# labels:
# app.kubernetes.io/name: mutatingwebhookconfiguration
# app.kubernetes.io/instance: mutating-webhook-configuration
# app.kubernetes.io/component: webhook
# app.kubernetes.io/created-by: kratix
# app.kubernetes.io/part-of: kratix
# app.kubernetes.io/managed-by: kustomize
# name: mutating-webhook-configuration
# annotations:
# cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
metadata:
labels:
app.kubernetes.io/name: mutatingwebhookconfiguration
app.kubernetes.io/instance: mutating-webhook-configuration
app.kubernetes.io/component: webhook
app.kubernetes.io/created-by: kratix
app.kubernetes.io/part-of: kratix
app.kubernetes.io/managed-by: kustomize
name: mutating-webhook-configuration
annotations:
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
---
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
Expand Down
26 changes: 26 additions & 0 deletions config/webhook/manifests.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
---
apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
metadata:
name: mutating-webhook-configuration
webhooks:
- admissionReviewVersions:
- v1
clientConfig:
service:
name: webhook-service
namespace: system
path: /mutate-platform-kratix-io-v1alpha1-promise
failurePolicy: Fail
name: mpromise.kb.io
rules:
- apiGroups:
- platform.kratix.io
apiVersions:
- v1alpha1
operations:
- CREATE
- UPDATE
resources:
- promises
sideEffects: None
---
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
name: validating-webhook-configuration
Expand Down

0 comments on commit 4a81794

Please sign in to comment.