#--------------------------------------------------------
# Copyright IBM Corp. 2020. All rights reserved.
# US Government Users Restricted Rights - Use, duplication or disclosure
# restricted by GSA ADP Schedule Contract with IBM Corp.
#--------------------------------------------------------
#

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: ibm-lsf-operator
  labels:
    app.kubernetes.io/name: "ibm-spectrum-lsf"
    app.kubernetes.io/managed-by: "lsfclusters.lsf.spectrumcomputing.ibm.com"
    app.kubernetes.io/instance: "lsf"
    release: "lsf"
    lsfversion: "10.1.0.13"
spec:
  replicas: 1
  selector:
    matchLabels:
      name: ibm-lsf-operator
  template:
    metadata:
      labels:
        name: ibm-lsf-operator
        app.kubernetes.io/name: "ibm-spectrum-lsf"
        app.kubernetes.io/managed-by: "lsfclusters.lsf.spectrumcomputing.ibm.com"
        app.kubernetes.io/instance: "lsf"
        release: "lsf"
        lsfversion: "10.1.0.13"
      annotations:
        productID: IBM LSF Suite
        productName: IBM LSF Suite
        productVersion: 10.1.0.13

    spec:
      serviceAccountName: ibm-lsf-operator
      hostIPC: false
      hostNetwork: false
      hostPID: false
      securityContext:
        runAsUser: 1001
        runAsNonRoot: true
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: kubernetes.io/arch
                operator: In
                values:
                - amd64
                - ppc64le

      containers:
        - name: manager
          args:
            - --zap-log-level
            - error
          # Edit the image to match the registry where you pushed the lsf-operator
          image: "ibmcom/lsfce-operator:1.0.1"
          imagePullPolicy: "Always"
          env:
            - name: WATCH_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: OPERATOR_NAME
              value: "ibm-lsf-operator"
          resources:
            limits:
              cpu: 500m
              memory: 768Mi
            requests:
              cpu: 10m
              memory: 256Mi
          securityContext:
            allowPrivilegeEscalation: false
            capabilities:
              drop:
              - ALL
            privileged: false
            readOnlyRootFilesystem: false
          livenessProbe:
            httpGet:
              path: /healthz
              port: 6789
            initialDelaySeconds: 15
            periodSeconds: 20
          readinessProbe:
            httpGet:
              path: /readyz
              port: 6789
            initialDelaySeconds: 5
            periodSeconds: 10
      terminationGracePeriodSeconds: 10
