Skip to content

Commit

Permalink
Allow deletion of CRs when the operator isn't available (#313)
Browse files Browse the repository at this point in the history
  • Loading branch information
VineethReddy02 authored Jun 24, 2021
1 parent 2042114 commit 6d76f00
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
3 changes: 2 additions & 1 deletion api/v1alpha1/opentelemetrycollector_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ func (r *OpenTelemetryCollector) Default() {
opentelemetrycollectorlog.Info("default", "name", r.Name)
}

// +kubebuilder:webhook:verbs=create;update;delete,path=/validate-opentelemetry-io-v1alpha1-opentelemetrycollector,mutating=false,failurePolicy=fail,groups=opentelemetry.io,resources=opentelemetrycollectors,versions=v1alpha1,name=vopentelemetrycollector.kb.io,sideEffects=none,admissionReviewVersions=v1;v1beta1
// +kubebuilder:webhook:verbs=create;update,path=/validate-opentelemetry-io-v1alpha1-opentelemetrycollector,mutating=false,failurePolicy=fail,groups=opentelemetry.io,resources=opentelemetrycollectors,versions=v1alpha1,name=vopentelemetrycollectorcreateupdate.kb.io,sideEffects=none,admissionReviewVersions=v1;v1beta1
// +kubebuilder:webhook:verbs=delete,path=/validate-opentelemetry-io-v1alpha1-opentelemetrycollector,mutating=false,failurePolicy=ignore,groups=opentelemetry.io,resources=opentelemetrycollectors,versions=v1alpha1,name=vopentelemetrycollectordelete.kb.io,sideEffects=none,admissionReviewVersions=v1;v1beta1

var _ webhook.Validator = &OpenTelemetryCollector{}

Expand Down
21 changes: 20 additions & 1 deletion config/webhook/manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ webhooks:
namespace: system
path: /validate-opentelemetry-io-v1alpha1-opentelemetrycollector
failurePolicy: Fail
name: vopentelemetrycollector.kb.io
name: vopentelemetrycollectorcreateupdate.kb.io
rules:
- apiGroups:
- opentelemetry.io
Expand All @@ -74,6 +74,25 @@ webhooks:
operations:
- CREATE
- UPDATE
resources:
- opentelemetrycollectors
sideEffects: None
- admissionReviewVersions:
- v1
- v1beta1
clientConfig:
service:
name: webhook-service
namespace: system
path: /validate-opentelemetry-io-v1alpha1-opentelemetrycollector
failurePolicy: Ignore
name: vopentelemetrycollectordelete.kb.io
rules:
- apiGroups:
- opentelemetry.io
apiVersions:
- v1alpha1
operations:
- DELETE
resources:
- opentelemetrycollectors
Expand Down

0 comments on commit 6d76f00

Please sign in to comment.