apiVersion: apps/v1
kind: Deployment
metadata:
  name: factory
spec:
  replicas: 1
  selector:
    matchLabels:
      app: factory
  minReadySeconds: 10
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 1
      maxSurge: 1
  template:
    metadata:
      labels:
        app: factory
    spec:
      initContainers:
      - name: wait-for-mongodb-before-starup
        image: busybox
        command:  ["sh", "-c", "until nc -z mongodb.mongodb 27017 > /dev/null; do echo Waiting for master.; sleep 2; done;"]
      containers:
      - name: factory
        image: "uugai/factory:v1.0.5"
        resources:
          requests:
            memory: 128Mi
            cpu: 100m
          limits:
            memory: 128Mi
            cpu: 100m
        ports:
          - containerPort: 80
        envFrom:
          - configMapRef:
              name: mongodb
        env:
        - name: GIN_MODE
          value: release
        - name: KERBEROS_LOGIN_USERNAME
          value: "root"
        - name: KERBEROS_LOGIN_PASSWORD
          value: "kerberos"

        - name: KERBEROS_AGENT_IMAGE
          value: "kerberos/agent:latest"
        - name: KERBEROS_AGENT_MEMORY_LIMIT
          value: "256Mi"

        # Do not touch this, unless you know what you are doing.
        - name: NAMESPACE
          value: "kerberos-factory"
        - name: FACTORY_ENVIRONMENT
          value: "kubernetes"
        - name: K8S_PROXY
          value: http://localhost:80

