{{ if .Values.api_router_schema_updater.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
  name: api-router-schema-updater
spec:
  replicas: 1
  selector:
    matchLabels:
      app: api-router-schema-updater
  template:
    metadata:
      name: api-router-schema-updater
      labels:
        app: api-router-schema-updater
    spec:
      containers:
      - name: api-router-schema-updater
        image: docker.io/goalprofit/api-router-schema-updater:{{.Values.api_router_schema_updater.version}}
        imagePullPolicy: Always
        volumeMounts:
        - mountPath: /data
          name: customer
          subPath: data/api-router
        env:
        - name: APOLLO_ELV2_LICENSE
          value: accept
        command:
          - bash
          - /app/run.sh
          {{ if .Values.server_api.enabled }}
          - "{{.Values.server_api.router_config }}"
          {{ end }}

          {{ if .Values.camunda2.enabled }}
          - "{{.Values.camunda2.router_config }}"
          {{ end }}
          

      imagePullSecrets:
      - name: regcred
        
      volumes:
      - name: customer
        {{ include "app.customer_volume" . | nindent 8}}
      {{ include "app.affinity" . | nindent 6}}

---
apiVersion: v1
kind: Service
metadata:
  name: api-router-schema-updater
spec:
  type: ClusterIP
  selector:
    app: api-router-schema-updater
  ports:
    - name: http
      protocol: TCP
      port: 8080
      targetPort: 8080
{{ end }}
