From ab1c32950471c0cfeef4611c5363e7f42f9d4e8a Mon Sep 17 00:00:00 2001 From: Shivam Mukhade Date: Tue, 10 May 2022 12:33:40 +0530 Subject: [PATCH 1/3] Fixes operator pod restart on changing addon params after successfull installation, changing addon params is breaking the code and pods keep restarting. this fixes it. Signed-off-by: Shivam Mukhade --- .../openshift/tektonaddon/tektonaddon.go | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/pkg/reconciler/openshift/tektonaddon/tektonaddon.go b/pkg/reconciler/openshift/tektonaddon/tektonaddon.go index 1dd277aa81..2f1c301453 100644 --- a/pkg/reconciler/openshift/tektonaddon/tektonaddon.go +++ b/pkg/reconciler/openshift/tektonaddon/tektonaddon.go @@ -200,6 +200,11 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, ta *v1alpha1.TektonAddon ta.Status.MarkInstallerSetNotReady(msg) return r.ensureClusterTasks(ctx, ta) } + + if err := r.checkComponentStatus(ctx, clusterTaskLabelSelector); err != nil { + ta.Status.MarkInstallerSetNotReady(err.Error()) + return nil + } } else { // if disabled then delete the installer Set if exist if err := r.deleteInstallerSet(ctx, clusterTaskLabelSelector); err != nil { @@ -207,11 +212,6 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, ta *v1alpha1.TektonAddon } } - if err := r.checkComponentStatus(ctx, clusterTaskLabelSelector); err != nil { - ta.Status.MarkInstallerSetNotReady(err.Error()) - return nil - } - // If clusterTasks are enabled then create an InstallerSet // with the versioned clustertask manifest versionedClusterTaskLS := metav1.LabelSelector{ @@ -282,6 +282,11 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, ta *v1alpha1.TektonAddon ta.Status.MarkInstallerSetNotReady(msg) return r.ensurePipelineTemplates(ctx, ta) } + + if err := r.checkComponentStatus(ctx, pipelineTemplateLSLabelSelector); err != nil { + ta.Status.MarkInstallerSetNotReady(err.Error()) + return nil + } } else { // if disabled then delete the installer Set if exist if err := r.deleteInstallerSet(ctx, pipelineTemplateLSLabelSelector); err != nil { @@ -289,11 +294,6 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, ta *v1alpha1.TektonAddon } } - if err := r.checkComponentStatus(ctx, pipelineTemplateLSLabelSelector); err != nil { - ta.Status.MarkInstallerSetNotReady(err.Error()) - return nil - } - // Ensure Triggers resources triggerResourceLS := metav1.LabelSelector{ MatchLabels: map[string]string{ @@ -353,6 +353,10 @@ func (r *Reconciler) checkComponentStatus(ctx context.Context, labelSelector str return err } + if len(installerSets.Items) == 0 { + return fmt.Errorf("failed to find installerSet using label : %s", labelSelector) + } + ready := installerSets.Items[0].Status.GetCondition(apis.ConditionReady) if ready == nil || ready.Status == corev1.ConditionUnknown { return fmt.Errorf("InstallerSet %s: waiting for installation", installerSets.Items[0].Name) From 112bf3c0298104fbaba3559a6dbe820ae35fd07f Mon Sep 17 00:00:00 2001 From: Shivam Mukhade Date: Tue, 10 May 2022 12:55:39 +0530 Subject: [PATCH 2/3] change cmd/ko to ko MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With this pr google/ko#628 getting merged operator Make apply is gives below error ```cat building github.com/google/ko/cmd/ko… cannot find package "github.com/google/ko/cmd/ko" in any of: /usr/local/go/src/github.com/google/ko/cmd/ko (from $GOROOT) /tmp/tmp.rXMejzqfMj/src/github.com/google/ko/cmd/ko (from $GOPATH) make: *** [Makefile:26: /home/pradeepkumar/go/src/github.com/tektoncd/operator/.bin/ko] Error 1 ``` Signed-off-by: Pradeep Kumar --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 682946b7ec..dbe4283dba 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,7 @@ TRIGGERS ?= latest DASHBOARD ?= latest RESULTS ?= latest -$(BIN)/ko: PACKAGE=github.com/google/ko/cmd/ko +$(BIN)/ko: PACKAGE=github.com/google/ko KUSTOMIZE = $(or ${KUSTOMIZE_BIN},${KUSTOMIZE_BIN},$(BIN)/kustomize) $(BIN)/kustomize: | $(BIN) ; $(info $(M) getting kustomize) From 55e062f2a3220d1803198471a957032b6044be7e Mon Sep 17 00:00:00 2001 From: Nikhil Thomas Date: Mon, 21 Mar 2022 14:39:36 +0530 Subject: [PATCH 3/3] Freeze ko version to v0.9.3 Freeze ko version to v0.9.3 as latest version fails to build on go 1.16.13 Use `GO111MODULE=on` as `@version` syntax in go get will not work in non GO mod `go: can only use path@version syntax with 'go get' and 'go install' in module-aware mode` Signed-off-by: Nikhil Thomas --- Makefile | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index dbe4283dba..9fe56ff50b 100644 --- a/Makefile +++ b/Makefile @@ -23,10 +23,13 @@ export GO111MODULE=on $(BIN): @mkdir -p $@ $(BIN)/%: | $(BIN) ; $(info $(M) building $(PACKAGE)…) - $Q tmp=$$(mktemp -d); \ - env GO111MODULE=off GOPATH=$$tmp GOBIN=$(BIN) $(GO) get $(PACKAGE) \ + $Q tmp=$$(mktemp -d); cd $$tmp; \ + env GO111MODULE=on GOPATH=$$tmp GOBIN=$(BIN) $(GO) get $(PACKAGE) \ || ret=$$?; \ - rm -rf $$tmp ; exit $$ret + env GO111MODULE=on GOPATH=$$tmp GOBIN=$(BIN) $(GO) clean -modcache \ + || ret=$$?; \ + cd - ; \ + rm -rf $$tmp ; exit $$ret KO = $(or ${KO_BIN},${KO_BIN},$(BIN)/ko) @@ -35,7 +38,9 @@ TRIGGERS ?= latest DASHBOARD ?= latest RESULTS ?= latest -$(BIN)/ko: PACKAGE=github.com/google/ko +# TODO: after updating go version to 1.17 uncommnent the line below to install latest version of ko +# $(BIN)/ko: PACKAGE=github.com/google/ko +$(BIN)/ko: PACKAGE=github.com/google/ko@v0.9.3 KUSTOMIZE = $(or ${KUSTOMIZE_BIN},${KUSTOMIZE_BIN},$(BIN)/kustomize) $(BIN)/kustomize: | $(BIN) ; $(info $(M) getting kustomize)