apiVersion: apps/v1
kind: Deployment
metadata:
  namespace: default
  name: micro-network
  labels:
    micro: runtime
    name: micro-network
  annotations:
    name: "go.micro.network"
    version: "latest"
    source: "github.com/micro/micro"
    owner: "micro"
    group: "micro"
spec:
  replicas: 1
  selector:
    matchLabels:
      name: micro-network
      micro: runtime
  strategy:
    rollingUpdate:
      maxSurge: 0
      maxUnavailable: 1
  template:
    metadata:
      labels:
        name: micro-network
        micro: runtime
    spec:
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - weight: 100
            podAffinityTerm:
              labelSelector:
                matchExpressions:
                - key: name
                  operator: In
                  values:
                  - micro-network
              topologyKey: "kubernetes.io/hostname"
      volumes:
      - name: shared-data
        emptyDir: {}
      containers:
      - name: network
        env:
        - name: MICRO_LOG_LEVEL
          value: "debug"
        - name: MICRO_BROKER
          value: "nats"
        - name: MICRO_BROKER_ADDRESS
          value: "nats-cluster"
        - name: MICRO_BROKER_TLS_CA
          value: "/certs/broker/ca.crt"
        - name: MICRO_BROKER_TLS_CERT
          value: "/certs/broker/cert.pem"
        - name: MICRO_BROKER_TLS_KEY
          value: "/certs/broker/key.pem"
        - name: MICRO_REGISTRY
          value: "etcd"
        - name: MICRO_REGISTRY_ADDRESS
          value: "etcd-cluster"
        - name: MICRO_REGISTRY_TLS_CA
          value: "/certs/registry/ca.crt"
        - name: MICRO_REGISTRY_TLS_CERT
          value: "/certs/registry/cert.pem"
        - name: MICRO_REGISTRY_TLS_KEY
          value: "/certs/registry/key.pem"
        - name: MICRO_SERVER_ADDRESS
          value: "0.0.0.0:8080"
        args:
        - service
        - network
        image: micro/micro
        imagePullPolicy: Always
        ports:
        - containerPort: 8080
          name: service-port
        - containerPort: 8085
          name: network-port
          protocol: UDP
        volumeMounts:
        - name: etcd-client-certs
          mountPath: "/certs/registry"
          readOnly: true
        - name: nats-client-certs
          mountPath: "/certs/broker"
          readOnly: true
      volumes:
      - name: etcd-client-certs
        secret:
          secretName: etcd-client-certs
      - name: nats-client-certs
        secret:
          secretName: nats-client-certs