apiVersion: apps/v1
kind: Deployment
metadata:
  name: external-dns-unifi
  namespace: external-dns
  labels:
    helm.sh/chart: external-dns-unifi-1.21.1
    app.kubernetes.io/name: external-dns-unifi
    app.kubernetes.io/instance: external-dns
    app.kubernetes.io/version: "0.21.0"
    app.kubernetes.io/managed-by: Helm
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: external-dns-unifi
      app.kubernetes.io/instance: external-dns
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app.kubernetes.io/name: external-dns-unifi
        app.kubernetes.io/instance: external-dns
    spec:
      automountServiceAccountToken: true
      serviceAccountName: external-dns-unifi
      securityContext:
        fsGroup: 65534
        runAsNonRoot: true
        seccompProfile:
          type: RuntimeDefault
      containers:
        - name: external-dns
          securityContext:
            allowPrivilegeEscalation: false
            capabilities:
              drop:
                - ALL
            privileged: false
            readOnlyRootFilesystem: true
            runAsGroup: 65532
            runAsNonRoot: true
            runAsUser: 65532
          image: registry.k8s.io/external-dns/external-dns:v0.21.0@sha256:f53faaf71cb270d1ca9dce6ea0c94bfebf1a18696263487f0fbc74b9bf2bd7ff
          imagePullPolicy: IfNotPresent
          args:
            - --log-level=info
            - --log-format=text
            - --interval=360m
            - --source=crd
            - --source=gateway-httproute
            - --source=gateway-tlsroute
            - --policy=sync
            - --registry=txt
            - --txt-owner-id=default
            - --txt-prefix=k8s.
            - --domain-filter=alexlebens.net
            - --exclude-domains=alexlebens.dev
            - --provider=webhook
            - "--ignore-ingress-tls-spec"
          ports:
            - name: http
              protocol: TCP
              containerPort: 7979
          livenessProbe:
            failureThreshold: 2
            httpGet:
              path: /healthz
              port: http
            initialDelaySeconds: 10
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 5
          readinessProbe:
            failureThreshold: 6
            httpGet:
              path: /healthz
              port: http
            initialDelaySeconds: 5
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 5
          resources:
            requests:
              cpu: 1m
              memory: 80Mi
        - name: webhook
          image: ghcr.io/kashalls/external-dns-unifi-webhook:v0.8.2@sha256:7f0ddbbc83a36a2a9d762e25eef9cafcb3adf0493068a27d72ae71087eafe6f0
          imagePullPolicy: IfNotPresent
          env:
            - name: UNIFI_HOST
              value: https://192.168.1.1
            - name: UNIFI_API_KEY
              valueFrom:
                secretKeyRef:
                  key: api-key
                  name: external-dns-unifi-secret
            - name: LOG_LEVEL
              value: info
          ports:
            - name: http-webhook
              protocol: TCP
              containerPort: 8080
          livenessProbe:
            failureThreshold: 2
            httpGet:
              path: /healthz
              port: http-webhook
            initialDelaySeconds: 10
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 5
          readinessProbe:
            failureThreshold: 6
            httpGet:
              path: /readyz
              port: http-webhook
            initialDelaySeconds: 5
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 5
