apiVersion: apps/v1
kind: Deployment
metadata:
  name: cluster-samples-operator
  namespace: openshift-cluster-samples-operator
spec:
  replicas: 1
  selector:
    matchLabels:
      name: cluster-samples-operator
  template:
    metadata:
      labels:
        name: cluster-samples-operator
    spec:
      serviceAccountName: cluster-samples-operator
      shareProcessNamespace: true
      nodeSelector:
        node-role.kubernetes.io/master: ""
      priorityClassName: "system-cluster-critical"
      tolerations:
      - key: node-role.kubernetes.io/master  # Just tolerate NoSchedule taint on master node. If there are other conditions like disk-pressure etc, let's not schedule the control-plane pods onto that node.
        operator: Exists
        effect: "NoSchedule"
      - key: "node.kubernetes.io/unreachable"
        operator: "Exists"
        effect: "NoExecute"
        tolerationSeconds: 120 # Evict pods within 2 mins.
      - key: "node.kubernetes.io/not-ready"
        operator: "Exists"
        effect: "NoExecute"
        tolerationSeconds: 120 # Evict pods within 2 mins.
      volumes:
      - name: samples-operator-tls
        secret:
          secretName: samples-operator-tls
      containers:
      - name: cluster-samples-operator
        image: quay.io/openshift/origin-cluster-samples-operator:latest
        ports:
        - containerPort: 60000
          name: metrics
        command:
        - cluster-samples-operator
        resources:
          requests:
            cpu: 10m
        imagePullPolicy: IfNotPresent
        volumeMounts:
        - name: samples-operator-tls
          mountPath: /etc/secrets
        env:
          - name: WATCH_NAMESPACE
            valueFrom:
              fieldRef:
                fieldPath: metadata.namespace
          - name: OPERATOR_NAME
            value: cluster-samples-operator
          - name: RELEASE_VERSION
            value: "0.0.1-snapshot"
          - name: IMAGE_JENKINS
            value: quay.io/openshift/origin-jenkins:latest
          - name: IMAGE_AGENT_NODEJS
            value: quay.io/openshift/origin-jenkins-agent-nodejs:latest
          - name: IMAGE_AGENT_MAVEN
            value: quay.io/openshift/origin-jenkins-agent-maven:latest
      - name: cluster-samples-operator-watch
        image: quay.io/openshift/origin-cluster-samples-operator:latest
        command:
        - cluster-samples-operator-watch
        - file-watcher-watchdog
        args:
        - --namespace=openshift-cluster-samples-operator
        - --process-name=cluster-samples-operator
        - --termination-grace-period=30s
        - --files=/etc/secrets/tls.crt,/etc/secrets/tls.key
        imagePullPolicy: IfNotPresent
        resources:
          requests:
            cpu: 10m

