{{ if .Values.schema_redis_watcher.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
  name: schema-redis-watcher
spec:
  replicas: 1
  selector:
    matchLabels:
      app: schema-redis-watcher
  template:
    metadata:
      name: schema-redis-watcher
      labels:
        app: schema-redis-watcher
    spec:
      containers:
        - name: schema-redis-watcher
          image: goalprofit/schema_redis_watcher:{{.Values.schema_redis_watcher.version}}
          imagePullPolicy: Always
          env:
            - name: REDIS_URL
              value: server-api-redis-master:6379
            - name: REDIS_USER
              value: default
            - name: REDIS_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: server-api-redis
                  key: redis-password
                  optional: true
            - name: SERVICE_LOGIN
              valueFrom:
                secretKeyRef:
                  name: secret-admin
                  key: username
                  optional: false
            - name: SERVICE_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: secret-admin
                  key: password
                  optional: false
{{ if .Values.schema_redis_watcher.FUSION_API_URL }}
            - name: FUSION_API_URL
              value: {{.Values.schema_redis_watcher.FUSION_API_URL}}
{{ end }}
{{ if .Values.schema_redis_watcher.DE20_API_URL }}
            - name: DE20_API_URL
              value: {{.Values.schema_redis_watcher.DE20_API_URL}}
{{ end }}
      imagePullSecrets:
        - name: regcred
{{ end }}