diff --git a/agent-install/k8s/auto-upgrade-cronjob-template.yml b/agent-install/k8s/auto-upgrade-cronjob-template.yml index aa8848676..4451d27f2 100644 --- a/agent-install/k8s/auto-upgrade-cronjob-template.yml +++ b/agent-install/k8s/auto-upgrade-cronjob-template.yml @@ -12,6 +12,16 @@ spec: backoffLimit: 0 template: spec: + affinity: + podAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchExpressions: + - key: openhorizon.org/component + operator: In + values: + - agent + topologyKey: kubernetes.io/hostname volumes: - name: agent-pvc-storage persistentVolumeClaim: diff --git a/agent-install/k8s/deployment-template.yml b/agent-install/k8s/deployment-template.yml index 7126bd129..a597e11a4 100644 --- a/agent-install/k8s/deployment-template.yml +++ b/agent-install/k8s/deployment-template.yml @@ -13,6 +13,16 @@ spec: labels: app: agent spec: + affinity: + podAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchExpressions: + - key: openhorizon.org/component + operator: In + values: + - agent + topologyKey: kubernetes.io/hostname serviceAccountName: agent-service-account volumes: - name: agent-etc-vol