From b52e05e46deaec69543adf73a44e04963da35ebe Mon Sep 17 00:00:00 2001 From: Daniel Maizel Date: Mon, 26 Dec 2022 20:21:17 +0200 Subject: [PATCH] Cr 15222 (#661) * make sure git integration secret is deleted even if app-proxy is not available during uninstall * bump --- Makefile | 2 +- cmd/commands/runtime.go | 11 +++++++++-- docs/releases/release_notes.md | 4 ++-- pkg/store/store.go | 2 ++ 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 9dcdf74d..45f1cd03 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION=v0.1.22 +VERSION=v0.1.23 OUT_DIR=dist YEAR?=$(shell date +"%Y") diff --git a/cmd/commands/runtime.go b/cmd/commands/runtime.go index 526a8e05..e5192f16 100644 --- a/cmd/commands/runtime.go +++ b/cmd/commands/runtime.go @@ -595,12 +595,19 @@ func runRuntimeUninstall(ctx context.Context, opts *RuntimeUninstallOptions) err } func runPostUninstallCleanup(ctx context.Context, kubeFactory kube.Factory, namespace string) error { - secrets, err := kubeutil.GetSecretsWithLabel(ctx, kubeFactory, namespace, store.Get().LabelSelectorSealedSecret) + sealedSecrets, err := kubeutil.GetSecretsWithLabel(ctx, kubeFactory, namespace, store.Get().LabelSelectorSealedSecret) if err != nil { return err } - for _, secret := range secrets.Items { + gitIntegrationSecrets, err := kubeutil.GetSecretsWithLabel(ctx, kubeFactory, namespace, store.Get().LabelSelectorGitIntegrationSecret) + if err != nil { + return err + } + + secrets := append(sealedSecrets.Items, gitIntegrationSecrets.Items...) + + for _, secret := range secrets { err = kubeutil.DeleteSecretWithFinalizer(ctx, kubeFactory, &secret) if err != nil { log.G().Warnf("failed to delete secret: %w", err) diff --git a/docs/releases/release_notes.md b/docs/releases/release_notes.md index 6e4969da..7e18f4e7 100644 --- a/docs/releases/release_notes.md +++ b/docs/releases/release_notes.md @@ -23,7 +23,7 @@ cf version ```bash # download and extract the binary -curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.22/cf-linux-amd64.tar.gz | tar zx +curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.23/cf-linux-amd64.tar.gz | tar zx # move the binary to your $PATH mv ./cf-linux-amd64 /usr/local/bin/cf @@ -36,7 +36,7 @@ cf version ```bash # download and extract the binary -curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.22/cf-darwin-amd64.tar.gz | tar zx +curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.23/cf-darwin-amd64.tar.gz | tar zx # move the binary to your $PATH mv ./cf-darwin-amd64 /usr/local/bin/cf diff --git a/pkg/store/store.go b/pkg/store/store.go index 6ba2e1c4..e1626550 100644 --- a/pkg/store/store.go +++ b/pkg/store/store.go @@ -86,6 +86,7 @@ type Store struct { LabelKeyCFType string LabelKeyCFInternal string LabelSelectorSealedSecret string + LabelSelectorGitIntegrationSecret string AnnotationKeySyncWave string MarketplaceGitSourceName string MarketplaceRepo string @@ -210,6 +211,7 @@ func init() { s.LabelKeyCFType = "codefresh.io/entity" s.LabelKeyCFInternal = "codefresh.io/internal" s.LabelSelectorSealedSecret = "codefresh.io/sealing-key=true" + s.LabelSelectorGitIntegrationSecret = "io.codefresh.integration-type=git" s.AnnotationKeySyncWave = "argocd.argoproj.io/sync-wave" s.MaxDefVersion = semver.MustParse(maxDefVersion) s.LastRuntimeVersionInCLI = semver.MustParse(lastRuntimeVersionInCLI)