In Kubernetes, are podAffinity and podAntiAffinity weights compared to each other? Or independently? What about podAffinity and nodeAffinity? Would podAntiAffinity outweight the podAffinity in the below example? And what if nodeAffinity was added to the mix as well.
affinity:
podAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 50
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app.kubernetes.io/name
operator: In
values:
- test-1
topologyKey: kubernetes.io/hostname
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app.kubernetes.io/name
operator: In
values:
- test-2
topologyKey: kubernetes.io/hostname