apiVersion: apps/v1
kind: Deployment
metadata:
  name: helm-controller
  labels:
    control-plane: controller
spec:
  selector:
    matchLabels:
      app: helm-controller
  replicas: 1
  template:
    metadata:
      labels:
        app: helm-controller
      annotations:
        prometheus.io/scrape: "true"
        prometheus.io/port: "8080"
    spec:
      terminationGracePeriodSeconds: 600
      securityContext:
        # Required for AWS IAM Role bindings
        # https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts-technical-overview.html
        fsGroup: 1337
      containers:
      - name: manager
        image: fluxcd/helm-controller
        imagePullPolicy: IfNotPresent
        securityContext:
          allowPrivilegeEscalation: false
          readOnlyRootFilesystem: true
          runAsNonRoot: true
          capabilities:
            drop: ["ALL"]
          seccompProfile:
            type: RuntimeDefault
        ports:
          - containerPort: 8080
            name: http-prom
            protocol: TCP
          - containerPort: 9440
            name: healthz
            protocol: TCP
        env:
          - name: RUNTIME_NAMESPACE
            valueFrom:
              fieldRef:
                fieldPath: metadata.namespace
        args:
          - --watch-all-namespaces
          - --log-level=info
          - --log-encoding=json
          - --enable-leader-election
        readinessProbe:
          httpGet:
            path: /readyz
            port: healthz
        livenessProbe:
          httpGet:
            path: /healthz
            port: healthz
        resources:
          limits:
            cpu: 1000m
            memory: 1Gi
          requests:
            cpu: 100m
            memory: 64Mi
        volumeMounts:
          - name: temp
            mountPath: /tmp
      volumes:
        - name: temp
          emptyDir: {}
