apiVersion: apps/v1
kind: Deployment
metadata:
  namespace: default
  name: micro-api-latest
  labels:
    micro: runtime
    name: api
    version: latest
  annotations:
    name: "api"
    version: "latest"
    source: "github.com/micro/micro"
    owner: "micro"
    group: "micro"
spec:
  replicas: 1
  selector:
    matchLabels:
      name: micro-api
      micro: runtime
  template:
    metadata:
      labels:
        name: micro-api
        micro: runtime
        version: latest
      annotations:
        prometheus.io/scrape: "true"
        prometheus.io/path: /metrics
        prometheus.io/port: "9000"
    spec:
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
            - weight: 100
              podAffinityTerm:
                labelSelector:
                  matchExpressions:
                    - key: name
                      operator: In
                      values:
                        - micro-api
                    - key: micro
                      operator: In
                      values:
                        - runtime
                topologyKey: "kubernetes.io/hostname"
      containers:
      - name: micro
        env:
        - name: MICRO_API_RESOLVER
          value: subdomain
        - name: MICRO_AUTH_PUBLIC_KEY
          valueFrom:
            secretKeyRef:
              name: micro-secrets
              key: auth_public_key
        - name: MICRO_AUTH_PRIVATE_KEY
          valueFrom:
            secretKeyRef:
              name: micro-secrets
              key: auth_private_key
        - name: MICRO_PROFILE
          value: "client"
        - name: MICRO_SERVICE_NAME
          value: client
        - name: MICRO_PROXY
          value: "micro-network.default.svc.cluster.local:8443"
        args:
        - service
        - api
        image: ghcr.io/m3o/platform
        imagePullPolicy: Always
        ports:
        - containerPort: 8080
          name: api-port
        readinessProbe:
          tcpSocket:
            port: api-port
          initialDelaySeconds: 5
          periodSeconds: 10
