apiVersion: apps/v1
kind: Deployment
metadata:
  name: forge-controller
  labels:
    app.kubernetes.io/name: forge
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: forge
  template:
    metadata:
      labels:
        app.kubernetes.io/name: forge
    spec:
      serviceAccountName: forge
      initContainers:
        - name: apply-crd
          image: quay.io/domino/forge:latest
          imagePullPolicy: IfNotPresent
          args:
            - crd-apply
      containers:
        - name: controller
          image: quay.io/domino/forge:latest
          imagePullPolicy: IfNotPresent
          args:
            - --namespace
            - $(WATCH_NAMESPACE)
            - --build-job-custom-ca
            - domino-generated-ca
            - --build-job-image=$(BUILD_JOB_IMAGE)
          env:
            - name: WATCH_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: BUILD_JOB_IMAGE
              value: quay.io/domino/forge:latest
            - name: AWS_REGION
              value: us-west-2
          envFrom:
            - secretRef:
                name: forge
          resources:
            requests:
              cpu: 1
              memory: 20Mi
      terminationGracePeriodSeconds: 10
