{{- if index .Values.ocWorkflow.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: oc-workflow
  name: {{ .Release.Name }}-oc-workflow
spec:
  replicas: 1
  selector:
    matchLabels:
      app: oc-workflow
  template:
    metadata:
      labels:
        app: oc-workflow
    spec:
      {{- if or (eq .Values.env "prod") (eq .Values.env "staging") }}
      imagePullSecrets:
        - name: regcred
      {{- end }}
      containers:
      - image: "{{ .Values.ocWorkflow.image }}"
        name: oc-shared
        envFrom:
        - configMapRef:
            name: opencloud-config
        ports:
          - name: http
            containerPort: 8080
            protocol: TCP
        resources:
          limits:
            cpu: "{{ .Values.ocWorkflow.resources.limits.cpu }}"
            memory: "{{ .Values.ocWorkflow.resources.limits.memory }}"
          requests:
            cpu: "{{ .Values.ocWorkflow.resources.requests.cpu }}"
            memory: "{{ .Values.ocWorkflow.resources.requests.memory }}"
  {{- end }}