apiVersion: apps/v1
kind: Deployment
metadata:
  name: dynatrace-webhook
  namespace: dynatrace
  labels:
    dynatrace.com/operator: dynakube
spec:
  replicas: 1
  revisionHistoryLimit: 1
  selector:
    matchLabels:
      internal.dynatrace.com/component: webhook
      internal.dynatrace.com/app: webhook
  strategy:
    type: Recreate
  template:
    metadata:
      annotations:
        kubectl.kubernetes.io/default-logs-container: webhook
      labels:
        dynatrace.com/operator: oneagent
        internal.dynatrace.com/component: webhook
        internal.dynatrace.com/app: webhook
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
              - matchExpressions:
                  - key: kubernetes.io/arch
                    operator: In
                    values:
                      - amd64
                      - arm64
                  - key: kubernetes.io/os
                    operator: In
                    values:
                      - linux
      containers:
        - name: webhook
          args:
            - webhook-server
          image: quay.io/dynatrace/dynatrace-operator:snapshot
          imagePullPolicy: Always
          env:
            - name: POD_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
          readinessProbe:
            httpGet:
              path: /healthz
              port: server-port
              scheme: HTTPS
          ports:
            - name: metrics
              containerPort: 8383
            - name: validation
              containerPort: 8384
            - name: server-port
              containerPort: 8443
          resources:
            requests:
              cpu: 300m
              memory: 128Mi
            limits:
              cpu: 600m
              memory: 256Mi
      serviceAccountName: dynatrace-webhook
