apiVersion: apps/v1
kind: Deployment
metadata:
  name: zitadel
  labels:
    app: zitadel
spec:
  replicas: 3
  selector:
    matchLabels:
      app: zitadel
      version: v1
  template:
    metadata:
      labels:
        app: zitadel
        version: v1
    spec:
      containers:
      - name: zitadel
        image: docker.pkg.github.com/caos/zitadel/zitadel:latest
        imagePullPolicy: IfNotPresent
        args: []
        ports:
        - name: grpc
          containerPort: 50001
        - name: http
          containerPort: 50002
        - name: ui
          containerPort: 50003
        env:
        - name: POD_IP
          valueFrom:
            fieldRef:
              fieldPath: status.podIP
        - name: CHAT_URL
          valueFrom:
            secretKeyRef:
              name: zitadel-secrets-vars
              key: ZITADEL_GOOGLE_CHAT_URL
        - name: TWILIO_TOKEN
          valueFrom:
            secretKeyRef:
              name: zitadel-secrets-vars
              key: ZITADEL_TWILIO_AUTH_TOKEN
        - name: TWILIO_SERVICE_SID
          valueFrom:
            secretKeyRef:
              name: zitadel-secrets-vars
              key: ZITADEL_TWILIO_SID
        - name: SMTP_PASSWORD
          valueFrom:
            secretKeyRef:
              name: zitadel-secrets-vars
              key: ZITADEL_EMAILAPPKEY
        envFrom:
          - configMapRef:
              name: zitadel-vars
        volumeMounts:
          - name: zitadel-secret
            mountPath: /secret
          - name: console-config
            mountPath: /console/environment.json
            subPath: environment.json
      imagePullSecrets:
      - name: githubsecret
      volumes:
        - name: zitadel-secret
          secret:
            secretName: zitadel-secret
        - name: console-config
          configMap:
            name: console-config
