apiVersion: apps/v1
kind: Deployment
metadata:
  name: worker
  namespace: faasm
  labels:
    app: faasm
spec:
  replicas: 3
  selector:
    matchLabels:
      app: faasm
      role: worker
  template:
    metadata:
      labels:
        app: faasm
        role: worker
    spec:
      containers:
        - name: worker
          image: faasm/worker
          imagePullPolicy: Always
          securityContext:
            privileged: yes
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
              - matchExpressions:
                  - key: nodeRole
                    operator: In
                    values:
                      - worker
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
            - weight: 1
              podAffinityTerm:
                labelSelector:
                  matchExpressions:
                    - key: role
                      operator: In
                      values:
                        - worker
                topologyKey: kubernetes.io/hostname
