apiVersion: apps/v1
kind: Deployment
metadata:
  name:  admin
  labels:
    run:  admin
    version: v1
spec:
  replicas: 3
  selector:
    matchLabels:
      run:  admin
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        run:  admin
    spec:
      containers:
      - image:  quay.io/ibm-avocados/ibmcloud-kubernetes-admin:v0.3.0
        imagePullPolicy: Always
        name:  kubeadmin
        env:
          - name: CLOUDANT_USER_NAME
            valueFrom: 
              secretKeyRef:
                name: cloudant-secret
                key: username
          - name: CLOUDANT_PASSWORD
            valueFrom:
              secretKeyRef:
                name: cloudant-secret
                key: password
          - name: CLOUDANT_HOST
            valueFrom:
              secretKeyRef:
                name: cloudant-secret
                key: host
          - name: TICKER_PERIOD
            value: "3600"
          - name: AWX_ACCESS_TOKEN
            valueFrom:
              secretKeyRef:
                name: awx-secret
                key: apikey
          - name: AWX_ENDPOINT
            valueFrom:
              secretKeyRef:
                name: awx-secret
                key: baseurl
          - name: GRANT_CLUSTER_WORKFLOW_ID
            valueFrom:
              secretKeyRef:
                name: awx-secret
                key: grantclusterworkflowid
          - name: SENDGRID_API_KEY
            valueFrom:
              secretKeyRef:
                name: sendgrid-secret
                key: apikey
          - name: ADMIN_FROM_EMAIL
            value: iksadmin@ibm.com
          - name: ADMIN_TO_EMAIL
            value: "awesome@ibm.com"
          - name: IBM_REDIRECT_URI
            value: https://kubeadmin-tool.dc4.usva.ibm.com/auth/callback
          - name: IBM_LOGIN_USER
            valueFrom:
              secretKeyRef:
                name: ibmcloud-secret
                key: ibm_login_user
          - name: IBM_LOGIN_CLIENT_ID
            valueFrom:
              secretKeyRef:
                name: ibmcloud-secret
                key: ibm_login_client_id
          - name: IBM_LOGIN_CLIENT_SECRET
            valueFrom:
              secretKeyRef:
                name: ibmcloud-secret
                key: ibm_login_client_secret
          - name: JWT_SECRET
            valueFrom:
              secretKeyRef:
                name: ibmcloud-secret
                key: jwt_secret
          - name: GITHUB_ISSUE_REPO
            value: "https://github.ibm.com/jja/cloud-workshop-requests"
        resources:
          limits:
            cpu: 1000m
            memory: 4Gi
          requests:
            cpu: 1000m
            memory: 4Gi
      restartPolicy: Always
