apiVersion: apps/v1
kind: Deployment
metadata:
  name: onify-api
  labels:
    app: onify
    tier: api
spec:
  selector:
    matchLabels:
      app: onify
      tier: api
  template:
    metadata:
      labels:
        app: onify
        tier: api
    spec:
      imagePullSecrets:
      - name: onify-regcred
      containers:
      - name: api
        image: eu.gcr.io/onify-images/hub/api:latest # IMPORTANT: replace with desired version
        envFrom:
        - configMapRef:
            name: onify-api-config
        env:
        - name: ONIFY_autoinstall
          value: "true"
        - name: ONIFY_adminUser_password
          valueFrom:
            secretKeyRef:
              name: onify-api-secrets
              key: admin_password
        - name: ONIFY_apiTokens_app_secret
          valueFrom:
            secretKeyRef:
              name: onify-api-secrets
              key: app_token_secret
        - name: ONIFY_client_secret
          valueFrom:
            secretKeyRef:
              name: onify-api-secrets
              key: client_secret
        volumeMounts:
        - name: resources
          mountPath: /usr/share/onify
        ports:
        - name: api
          containerPort: 8181
      volumes:
        - name: resources
          persistentVolumeClaim:
            claimName: onify-resources-pvc