From b5334916f0ee113c0c3e38b5c9cda92e1b892581 Mon Sep 17 00:00:00 2001 From: Mario Manno Date: Wed, 10 Jul 2024 11:30:40 +0200 Subject: [PATCH 1/3] Rename two CI workflows to *-ci --- .github/workflows/{fleet-upgrade.yml => fleet-upgrade-ci.yml} | 0 .../{rancher-upgrade-fleet.yml => rancher-upgrade-fleet-ci.yml} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{fleet-upgrade.yml => fleet-upgrade-ci.yml} (100%) rename .github/workflows/{rancher-upgrade-fleet.yml => rancher-upgrade-fleet-ci.yml} (100%) diff --git a/.github/workflows/fleet-upgrade.yml b/.github/workflows/fleet-upgrade-ci.yml similarity index 100% rename from .github/workflows/fleet-upgrade.yml rename to .github/workflows/fleet-upgrade-ci.yml diff --git a/.github/workflows/rancher-upgrade-fleet.yml b/.github/workflows/rancher-upgrade-fleet-ci.yml similarity index 100% rename from .github/workflows/rancher-upgrade-fleet.yml rename to .github/workflows/rancher-upgrade-fleet-ci.yml From a8548f6ec0acb2137b239253bc561c56b6af5ce7 Mon Sep 17 00:00:00 2001 From: Mario Manno Date: Wed, 10 Jul 2024 11:31:19 +0200 Subject: [PATCH 2/3] Dev remove fleet script and finalizers --- dev/remove-fleet | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/dev/remove-fleet b/dev/remove-fleet index b585387a36..5a58d29b20 100755 --- a/dev/remove-fleet +++ b/dev/remove-fleet @@ -8,17 +8,22 @@ ctx=$(kubectl config current-context) kubectl config use-context "$upstream_ctx" +# Remove controllers helm uninstall -n cattle-fleet-system fleet + +# Remove finalizers, this will prevent deletion of namespace fleet-local from hanging +for res in gitrepos.fleet.cattle.io bundledeployments.fleet.cattle.io bundles.fleet.cattle.io; do + kubectl get "$res" -A --no-headers | while read ns name _; do kubectl patch "$res" -n "$ns" "$name" -p '{"metadata":{"finalizers":[]}}' --type=merge; done +done + helm uninstall -n cattle-fleet-system fleet-crd +# make sure crds are removed +kubectl delete crd gitrepos.fleet.cattle.io bundledeployments.fleet.cattle.io bundles.fleet.cattle.io + kubectl delete ns cattle-fleet-system --now kubectl delete ns cattle-fleet-clusters-system --now -# This will prevent deletion of namespace fleet-local from hanging -bd_ns=$(kubectl get ns -l fleet.cattle.io/managed=true --no-headers -o=jsonpath={.items[0].metadata.name}) -kubectl patch bundledeployment fleet-agent-local -n $bd_ns -p '{"metadata":{"finalizers":[]}}' --type=merge -kubectl patch bundle fleet-agent-local -n fleet-local -p '{"metadata":{"finalizers":[]}}' --type=merge - kubectl delete ns fleet-local --now kubectl delete ns -l "fleet.cattle.io/managed=true" @@ -31,4 +36,3 @@ helm uninstall -n cattle-fleet-system fleet-agent kubectl delete ns cattle-fleet-system --now kubectl config use-context "$ctx" - From 0e422dbb6a4c3d30d4d317a51209502d8654a8c3 Mon Sep 17 00:00:00 2001 From: Mario Manno Date: Wed, 10 Jul 2024 11:32:28 +0200 Subject: [PATCH 3/3] Remove e2e "difficult" label All tests in multi-cluster are difficult --- e2e/multi-cluster/bundle_namespace_mapping_test.go | 4 +++- e2e/multi-cluster/depends_on_test.go | 2 +- internal/cmd/cli/apply/apply.go | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/e2e/multi-cluster/bundle_namespace_mapping_test.go b/e2e/multi-cluster/bundle_namespace_mapping_test.go index 91e86ed0a4..f509680dbe 100644 --- a/e2e/multi-cluster/bundle_namespace_mapping_test.go +++ b/e2e/multi-cluster/bundle_namespace_mapping_test.go @@ -11,7 +11,9 @@ import ( "github.com/rancher/fleet/e2e/testenv/kubectl" ) -var _ = Describe("Bundle Namespace Mapping", Label("difficult"), func() { +// This test uses two clusters to demonstrate matching clusters in different +// namespaces. Therefore it's setup and input configuration is difficult. +var _ = Describe("Bundle Namespace Mapping", func() { var ( k kubectl.Command kd kubectl.Command diff --git a/e2e/multi-cluster/depends_on_test.go b/e2e/multi-cluster/depends_on_test.go index 59b02782f4..c1a4364b62 100644 --- a/e2e/multi-cluster/depends_on_test.go +++ b/e2e/multi-cluster/depends_on_test.go @@ -13,7 +13,7 @@ import ( fleet "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1" ) -var _ = Describe("Bundle Depends On", Label("difficult"), func() { +var _ = Describe("Bundle Depends On", func() { var ( k kubectl.Command diff --git a/internal/cmd/cli/apply/apply.go b/internal/cmd/cli/apply/apply.go index a4c472b00b..14ce2e097a 100644 --- a/internal/cmd/cli/apply/apply.go +++ b/internal/cmd/cli/apply/apply.go @@ -213,7 +213,8 @@ func Dir(ctx context.Context, client Getter, name, baseDir string, opts *Options if opts == nil { opts = &Options{} } - // the bundleID is a valid helm release name, it's used as a default if a release name is not specified in helm options + // The bundleID is a valid helm release name, it's used as a default if a release name is not specified in helm options. + // It's also used to create the bundle name. bundleID := filepath.Join(name, baseDir) bundleID = name2.HelmReleaseName(bundleID)