Skip to content

Commit

Permalink
Having the cloning label in the target pod, make the pod affinity fai…
Browse files Browse the repository at this point in the history
…ls. (kubevirt#280)

The target pod looks for a pod with a specific label (specified in the pod affinity) that matches the source pod label.
In my case the target pod included this label as well, so we can see that the target pod found matching pod, but it is the WRONG pod. It's itself!!
The target was running without finding the source pod first.
If we remove this label from the target pod, it will find the source pod and then will be scheduled on the same node.
If it does not find the source pod (because the scheduler tried to schedule it before the source pod), it will be in 'Pending' state until the source pod is scheduled, and then will be running on the same node.
kubevirt#279
  • Loading branch information
zvikorn authored and aglitke committed Aug 1, 2018
1 parent 8ed4dd4 commit 691e696
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/controller/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,7 @@ func MakeCloneTargetPodSpec(image, verbose, pullPolicy string, pvc *v1.Persisten
AnnCloningCreatedBy: "yes",
},
Labels: map[string]string{
CDI_LABEL_KEY: CDI_LABEL_VALUE, //filtered by the podInformer
CLONING_LABEL_KEY: CLONING_LABEL_VALUE + "-" + generatedLabelStr, //used by PodAffinity
CDI_LABEL_KEY: CDI_LABEL_VALUE, //filtered by the podInformer
},
},
Spec: v1.PodSpec{
Expand Down Expand Up @@ -491,6 +490,10 @@ func MakeCloneTargetPodSpec(image, verbose, pullPolicy string, pvc *v1.Persisten
Name: CLONER_TARGET_PODNAME,
Image: image,
ImagePullPolicy: v1.PullPolicy(pullPolicy),
SecurityContext: &v1.SecurityContext{
Privileged: &[]bool{true}[0],
RunAsUser: &[]int64{0}[0],
},
VolumeMounts: []v1.VolumeMount{
{
Name: ImagePathName,
Expand Down

0 comments on commit 691e696

Please sign in to comment.