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/itzmanish/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_NETWORK_TOKEN
              value: 'micro.mu'
            - name: MICRO_NETWORK_ADVERTISE_STRATEGY
              value: 'best'
            - name: MICRO_LOG_LEVEL
              value: 'debug'
            - 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_SERVER_ADDRESS
              value: '0.0.0.0:8080'
          args:
            - network
          image: micro/micro
          imagePullPolicy: Always
          ports:
            - containerPort: 8080
              name: service-port
            - containerPort: 8085
              name: network-port
              protocol: UDP
