Skip to content

Commit

Permalink
Add missing maps webhook, fix inconsistencies (#6489)
Browse files Browse the repository at this point in the history
Add missing webhook for EMS, fix incorrect `admissionReviewVersions` in Helm template and in kubebuilder annotation
  • Loading branch information
pebrc authored Mar 6, 2023
1 parent 2eb4333 commit 1f7b6ef
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 13 deletions.
3 changes: 2 additions & 1 deletion config/webhook/manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ webhooks:
- kibanas
sideEffects: None
- admissionReviewVersions:
- v1alpha1
- v1
- v1beta1
clientConfig:
service:
name: webhook-service
Expand Down
51 changes: 40 additions & 11 deletions deploy/eck-operator/templates/webhook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/maps/v1alpha1/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}

Expand Down

0 comments on commit 1f7b6ef

Please sign in to comment.