apiVersion: apps/v1
kind: Deployment
metadata:
  namespace: default
  name: micro-api
  labels:
    micro: runtime
    name: micro-api
  annotations:
    name: "go.micro.api"
    version: "latest"
    source: "github.com/crypto-zero/micro"
    owner: "micro"
    group: "micro"
spec:
  replicas: 3
  selector:
    matchLabels:
      name: micro-api
      micro: runtime
  strategy:
    rollingUpdate:
      maxSurge: 0
      maxUnavailable: 1
  template:
    metadata:
      labels:
        name: micro-api
        micro: runtime
    spec:
      containers:
      - name: api
        env:
        - name: MICRO_AUTH
          value: "service"
        - name: MICRO_AUTH_PUBLIC_KEY
          valueFrom:
            secretKeyRef:
              name: micro-keypair
              key: public
        - name: MICRO_API_NAMESPACE
          value: "domain"
        - name: MICRO_ENABLE_STATS
          value: "true"
        - name: MICRO_BROKER
          value: "nats"
        - name: MICRO_BROKER_ADDRESS
          value: "nats-cluster"
        - name: MICRO_REGISTRY
          value: "etcd"
        - name: MICRO_REGISTRY_ADDRESS
          value: "etcd-cluster-client"
        - name: MICRO_REGISTER_TTL
          value: "60"
        - name: MICRO_REGISTER_INTERVAL
          value: "30"
        - name: MICRO_ENABLE_ACME
          value: "true"
        - name: MICRO_ACME_PROVIDER
          value: certmagic
        - name: MICRO_ACME_HOSTS
          value: '*.micro.mu,*.cloud.micro.mu,micro.mu'
        - name: MICRO_STORE
          value: "service"
        - name: MICRO_STORE_DATABASE
          value: "micro"
        - name: MICRO_STORE_TABLE
          value: "micro"
        - name: CF_API_TOKEN
          valueFrom:
            secretKeyRef:
              key: CF_API_TOKEN
              name: cloudflare-credentials
        args:
        - api
        image: micro/micro
        imagePullPolicy: Always
        ports:
        - containerPort: 443
          name: api-port
