From a3eddf0991406792b2dccf2be6cc22e7b8e6e7df Mon Sep 17 00:00:00 2001 From: Jason Hall Date: Fri, 1 Nov 2019 12:45:44 -0400 Subject: [PATCH] Remove cmd/nop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The raison d'ĂȘtre for this image was to be able to replace a running container with another image that would simply exit successfully, regardless of the user-defined args/env/etc. (since we can't update args, only the image name) Instead of building and providing our own image, we can simply use an image that contains only `true` as an entrypoint. `tianon/true` is such an image, which is _125 bytes_ in size. The image that's used is configurable by operators, the only requirement is that the image exit successfully regardless of provided inputs. --- cmd/controller/main.go | 3 +- cmd/nop/kodata/HEAD | 1 - cmd/nop/kodata/LICENSE | 1 - cmd/nop/kodata/VENDOR-LICENSE | 1 - cmd/nop/main.go | 29 ------------------- config/controller.yaml | 2 +- .../v1alpha1/build_gcs_resource_test.go | 2 +- pkg/artifacts/artifact_storage_test.go | 2 +- .../pipelinerun/pipelinerun_test.go | 2 +- .../taskrun/resources/apply_test.go | 2 +- .../taskrun/resources/input_resource_test.go | 2 +- pkg/reconciler/taskrun/taskrun_test.go | 2 +- tekton/koparse/test_koparse.py | 2 -- tekton/koparse/test_release.yaml | 2 -- tekton/resources.yaml | 10 ------- 15 files changed, 8 insertions(+), 55 deletions(-) delete mode 120000 cmd/nop/kodata/HEAD delete mode 120000 cmd/nop/kodata/LICENSE delete mode 120000 cmd/nop/kodata/VENDOR-LICENSE delete mode 100644 cmd/nop/main.go diff --git a/cmd/controller/main.go b/cmd/controller/main.go index ce1f0215b26..f0867a5fafc 100644 --- a/cmd/controller/main.go +++ b/cmd/controller/main.go @@ -33,8 +33,7 @@ const ( var ( entrypointImage = flag.String("entrypoint-image", "override-with-entrypoint:latest", "The container image containing our entrypoint binary.") - nopImage = flag.String("nop-image", "override-with-nop:latest", - "The container image used to kill sidecars") + nopImage = flag.String("nop-image", "tianon/true", "The container image used to stop sidecars") gitImage = flag.String("git-image", "override-with-git:latest", "The container image containing our Git binary.") credsImage = flag.String("creds-image", "override-with-creds:latest", diff --git a/cmd/nop/kodata/HEAD b/cmd/nop/kodata/HEAD deleted file mode 120000 index 8f63681d362..00000000000 --- a/cmd/nop/kodata/HEAD +++ /dev/null @@ -1 +0,0 @@ -../../../.git/HEAD \ No newline at end of file diff --git a/cmd/nop/kodata/LICENSE b/cmd/nop/kodata/LICENSE deleted file mode 120000 index 5853aaea53b..00000000000 --- a/cmd/nop/kodata/LICENSE +++ /dev/null @@ -1 +0,0 @@ -../../../LICENSE \ No newline at end of file diff --git a/cmd/nop/kodata/VENDOR-LICENSE b/cmd/nop/kodata/VENDOR-LICENSE deleted file mode 120000 index 3cc89764519..00000000000 --- a/cmd/nop/kodata/VENDOR-LICENSE +++ /dev/null @@ -1 +0,0 @@ -../../../third_party/VENDOR-LICENSE \ No newline at end of file diff --git a/cmd/nop/main.go b/cmd/nop/main.go deleted file mode 100644 index 2503528fbe5..00000000000 --- a/cmd/nop/main.go +++ /dev/null @@ -1,29 +0,0 @@ -/* -Copyright 2019 The Tekton Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// The nop command is a no-op, it simply prints a message and exits. Nop -// is used to stop sidecar containers in TaskRun Pods. When a Task's Steps -// are complete any sidecars running alongside the Step containers need -// to be terminated. Whatever image the sidecars are running is replaced -// with nop and the sidecar quickly exits. - -package main - -import "fmt" - -func main() { - fmt.Println("Task completed successfully") -} diff --git a/config/controller.yaml b/config/controller.yaml index aaa11500c64..9018a75eb9c 100644 --- a/config/controller.yaml +++ b/config/controller.yaml @@ -43,7 +43,7 @@ spec: "-kubeconfig-writer-image", "github.com/tektoncd/pipeline/cmd/kubeconfigwriter", "-creds-image", "github.com/tektoncd/pipeline/cmd/creds-init", "-git-image", "github.com/tektoncd/pipeline/cmd/git-init", - "-nop-image", "github.com/tektoncd/pipeline/cmd/nop", + "-nop-image", "busybox", "-shell-image", "busybox", "-gsutil-image", "google/cloud-sdk", "-entrypoint-image", "github.com/tektoncd/pipeline/cmd/entrypoint", diff --git a/pkg/apis/pipeline/v1alpha1/build_gcs_resource_test.go b/pkg/apis/pipeline/v1alpha1/build_gcs_resource_test.go index 4cafc4e91b1..e3e5ff4d5e7 100644 --- a/pkg/apis/pipeline/v1alpha1/build_gcs_resource_test.go +++ b/pkg/apis/pipeline/v1alpha1/build_gcs_resource_test.go @@ -29,7 +29,7 @@ import ( var images = pipeline.Images{ EntryPointImage: "override-with-entrypoint:latest", - NopImage: "override-with-nop:latest", + NopImage: "tianon/true", GitImage: "override-with-git:latest", CredsImage: "override-with-creds:latest", KubeconfigWriterImage: "override-with-kubeconfig-writer:latest", diff --git a/pkg/artifacts/artifact_storage_test.go b/pkg/artifacts/artifact_storage_test.go index fa64a9aa793..f507f02d94e 100644 --- a/pkg/artifacts/artifact_storage_test.go +++ b/pkg/artifacts/artifact_storage_test.go @@ -35,7 +35,7 @@ import ( var ( images = pipeline.Images{ EntryPointImage: "override-with-entrypoint:latest", - NopImage: "override-with-nop:latest", + NopImage: "tianon/true", GitImage: "override-with-git:latest", CredsImage: "override-with-creds:latest", KubeconfigWriterImage: "override-with-kubeconfig-writer:latest", diff --git a/pkg/reconciler/pipelinerun/pipelinerun_test.go b/pkg/reconciler/pipelinerun/pipelinerun_test.go index a0f52e7b85f..f5ddbc15c59 100644 --- a/pkg/reconciler/pipelinerun/pipelinerun_test.go +++ b/pkg/reconciler/pipelinerun/pipelinerun_test.go @@ -46,7 +46,7 @@ var ( ignoreLastTransitionTime = cmpopts.IgnoreTypes(apis.Condition{}.LastTransitionTime.Inner.Time) images = pipeline.Images{ EntryPointImage: "override-with-entrypoint:latest", - NopImage: "override-with-nop:latest", + NopImage: "tianon/true", GitImage: "override-with-git:latest", CredsImage: "override-with-creds:latest", KubeconfigWriterImage: "override-with-kubeconfig-writer:latest", diff --git a/pkg/reconciler/taskrun/resources/apply_test.go b/pkg/reconciler/taskrun/resources/apply_test.go index 63a95143003..f89db2428af 100644 --- a/pkg/reconciler/taskrun/resources/apply_test.go +++ b/pkg/reconciler/taskrun/resources/apply_test.go @@ -31,7 +31,7 @@ import ( var ( images = pipeline.Images{ EntryPointImage: "override-with-entrypoint:latest", - NopImage: "override-with-nop:latest", + NopImage: "tianon/true", GitImage: "override-with-git:latest", CredsImage: "override-with-creds:latest", KubeconfigWriterImage: "override-with-kubeconfig-writer-image:latest", diff --git a/pkg/reconciler/taskrun/resources/input_resource_test.go b/pkg/reconciler/taskrun/resources/input_resource_test.go index c26b22d7cd0..0265c047461 100644 --- a/pkg/reconciler/taskrun/resources/input_resource_test.go +++ b/pkg/reconciler/taskrun/resources/input_resource_test.go @@ -33,7 +33,7 @@ import ( var ( images = pipeline.Images{ EntryPointImage: "override-with-entrypoint:latest", - NopImage: "override-with-nop:latest", + NopImage: "tianon/true", GitImage: "override-with-git:latest", CredsImage: "override-with-creds:latest", KubeconfigWriterImage: "override-with-kubeconfig-writer:latest", diff --git a/pkg/reconciler/taskrun/taskrun_test.go b/pkg/reconciler/taskrun/taskrun_test.go index 60bbd56a8d6..28a3b5e92c9 100644 --- a/pkg/reconciler/taskrun/taskrun_test.go +++ b/pkg/reconciler/taskrun/taskrun_test.go @@ -65,7 +65,7 @@ const ( var ( images = pipeline.Images{ EntryPointImage: "override-with-entrypoint:latest", - NopImage: "override-with-nop:latest", + NopImage: "tianon/true", GitImage: "override-with-git:latest", CredsImage: "override-with-creds:latest", KubeconfigWriterImage: "override-with-kubeconfig-writer:latest", diff --git a/tekton/koparse/test_koparse.py b/tekton/koparse/test_koparse.py index 72746baa63a..200b72afc90 100755 --- a/tekton/koparse/test_koparse.py +++ b/tekton/koparse/test_koparse.py @@ -15,7 +15,6 @@ "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/kubeconfigwriter@sha256:68453f5bb4b76c0eab98964754114d4f79d3a50413872520d8919a6786ea2b35", "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/creds-init@sha256:67448da79e4731ab534b91df08da547bc434ab08e41d905858f2244e70290f48", "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/git-init@sha256:7d5520efa2d55e1346c424797988c541327ee52ef810a840b5c6f278a9de934a", - "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/nop@sha256:3784d6b8f73043a29d2c1d6196801bee46fe808fbb94ba4fd21ca52dce503183", "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/controller@sha256:bdc6f22a44944c829983c30213091b60f490b41f89577e8492f6a2936be0df41", "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/webhook@sha256:cca7069a11aaf0d9d214306d456bc40b2e33e5839429bf07c123ad964d495d8a", ] @@ -23,7 +22,6 @@ "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/kubeconfigwriter", "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/creds-init", "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/git-init", - "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/nop", "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/controller", "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/webhook", ] diff --git a/tekton/koparse/test_release.yaml b/tekton/koparse/test_release.yaml index ca7be401b61..66e32e87ba1 100644 --- a/tekton/koparse/test_release.yaml +++ b/tekton/koparse/test_release.yaml @@ -336,8 +336,6 @@ spec: - gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/creds-init@sha256:67448da79e4731ab534b91df08da547bc434ab08e41d905858f2244e70290f48 - -git-image - gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/git-init@sha256:7d5520efa2d55e1346c424797988c541327ee52ef810a840b5c6f278a9de934a - - -nop-image - - gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/nop@sha256:3784d6b8f73043a29d2c1d6196801bee46fe808fbb94ba4fd21ca52dce503183 image: gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/controller@sha256:bdc6f22a44944c829983c30213091b60f490b41f89577e8492f6a2936be0df41 name: tekton-pipelines-controller volumeMounts: diff --git a/tekton/resources.yaml b/tekton/resources.yaml index dd4d58d2556..717a14d084f 100644 --- a/tekton/resources.yaml +++ b/tekton/resources.yaml @@ -100,16 +100,6 @@ spec: --- apiVersion: tekton.dev/v1alpha1 kind: PipelineResource -metadata: - name: nop-image -spec: - type: image - params: - - name: url - value: cmd/nop # Registry is provided via parameter, this is a hack see #569 ---- -apiVersion: tekton.dev/v1alpha1 -kind: PipelineResource metadata: name: controller-image spec: