apiVersion: apps/v1
kind: Deployment
metadata:
  name: autoscaling-buffer
  namespace: kube-system
  labels:
    application: autoscaling-buffer
spec:
  replicas: {{.ConfigItems.autoscaling_buffer_pods}}
  selector:
    matchLabels:
      application: autoscaling-buffer
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        application: autoscaling-buffer
    spec:
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
            - weight: 100
              podAffinityTerm:
                labelSelector:
                  matchExpressions:
                  - key: application
                    operator: In
                    values:
                    - autoscaling-buffer
                topologyKey: failure-domain.beta.kubernetes.io/zone
      priorityClassName: autoscaling-buffer
      terminationGracePeriodSeconds: 0
      containers:
      - name: pause
        image: registry.opensource.zalan.do/teapot/pause-amd64:3.0
        resources:
{{ with $resources := autoscalingBufferSettings . }}
          limits:
            cpu: {{$resources.CPU}}
            memory: {{$resources.Memory}}
          requests:
            cpu: {{$resources.CPU}}
            memory: {{$resources.Memory}}
{{ end }}

apiVersion: apps/v1
kind: Deployment
metadata:
  name: autoscaling-buffer
  namespace: kube-system
  labels:
    application: autoscaling-buffer
spec:
  replicas: {{.ConfigItems.autoscaling_buffer_pods}}
  selector:
    matchLabels:
      application: autoscaling-buffer
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        application: autoscaling-buffer
    spec:
      affinity:
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
          - labelSelector:
              matchExpressions:
              - key: application
                operator: In
                values:
                - autoscaling-buffer
            topologyKey: failure-domain.beta.kubernetes.io/zone
      priorityClassName: autoscaling-buffer
      terminationGracePeriodSeconds: 0
      containers:
      - name: pause
        image: registry.opensource.zalan.do/teapot/pause-amd64:3.0
        resources:
{{ with $resources := autoscalingBufferSettings . }}
          limits:
            cpu: {{$resources.CPU}}
            memory: {{$resources.Memory}}
          requests:
            cpu: {{$resources.CPU}}
            memory: {{$resources.Memory}}
{{ end }}

Use required affinity for autoscaling pods
Use required affinity for autoscaling pods
