From 36283bd9d39b3d854dbe057e050eb350b409fd41 Mon Sep 17 00:00:00 2001 From: Rohan Kumar Date: Tue, 22 Mar 2022 12:10:24 +0530 Subject: [PATCH 1/2] fix: removed deprecated k8sapi executor. Fixes #7802 Signed-off-by: Rohan Kumar --- cmd/argoexec/commands/root.go | 3 --- test/e2e/argo_server_test.go | 2 +- test/e2e/fixtures/needs.go | 3 +-- test/e2e/run_as_not_root_test.go | 2 +- test/e2e/signals_test.go | 2 +- workflow/common/common.go | 3 --- workflow/controller/workflowpod_test.go | 24 ------------------------ workflow/executor/executor.go | 4 ++-- workflow/validate/validate.go | 2 +- workflow/validate/validate_test.go | 8 ++------ 10 files changed, 9 insertions(+), 44 deletions(-) diff --git a/cmd/argoexec/commands/root.go b/cmd/argoexec/commands/root.go index f6bcba54927a..f492c2e6e384 100644 --- a/cmd/argoexec/commands/root.go +++ b/cmd/argoexec/commands/root.go @@ -25,7 +25,6 @@ import ( "github.com/argoproj/argo-workflows/v3/workflow/executor" "github.com/argoproj/argo-workflows/v3/workflow/executor/docker" "github.com/argoproj/argo-workflows/v3/workflow/executor/emissary" - "github.com/argoproj/argo-workflows/v3/workflow/executor/k8sapi" "github.com/argoproj/argo-workflows/v3/workflow/executor/kubelet" "github.com/argoproj/argo-workflows/v3/workflow/executor/pns" ) @@ -114,8 +113,6 @@ func initExecutor() *executor.WorkflowExecutor { var cre executor.ContainerRuntimeExecutor log.Infof("Creating a %s executor", executorType) switch executorType { - case common.ContainerRuntimeExecutorK8sAPI: - cre = k8sapi.NewK8sAPIExecutor(clientset, config, podName, namespace) case common.ContainerRuntimeExecutorKubelet: cre, err = kubelet.NewKubeletExecutor(namespace, podName) case common.ContainerRuntimeExecutorPNS: diff --git a/test/e2e/argo_server_test.go b/test/e2e/argo_server_test.go index e2185d2cb9ab..403ee60b19a0 100644 --- a/test/e2e/argo_server_test.go +++ b/test/e2e/argo_server_test.go @@ -854,7 +854,7 @@ func (s *ArgoServerSuite) TestWorkflowService() { }) s.Run("Terminate", func() { - s.Need(fixtures.None(fixtures.K8SAPI, fixtures.Kubelet)) + s.Need(fixtures.None(fixtures.Kubelet)) s.e().PUT("/api/v1/workflows/argo/" + name + "/terminate"). Expect(). Status(200) diff --git a/test/e2e/fixtures/needs.go b/test/e2e/fixtures/needs.go index 061f469f208f..811a37a68244 100644 --- a/test/e2e/fixtures/needs.go +++ b/test/e2e/fixtures/needs.go @@ -11,12 +11,11 @@ var ( return os.Getenv("CI") != "", "CI" } BaseLayerArtifacts Need = func(s *E2ESuite) (bool, string) { - met, _ := None(K8SAPI, Kubelet)(s) + met, _ := None(Kubelet)(s) return met, "base layer artifact support" } Docker = Executor("docker") Emissary = Executor("emissary") - K8SAPI = Executor("k8sapi") Kubelet = Executor("kubelet") PNS = Executor("pns") ) diff --git a/test/e2e/run_as_not_root_test.go b/test/e2e/run_as_not_root_test.go index d841179c42c4..94154c3d2615 100644 --- a/test/e2e/run_as_not_root_test.go +++ b/test/e2e/run_as_not_root_test.go @@ -25,7 +25,7 @@ func (s *RunAsNonRootSuite) TestRunAsNonRootWorkflow() { } func (s *RunAsNonRootSuite) TestRunAsNonRootWithOutputParams() { - s.Need(fixtures.None(fixtures.Docker, fixtures.K8SAPI, fixtures.Kubelet)) + s.Need(fixtures.None(fixtures.Docker, fixtures.Kubelet)) s.Given(). Workflow("@smoke/runasnonroot-output-params-pipeline.yaml"). When(). diff --git a/test/e2e/signals_test.go b/test/e2e/signals_test.go index 1fa48fbf4776..c5968ee9e5ec 100644 --- a/test/e2e/signals_test.go +++ b/test/e2e/signals_test.go @@ -27,7 +27,7 @@ type SignalsSuite struct { func (s *SignalsSuite) SetupSuite() { s.E2ESuite.SetupSuite() // Because k8ssapi and kubelet execute `sh -c 'kill 15 1'` to they do not work. - s.Need(fixtures.None(fixtures.K8SAPI, fixtures.Kubelet)) + s.Need(fixtures.None(fixtures.Kubelet)) } func (s *SignalsSuite) TestStopBehavior() { diff --git a/workflow/common/common.go b/workflow/common/common.go index 6f15097d97c8..7275f2b75ff8 100644 --- a/workflow/common/common.go +++ b/workflow/common/common.go @@ -159,9 +159,6 @@ const ( // ContainerRuntimeExecutorKubelet to use the kubelet as container runtime executor ContainerRuntimeExecutorKubelet = "kubelet" - // ContainerRuntimeExecutorK8sAPI to use the Kubernetes API server as container runtime executor - ContainerRuntimeExecutorK8sAPI = "k8sapi" - // ContainerRuntimeExecutorPNS indicates to use process namespace sharing as the container runtime executor ContainerRuntimeExecutorPNS = "pns" diff --git a/workflow/controller/workflowpod_test.go b/workflow/controller/workflowpod_test.go index 54abb547c558..0b82395061fa 100644 --- a/workflow/controller/workflowpod_test.go +++ b/workflow/controller/workflowpod_test.go @@ -764,30 +764,6 @@ func TestVolumeAndVolumeMounts(t *testing.T) { assert.Equal(t, "var-run-argo", pod.Spec.Containers[1].VolumeMounts[1].Name) }) - // For K8sAPI executor - t.Run("K8SAPI", func(t *testing.T) { - ctx := context.Background() - woc := newWoc() - woc.volumes = volumes - woc.execWf.Spec.Templates[0].Container.VolumeMounts = volumeMounts - woc.controller.Config.ContainerRuntimeExecutor = common.ContainerRuntimeExecutorK8sAPI - - tmplCtx, err := woc.createTemplateContext(wfv1.ResourceScopeLocal, "") - assert.NoError(t, err) - _, err = woc.executeContainer(ctx, woc.execWf.Spec.Entrypoint, tmplCtx.GetTemplateScope(), &woc.execWf.Spec.Templates[0], &wfv1.WorkflowStep{}, &executeTemplateOpts{}) - assert.NoError(t, err) - pods, err := listPods(woc) - assert.NoError(t, err) - assert.Len(t, pods.Items, 1) - pod := pods.Items[0] - assert.Equal(t, 2, len(pod.Spec.Volumes)) - assert.Equal(t, "var-run-argo", pod.Spec.Volumes[0].Name) - assert.Equal(t, "volume-name", pod.Spec.Volumes[1].Name) - assert.Equal(t, 2, len(pod.Spec.Containers[1].VolumeMounts)) - assert.Equal(t, "volume-name", pod.Spec.Containers[1].VolumeMounts[0].Name) - assert.Equal(t, "var-run-argo", pod.Spec.Containers[1].VolumeMounts[1].Name) - }) - // For emissary executor t.Run("Emissary", func(t *testing.T) { ctx := context.Background() diff --git a/workflow/executor/executor.go b/workflow/executor/executor.go index 4a850eb50a4a..3b9bfd1b1fe9 100644 --- a/workflow/executor/executor.go +++ b/workflow/executor/executor.go @@ -508,8 +508,8 @@ func (we *WorkflowExecutor) SaveParameters(ctx context.Context) error { var output *wfv1.AnyString if we.isBaseImagePath(param.ValueFrom.Path) { executorType := os.Getenv(common.EnvVarContainerRuntimeExecutor) - if executorType == common.ContainerRuntimeExecutorK8sAPI || executorType == common.ContainerRuntimeExecutorKubelet { - log.Infof("Copying output parameter %s from base image layer %s is not supported for k8sapi and kubelet executors. "+ + if executorType == common.ContainerRuntimeExecutorKubelet { + log.Infof("Copying output parameter %s from base image layer %s is not supported for kubelet executor. "+ "Consider using an emptyDir volume: https://argoproj.github.io/argo-workflows/empty-dir/.", param.Name, param.ValueFrom.Path) continue } diff --git a/workflow/validate/validate.go b/workflow/validate/validate.go index 5f5dc3b39516..4d7f7296936e 100644 --- a/workflow/validate/validate.go +++ b/workflow/validate/validate.go @@ -1011,7 +1011,7 @@ func (ctx *templateValidationCtx) validateBaseImageOutputs(tmpl *wfv1.Template) } } } - case common.ContainerRuntimeExecutorK8sAPI, common.ContainerRuntimeExecutorKubelet: + case common.ContainerRuntimeExecutorKubelet: // for kubelet/k8s fail validation if we detect artifact is copied from base image layer errMsg := fmt.Sprintf("%s executor does not support outputs from base image layer. Use an emptyDir: https://argoproj.github.io/argo-workflows/empty-dir/", ctx.ContainerRuntimeExecutor) for _, out := range tmpl.Outputs.Artifacts { diff --git a/workflow/validate/validate_test.go b/workflow/validate/validate_test.go index 927299b90588..42847d8f179b 100644 --- a/workflow/validate/validate_test.go +++ b/workflow/validate/validate_test.go @@ -1626,9 +1626,9 @@ func TestBaseImageOutputVerify(t *testing.T) { wfNonPathOutputParam := unmarshalWf(nonPathOutputParameter) var err error - for _, executor := range []string{common.ContainerRuntimeExecutorK8sAPI, common.ContainerRuntimeExecutorKubelet, common.ContainerRuntimeExecutorPNS, common.ContainerRuntimeExecutorDocker, common.ContainerRuntimeExecutorDocker, common.ContainerRuntimeExecutorEmissary, ""} { + for _, executor := range []string{common.ContainerRuntimeExecutorKubelet, common.ContainerRuntimeExecutorPNS, common.ContainerRuntimeExecutorDocker, common.ContainerRuntimeExecutorDocker, common.ContainerRuntimeExecutorEmissary, ""} { switch executor { - case common.ContainerRuntimeExecutorK8sAPI, common.ContainerRuntimeExecutorKubelet: + case common.ContainerRuntimeExecutorKubelet: _, err = ValidateWorkflow(wftmplGetter, cwftmplGetter, wfBaseOutArt, ValidateOpts{ContainerRuntimeExecutor: executor}) assert.Error(t, err) _, err = ValidateWorkflow(wftmplGetter, cwftmplGetter, wfBaseOutParam, ValidateOpts{ContainerRuntimeExecutor: executor}) @@ -2524,10 +2524,6 @@ func TestDagAndStepLevelOutputArtifactsForDiffExecutor(t *testing.T) { _, err := validateWithOptions(dagAndStepLevelOutputArtifacts, ValidateOpts{ContainerRuntimeExecutor: common.ContainerRuntimeExecutorPNS}) assert.NoError(t, err) }) - t.Run("K8SExecutor", func(t *testing.T) { - _, err := validateWithOptions(dagAndStepLevelOutputArtifacts, ValidateOpts{ContainerRuntimeExecutor: common.ContainerRuntimeExecutorK8sAPI}) - assert.NoError(t, err) - }) t.Run("KubeletExecutor", func(t *testing.T) { _, err := validateWithOptions(dagAndStepLevelOutputArtifacts, ValidateOpts{ContainerRuntimeExecutor: common.ContainerRuntimeExecutorKubelet}) assert.NoError(t, err) From f2822f02147412b55da56140526275102de81d90 Mon Sep 17 00:00:00 2001 From: Rohan Kumar Date: Tue, 22 Mar 2022 12:16:42 +0530 Subject: [PATCH 2/2] fix: ci-build.yaml Signed-off-by: Rohan Kumar --- .github/workflows/ci-build.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml index f44a78408087..8ec1175acb41 100644 --- a/.github/workflows/ci-build.yaml +++ b/.github/workflows/ci-build.yaml @@ -111,9 +111,6 @@ jobs: - test: test-executor containerRuntimeExecutor: docker profile: minimal - - test: test-executor - containerRuntimeExecutor: k8sapi - profile: minimal - test: test-executor containerRuntimeExecutor: kubelet profile: minimal