apiVersion: apps/v1
kind: Deployment
metadata:
  name: ibm-helm-api-operator
  labels:
      name: ibm-helm-api-operator
      app.kubernetes.io/instance: helm-api
      app.kubernetes.io/managed-by: helmapis.operator.ibm.com
      app.kubernetes.io/name: helmapis.operator.ibm.com
spec:
  replicas: 1
  selector:
    matchLabels:
      name: ibm-helm-api-operator
  template:
    metadata:
      labels:
        name: ibm-helm-api-operator
        app.kubernetes.io/instance: helm-api
        app.kubernetes.io/managed-by: helmapis.operator.ibm.com
        app.kubernetes.io/name: helmapis.operator.ibm.com
      annotations:
        productName: IBM Cloud Platform Common Services
        productID: "068a62892a1e4db39641342e592daa25"
        productMetric: FREE
    spec:
      serviceAccountName: ibm-helm-api-operator
      hostNetwork: false
      hostPID: false
      hostIPC: false
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: kubernetes.io/arch
                operator: In
                values:
                  - amd64
                  - ppc64le
                  - s390x
      initContainers:
      - name: pre-install
        command:
        - /bin/sh
        - -c
        - |
          kubectl delete secret helmapi-secret --ignore-not-found=true
          kubectl delete secret rudder-secret --ignore-not-found=true
          kubectl delete secret tiller-secret --ignore-not-found=true
        image: quay.io/opencloudio/kubectl@sha256:c5ee37c2dd2f34c155faabc88f7b4e4d79646f8947ef6517fcb8c78ddf143356
        imagePullPolicy: IfNotPresent
        resources:
          limits:
            cpu: 50m
            memory: 128Mi
          requests:
            cpu: 20m
            memory: 128Mi
        securityContext:
          allowPrivilegeEscalation: false
          privileged: false
          runAsNonRoot: true
          runAsUser: 1002
          readOnlyRootFilesystem: true
          capabilities:
            drop:
            - ALL
      containers:
        - name: ibm-helm-api-operator
          image: quay.io/opencloudio/ibm-helm-api-operator:latest
          imagePullPolicy: Always
          env:
            - name: WATCH_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: OPERATOR_NAME
              value: "ibm-helm-api-operator"
            - name: OPERAND_AUDIT_SERVICE_ENABLED
              value: "false"              
            - name: OPERAND_AUDIT_SERVICE_IMAGE
              value: "quay.io/opencloudio/icp-audit-service@sha256:3cfb9f3cc99379758f73f1cd2e6ad4dd4bc61e13cc55d7c34b0d0e280cb47421"
            - name: OPERAND_HELM_API_IMAGE
              value: "quay.io/opencloudio/icp-helm-api@sha256:799ca09fe8c3e099c8b7a5e3c37de5248e5477856c34fb2ffeb15e6e94800aa1"  
            - name: OPERAND_RUDDER_IMAGE
              value: "quay.io/opencloudio/icp-helm-rudder@sha256:f8eb8e68d78baae61deff5361b39e073daead75f5efff829671d36c3b75892b7"
            - name: OPERAND_TILLER_IMAGE
              value: "quay.io/opencloudio/tiller@sha256:1119c22e41d062bab9e7431c50345118b90449d972fd9e5b6e5dc22602ad14cf"
          resources:
            limits:
              cpu: 50m
              memory: 256Mi
            requests:
              cpu: 20m
              memory: 256Mi
          securityContext:
            allowPrivilegeEscalation: false
            capabilities:
              drop:
              - ALL
            privileged: false
            readOnlyRootFilesystem: true
            runAsNonRoot: true