diff --git a/config/webhook/manifests.yaml b/config/webhook/manifests.yaml index 2bb647a6db..4e654f11fa 100644 --- a/config/webhook/manifests.yaml +++ b/config/webhook/manifests.yaml @@ -204,7 +204,8 @@ webhooks: - kibanas sideEffects: None - admissionReviewVersions: - - v1alpha1 + - v1 + - v1beta1 clientConfig: service: name: webhook-service diff --git a/deploy/eck-operator/templates/webhook.yaml b/deploy/eck-operator/templates/webhook.yaml index ce108e0289..f862dcdeb3 100644 --- a/deploy/eck-operator/templates/webhook.yaml +++ b/deploy/eck-operator/templates/webhook.yaml @@ -28,7 +28,7 @@ webhooks: {{- end }} name: elastic-agent-validation-v1alpha1.k8s.elastic.co matchPolicy: Exact - admissionReviewVersions: [v1beta1] + admissionReviewVersions: [v1,v1beta1] sideEffects: None rules: - apiGroups: @@ -57,7 +57,7 @@ webhooks: {{- end }} name: elastic-apm-validation-v1.k8s.elastic.co matchPolicy: Exact - admissionReviewVersions: [v1beta1] + admissionReviewVersions: [v1,v1beta1] sideEffects: None rules: - apiGroups: @@ -86,7 +86,7 @@ webhooks: {{- end }} name: elastic-apm-validation-v1beta1.k8s.elastic.co matchPolicy: Exact - admissionReviewVersions: [v1beta1] + admissionReviewVersions: [v1,v1beta1] sideEffects: None rules: - apiGroups: @@ -115,7 +115,7 @@ webhooks: {{- end }} name: elastic-beat-validation-v1beta1.k8s.elastic.co matchPolicy: Exact - admissionReviewVersions: [v1beta1] + admissionReviewVersions: [v1,v1beta1] sideEffects: None rules: - apiGroups: @@ -144,7 +144,7 @@ webhooks: {{- end }} name: elastic-ent-validation-v1.k8s.elastic.co matchPolicy: Exact - admissionReviewVersions: [v1beta1] + admissionReviewVersions: [v1,v1beta1] sideEffects: None rules: - apiGroups: @@ -173,7 +173,7 @@ webhooks: {{- end }} name: elastic-ent-validation-v1beta1.k8s.elastic.co matchPolicy: Exact - admissionReviewVersions: [v1beta1] + admissionReviewVersions: [v1,v1beta1] sideEffects: None rules: - apiGroups: @@ -202,7 +202,7 @@ webhooks: {{- end }} name: elastic-es-validation-v1.k8s.elastic.co matchPolicy: Exact - admissionReviewVersions: [v1beta1] + admissionReviewVersions: [v1,v1beta1] sideEffects: None rules: - apiGroups: @@ -231,7 +231,7 @@ webhooks: {{- end }} name: elastic-es-validation-v1beta1.k8s.elastic.co matchPolicy: Exact - admissionReviewVersions: [v1beta1] + admissionReviewVersions: [v1,v1beta1] sideEffects: None rules: - apiGroups: @@ -243,6 +243,35 @@ webhooks: - UPDATE resources: - elasticsearches +- clientConfig: + caBundle: {{ .Values.webhook.caBundle }} + service: + name: {{ include "eck-operator.webhookServiceName" . }} + namespace: {{ .Release.Namespace }} + path: /validate-ems-k8s-elastic-co-v1alpha1-mapsservers + failurePolicy: {{ .Values.webhook.failurePolicy }} +{{- with .Values.webhook.namespaceSelector }} + namespaceSelector: + {{- toYaml . | nindent 4 }} +{{- end }} +{{- with .Values.webhook.objectSelector }} + objectSelector: + {{- toYaml . | nindent 4 }} +{{- end }} + name: elastic-ems-validation-v1alpha1.k8s.elastic.co + matchPolicy: Exact + admissionReviewVersions: [v1,v1beta1] + sideEffects: None + rules: + - apiGroups: + - maps.k8s.elastic.co + apiVersions: + - v1alpha1 + operations: + - CREATE + - UPDATE + resources: + - mapsservers - clientConfig: caBundle: {{ .Values.webhook.caBundle }} service: @@ -260,7 +289,7 @@ webhooks: {{- end }} name: elastic-kb-validation-v1.k8s.elastic.co matchPolicy: Exact - admissionReviewVersions: [v1beta1] + admissionReviewVersions: [v1,v1beta1] sideEffects: None rules: - apiGroups: @@ -289,7 +318,7 @@ webhooks: {{- end }} name: elastic-kb-validation-v1beta1.k8s.elastic.co matchPolicy: Exact - admissionReviewVersions: [v1beta1] + admissionReviewVersions: [v1,v1beta1] sideEffects: None rules: - apiGroups: @@ -318,7 +347,7 @@ webhooks: {{- end }} name: elastic-esa-validation-v1alpha1.k8s.elastic.co matchPolicy: Exact - admissionReviewVersions: [v1beta1] + admissionReviewVersions: [v1,v1beta1] sideEffects: None rules: - apiGroups: diff --git a/pkg/apis/maps/v1alpha1/webhook.go b/pkg/apis/maps/v1alpha1/webhook.go index ab3c49df59..e7be1e31ad 100644 --- a/pkg/apis/maps/v1alpha1/webhook.go +++ b/pkg/apis/maps/v1alpha1/webhook.go @@ -33,7 +33,7 @@ var ( } ) -// +kubebuilder:webhook:path=/validate-ems-k8s-elastic-co-v1alpha1-mapsservers,mutating=false,failurePolicy=ignore,groups=maps.k8s.elastic.co,resources=mapsservers,verbs=create;update,versions=v1alpha1,name=elastic-ems-validation-v1alpha1.k8s.elastic.co,sideEffects=None,admissionReviewVersions=v1alpha1,matchPolicy=Exact +// +kubebuilder:webhook:path=/validate-ems-k8s-elastic-co-v1alpha1-mapsservers,mutating=false,failurePolicy=ignore,groups=maps.k8s.elastic.co,resources=mapsservers,verbs=create;update,versions=v1alpha1,name=elastic-ems-validation-v1alpha1.k8s.elastic.co,sideEffects=None,admissionReviewVersions=v1;v1beta1,matchPolicy=Exact var _ webhook.Validator = &ElasticMapsServer{}