{{- if .Values.admissionWebhook.create }}
apiVersion: v1
kind: Service
metadata:
  name: tidb-admission-webhook
  namespace: {{ .Release.Namespace }}
  labels:
    app.kubernetes.io/name: {{ template "chart.name" . }}
    app.kubernetes.io/managed-by: {{ .Release.Service }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/component: admission-webhook
    helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+"  "_" }}
spec:
  ports:
    - name: https-webhook # optional
      port: 443
      targetPort: 6443
  selector:
    app.kubernetes.io/name: {{ template "chart.name" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/component: admission-webhook
{{- end }}
