apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
  name: lifecycle-validating-webhook-configuration
{{- $caAnnotations := .Values.global.caInjectionAnnotations}}
{{- $annotations := include "common.annotations" (dict "context" .) }}
{{- if or $caAnnotations $annotations }}
  annotations:
    {{- with $annotations  }}
    {{- . -}}
    {{- end }}
    {{- with $caAnnotations  }}
    {{- toYaml . | nindent 4 }}
    {{- end }}
{{- end }}
  labels:
    keptn.sh/inject-cert: "true"
{{- include "common.labels.standard" ( dict "context" . ) | nindent 4 }}
webhooks:
- admissionReviewVersions:
  - v1
  clientConfig:
    service:
      name: 'lifecycle-webhook-service'
      namespace: '{{ .Release.Namespace }}'
      path: /validate-lifecycle-keptn-sh-v1-keptntaskdefinition
  failurePolicy: Fail
  name: vkeptntaskdefinition.kb.io
  rules:
  - apiGroups:
    - lifecycle.keptn.sh
    apiVersions:
    - v1
    operations:
    - CREATE
    - UPDATE
    resources:
    - keptntaskdefinitions
  sideEffects: None