Skip to content

Commit

Permalink
changed pod anti affinity scheduling rule
Browse files Browse the repository at this point in the history
  • Loading branch information
ksimon1 committed Apr 11, 2019
1 parent 5248a0e commit bdf6e39
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 24 deletions.
18 changes: 10 additions & 8 deletions manifests/generated/virt-api.yaml.in
Expand Up @@ -40,14 +40,16 @@ spec:
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: kubevirt.io
operator: In
values:
- virt-api
topologyKey: kubernetes.io/hostname
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchExpressions:
- key: kubevirt.io
operator: In
values:
- virt-api
topologyKey: kubernetes.io/hostname
weight: 1
containers:
- command:
- virt-api
Expand Down
18 changes: 10 additions & 8 deletions manifests/generated/virt-controller.yaml.in
Expand Up @@ -24,14 +24,16 @@ spec:
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: kubevirt.io
operator: In
values:
- virt-controller
topologyKey: kubernetes.io/hostname
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchExpressions:
- key: kubevirt.io
operator: In
values:
- virt-controller
topologyKey: kubernetes.io/hostname
weight: 1
containers:
- command:
- virt-controller
Expand Down
19 changes: 11 additions & 8 deletions pkg/virt-operator/creation/components/deployments.go
Expand Up @@ -246,18 +246,21 @@ func newBaseDeployment(name string, namespace string, repository string, version
func newPodAntiAffinity(key, topologyKey string, operator metav1.LabelSelectorOperator, values []string) *corev1.Affinity {
return &corev1.Affinity{
PodAntiAffinity: &corev1.PodAntiAffinity{
RequiredDuringSchedulingIgnoredDuringExecution: []corev1.PodAffinityTerm{
PreferredDuringSchedulingIgnoredDuringExecution: []corev1.WeightedPodAffinityTerm{
{
LabelSelector: &metav1.LabelSelector{
MatchExpressions: []metav1.LabelSelectorRequirement{
{
Key: key,
Operator: operator,
Values: values,
Weight: 1,
PodAffinityTerm: corev1.PodAffinityTerm{
LabelSelector: &metav1.LabelSelector{
MatchExpressions: []metav1.LabelSelectorRequirement{
{
Key: key,
Operator: operator,
Values: values,
},
},
},
TopologyKey: topologyKey,
},
TopologyKey: topologyKey,
},
},
},
Expand Down

0 comments on commit bdf6e39

Please sign in to comment.