apiVersion: apps/v1
kind: Deployment
metadata:
  name: gorush
  # namespace: gorush
spec:
  # replicas: 1
  selector:
    matchLabels:
      app: gorush
      tier: frontend
  template:
    metadata:
      labels:
        app: gorush
        tier: frontend
    spec:
      containers:
        - image: appleboy/gorush:1.14.0
          name: gorush
          imagePullPolicy: Always
          ports:
            - containerPort: 8088
          livenessProbe:
            httpGet:
              path: /healthz
              port: 8088
            initialDelaySeconds: 3
            periodSeconds: 3
          env:
            - name: GORUSH_STAT_ENGINE
              valueFrom:
                configMapKeyRef:
                  name: gorush-config
                  key: stat.engine
            - name: GORUSH_STAT_REDIS_ADDR
              valueFrom:
                configMapKeyRef:
                  name: gorush-config
                  key: stat.redis.host
            - name: GORUSH_ANDROID_APIKEY
              valueFrom:
                secretKeyRef:
                  name: gorush-secret
                  key: android.apikey
          volumeMounts:
            - name: ios-push-secret-vol
              mountPath: /data/ssl/AuthKey_WKG6X45GSC.p8
              subPath: AuthKey_WKG6X45GSC.p8
              readOnly: true
            - name: gorush-config-file-vol
              mountPath: /config.yml
              readOnly: true
              subPath: config.yml
      volumes:
        - name: gorush-config-file-vol
          configMap:
            name: gorush-config-yml
            items:
              - key: gorush-config.yaml
                path: config.yml
        - name: ios-push-secret-vol
          secret:
            secretName: ios-push-secret
            items:
              - key: AuthKey_WKG6X45GSC.p8
                path: AuthKey_WKG6X45GSC.p8
