Select node by pod (#18)

* Select node by pod.

* Removed watch pod by regex. Irrelevant for now.

* Changed default image to develop:latest.
This commit is contained in:
nimrod-up9
2021-04-29 15:46:18 +03:00
committed by GitHub
parent 96a6ac3251
commit 38146a644d
4 changed files with 14 additions and 14 deletions

View File

@@ -70,7 +70,12 @@ func (provider *Provider) GetPods(ctx context.Context) {
fmt.Printf("There are %d pods in Namespace %s\n", len(pods.Items), provider.Namespace)
}
func (provider *Provider) CreatePod(ctx context.Context, podName string, podImage string) (*core.Pod, error) {
func (provider *Provider) CreateMizuPod(ctx context.Context, podName string, podImage string, tappedPodName string) (*core.Pod, error) {
tappedPod, err := provider.clientSet.CoreV1().Pods(provider.Namespace).Get(ctx, tappedPodName, metav1.GetOptions{})
if err != nil {
panic(err.Error())
}
privileged := true
pod := &core.Pod{
ObjectMeta: metav1.ObjectMeta{
@@ -96,6 +101,7 @@ func (provider *Provider) CreatePod(ctx context.Context, podName string, podImag
},
},
TerminationGracePeriodSeconds: new(int64),
NodeSelector: map[string]string{"kubernetes.io/hostname": tappedPod.Spec.NodeName},
},
}
return provider.clientSet.CoreV1().Pods(provider.Namespace).Create(ctx, pod, metav1.CreateOptions{})