apiVersion: apps/v1
kind: Deployment
metadata:
  name: ibm-iam-operator
  labels:
     app.kubernetes.io/instance: ibm-iam-operator
     app.kubernetes.io/managed-by: ibm-iam-operator
     app.kubernetes.io/name: ibm-iam-operator
spec:
  replicas: 1
  selector:
    matchLabels:
      name: ibm-iam-operator
  template:
    metadata:
      labels:
        name: ibm-iam-operator
        app.kubernetes.io/instance: ibm-iam-operator
        app.kubernetes.io/managed-by: ibm-iam-operator
        app.kubernetes.io/name: ibm-iam-operator
      annotations:
        productName: IBM Cloud Platform Common Services
        productID: "068a62892a1e4db39641342e592daa25"
        productVersion: "3.4.0"
        productMetric: FREE
    spec:
      serviceAccountName: ibm-iam-operator
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: beta.kubernetes.io/arch
                operator: In
                values:
                - amd64
                - ppc64le
                - s390x
      containers:
        - name: ibm-iam-operator
          # Replace this with the built image name
          image: quay.io/opencloudio/ibm-iam-operator:latest
          command:
          - ibm-iam-operator
          imagePullPolicy: Always
          env:
            - name: AUTH_SERVICE_TAG_OR_SHA
              value: "sha256:1d6f44c1f6813b68c9f17ada40f3fde8a35644f22dd436cb34e9d6dd18ac42dd"
            - name: IDENTITY_PROVIDER_TAG_OR_SHA
              value: "sha256:8587ffb240c5ba12411be9860a2ba6c4d1a8274e159e875567a79c081e543ffb"
            - name: IDENTITY_MANAGER_TAG_OR_SHA
              value: "sha256:0ec0dd6a69d2811d55267397d5d5bdb64b23aaa824ee0ffde596334e97982537"
            - name: POLICY_ADMINISTRATION_TAG_OR_SHA
              value: "sha256:470fd0df32a5c9a2d79a19186d63234c92de0962e4f73afa3c84135cd0de8a84"
            - name: POLICY_DECISION_TAG_OR_SHA
              value: "sha256:2deab004a3f92253c20e67cbb79f46d76321d7c5e9b30ceab58b840139205afe"
            - name: SECRET_WATCHER_TAG_OR_SHA
              value: "sha256:bfe42fc0463da7d30e5b83f8a5767314d991eb66c3e7a03532e20502d3c13190"
            - name: CLIENT_WATCHER_TAG_OR_SHA
              value: "sha256:0c49e27b3d4f32001e568a62abdfaecdb41f10194cf5a9ccf87ebfbdd2808fd4"
            - name: POLICY_CONTROLLER_TAG_OR_SHA
              value: "sha256:2d3029b7efc0f6dd841d61e0d454d0cdfca539aff01b57d462f11891dac32b2f"
            - name: IAM_ONBOARDING_TAG_OR_SHA
              value: "sha256:f8efc1d236be029376eb73ff57270695b94b33cceed8aee57f7fb5edc8c488e6"
            - name: AUDIT_TAG_OR_SHA
              value: "sha256:24a220374c39652f8b031637d852995bfaec5be2601f9e4c41eb1925531f466d"
            - name: WATCH_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: OPERATOR_NAME
              value: "ibm-iam-operator"
            - name: ICP_CONSOLE_URL
              valueFrom:
                configMapKeyRef:
                  name: management-ingress-info
                  key: MANAGEMENT_INGRESS_ROUTE_HOST
            - name: ICP_PROXY_URL
              valueFrom:
                configMapKeyRef:
                  name: ibmcloud-cluster-info
                  key: proxy_address
          resources:
            limits:
              cpu: 25m
              memory: 320Mi
            requests:
              cpu: 10m
              memory: 80Mi
          securityContext:
            allowPrivilegeEscalation: false
            capabilities:
              drop:
              - ALL
            privileged: false
            readOnlyRootFilesystem: true 
          volumeMounts:
            - mountPath: "/certs"
              name: cluster-ca-cert
      volumes:
        - name: cluster-ca-cert
          secret:
            defaultMode: 420
            items:
            - key: tls.key
              path: ca.key
            - key: tls.crt
              path: ca.crt
            secretName: cs-ca-certificate-secret
