@@ -61,6 +61,7 @@ func (w *kubernetesWorker) New(ctx context.Context, cfg *integration.BackendConf
6161 defer os .RemoveAll (filepath .Dir (cfgfile ))
6262
6363 name := "integration-kubernetes-" + identity .NewID ()
64+ nodeName := "buildkit-" + identity .NewID ()
6465 env := append (
6566 os .Environ (),
6667 "BUILDX_CONFIG=/tmp/buildx-" + name ,
@@ -69,6 +70,7 @@ func (w *kubernetesWorker) New(ctx context.Context, cfg *integration.BackendConf
6970
7071 cmd := exec .CommandContext (ctx , "buildx" , "create" ,
7172 "--name=" + name ,
73+ "--node=" + nodeName ,
7274 "--buildkitd-config=" + cfgfile ,
7375 "--driver=kubernetes" ,
7476 )
@@ -78,7 +80,7 @@ func (w *kubernetesWorker) New(ctx context.Context, cfg *integration.BackendConf
7880 return nil , nil , errors .Wrapf (err , "failed to create buildx instance %s: %s" , name , strings .TrimSpace (string (out )))
7981 }
8082
81- if err := patchBuilderDeployment (ctx , env , name ); err != nil {
83+ if err := patchBuilderDeployment (ctx , env , nodeName ); err != nil {
8284 return nil , nil , err
8385 }
8486
@@ -101,19 +103,19 @@ func (w *kubernetesWorker) New(ctx context.Context, cfg *integration.BackendConf
101103 }, cl , nil
102104}
103105
104- func patchBuilderDeployment (ctx context.Context , env []string , name string ) error {
105- cmd := exec .CommandContext (ctx , "kubectl" , "patch" , "deployment" , name , "--type=merge" , "-p" , `{"spec":{"template":{"spec":{"hostNetwork":true,"dnsPolicy":"ClusterFirstWithHostNet"}}}}` )
106+ func patchBuilderDeployment (ctx context.Context , env []string , nodeName string ) error {
107+ cmd := exec .CommandContext (ctx , "kubectl" , "patch" , "deployment" , nodeName , "--type=merge" , "-p" , `{"spec":{"template":{"spec":{"hostNetwork":true,"dnsPolicy":"ClusterFirstWithHostNet"}}}}` )
106108 cmd .Env = env
107109 out , err := cmd .CombinedOutput ()
108110 if err != nil {
109- return errors .Wrapf (err , "failed to patch deployment %s for host networking: %s" , name , strings .TrimSpace (string (out )))
111+ return errors .Wrapf (err , "failed to patch deployment %s for host networking: %s" , nodeName , strings .TrimSpace (string (out )))
110112 }
111113
112- cmd = exec .CommandContext (ctx , "kubectl" , "rollout" , "status" , "deployment/" + name , "--timeout=120s" )
114+ cmd = exec .CommandContext (ctx , "kubectl" , "rollout" , "status" , "deployment/" + nodeName , "--timeout=120s" )
113115 cmd .Env = env
114116 out , err = cmd .CombinedOutput ()
115117 if err != nil {
116- return errors .Wrapf (err , "deployment %s did not roll out after host-network patch: %s" , name , strings .TrimSpace (string (out )))
118+ return errors .Wrapf (err , "deployment %s did not roll out after host-network patch: %s" , nodeName , strings .TrimSpace (string (out )))
117119 }
118120 return nil
119121}
0 commit comments