apiVersion: apps/v1
kind: Deployment
metadata:
  name: demo
spec:
  replicas: 2
  strategy:
    rollingUpdate:
      maxUnavailable: 0%
      maxSurge: 25%
  selector:
    matchLabels:
      app: demo
  template:
    metadata:
      labels:
        app: demo
    spec:
      serviceAccountName: demo
      containers:
        - name: leader
          image: mjpitz/highlander-proxy:latest
          imagePullPolicy: Always
          securityContext: {}
          env:
            - name: POD_IP
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: status.podIP
            - name: NAMESPACE_NAME
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: metadata.namespace
          args:
            - --identity
            - $(POD_IP)
            - --routes
            - tcp://0.0.0.0:8080|tcp://localhost:8081
            - --routes
            - tcp://0.0.0.0:9090|tcp://localhost:8081
            # Debug Configuration
            - --log-level
            - debug
            # Kubernetes Configuration
            - --lock-namespace
            - $(NAMESPACE_NAME)
            - --lock-name
            - demo
        - name: main
          image: kennethreitz/httpbin
          imagePullPolicy: Always
          command:
            - gunicorn
            - -b
            - localhost:8081
            - httpbin:app
            - -k
            - gevent
