{{- if .Values.enabled.enabled }}
{{- $namespace := .Release.Namespace -}}
{{- $applicationName := .Values.deploy.name -}}

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ $applicationName }}-op
  namespace: {{ $namespace }}
  labels:
  {{- include "srs.labels.op" . | nindent 4 }}
spec:
  replicas: {{ .Values.apps.srs.replicas.op }}
  selector:
    matchLabels:
  {{- include "srs.matchLabels.op" . | nindent 6 }}
  template:
    metadata:
      labels:
      {{- include "srs.labels.op" . | nindent 8 }}
    spec:
      imagePullSecrets:
        - name: {{ .Values.deploy.harbor.secret }}
      affinity:
        {}
      containers:
        - name: operator
          image: "{{ .Values.global.image.repository }}/{{ .Values.apps.srs.image.op }}"
          imagePullPolicy: Always
          resources:
            limits:
              memory: 4Gi
              cpu: 4800m
            requests:
              memory: 256Mi
              cpu: 100m
          ports:
            - name: operator
              containerPort: 8080
              protocol: TCP
          volumeMounts:
            - name: srs-conf-file
              mountPath: /cmii/application.yaml
              subPath: application.yaml
      volumes:
        - name: srs-conf-file
          configMap:
            name: "{{ $applicationName }}-cm"
            items:
              - key: "srs.op.conf"
                path: "application.yaml"
---
{{- end }}