apiVersion: apps/v1
kind: Deployment
metadata:
  namespace: default
  name: micro-proxy
  labels:
    micro: runtime
    name: micro-proxy
  annotations:
    name: 'go.micro.proxy'
    version: 'latest'
    source: 'github.com/itzmanish/micro'
    owner: 'micro'
    group: 'micro'
spec:
  replicas: 1
  selector:
    matchLabels:
      name: micro-proxy
      micro: runtime
  template:
    metadata:
      labels:
        name: micro-proxy
        micro: runtime
    spec:
      containers:
        - name: proxy
          env:
            - name: MICRO_AUTH
              value: 'service'
            - name: MICRO_AUTH_PUBLIC_KEY
              valueFrom:
                secretKeyRef:
                  name: micro-keypair
                  key: public
            - name: MICRO_PROXY_ADDRESS
              value: '0.0.0.0:443'
            - name: MICRO_SERVER_ADDRESS
              value: '0.0.0.0:8081'
            - name: MICRO_LOG_LEVEL
              value: 'trace'
            - 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_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:
            - proxy
          image: micro/micro
          imagePullPolicy: Always
          ports:
            - containerPort: 443
              name: https-port
            - containerPort: 8081
              name: proxy-port
