From f4a20bbe757ac4f2230afe436898235ee67fe725 Mon Sep 17 00:00:00 2001 From: Danil Grigorev Date: Thu, 25 Jul 2024 14:15:33 +0200 Subject: [PATCH] Pin CAAPF version to v0.3.0 (#614) Signed-off-by: Danil-Grigorev --- charts/rancher-turtles/questions.yml | 2 +- .../templates/addon-provider-fleet.yaml | 2 ++ .../templates/clusterctl-config.yaml | 2 +- .../e2e/suites/import-gitops-v3/suite_test.go | 4 +++- test/e2e/suites/import-gitops/suite_test.go | 19 +++++++++++++++++-- test/e2e/suites/migrate-gitops/suite_test.go | 15 +++++++++++++++ test/testenv/turtles.go | 5 +++++ 7 files changed, 44 insertions(+), 5 deletions(-) diff --git a/charts/rancher-turtles/questions.yml b/charts/rancher-turtles/questions.yml index 7c194300..f0c7717a 100644 --- a/charts/rancher-turtles/questions.yml +++ b/charts/rancher-turtles/questions.yml @@ -72,7 +72,7 @@ questions: group: "Rancher Turtles Features Settings" - variable: rancherTurtles.features.addon-provider-fleet.enabled default: false - description: "(Experimental) Enable Fleet Addon Provider functionality in Rancher Turtles" + description: "Enable Fleet Addon Provider functionality in Rancher Turtles" type: boolean label: Seamless integration with Fleet and CAPI group: "Rancher Turtles Features Settings" diff --git a/charts/rancher-turtles/templates/addon-provider-fleet.yaml b/charts/rancher-turtles/templates/addon-provider-fleet.yaml index 6b4d8798..211fcd7e 100644 --- a/charts/rancher-turtles/templates/addon-provider-fleet.yaml +++ b/charts/rancher-turtles/templates/addon-provider-fleet.yaml @@ -31,8 +31,10 @@ data: spec: clusterClass: patchResource: true + setOwnerReferences: true cluster: patchResource: true + setOwnerReferences: true selector: matchLabels: cluster-api.cattle.io/rancher-auto-import: "true" diff --git a/charts/rancher-turtles/templates/clusterctl-config.yaml b/charts/rancher-turtles/templates/clusterctl-config.yaml index cc7d79f8..7e55a31a 100644 --- a/charts/rancher-turtles/templates/clusterctl-config.yaml +++ b/charts/rancher-turtles/templates/clusterctl-config.yaml @@ -50,6 +50,6 @@ data: # Addon providers - name: "fleet" - url: "https://github.com/rancher-sandbox/cluster-api-addon-provider-fleet/releases/latest/addon-components.yaml" + url: "https://github.com/rancher-sandbox/cluster-api-addon-provider-fleet/releases/v0.3.0/addon-components.yaml" type: "AddonProvider" {{- end }} diff --git a/test/e2e/suites/import-gitops-v3/suite_test.go b/test/e2e/suites/import-gitops-v3/suite_test.go index 86462b9e..ed96db5c 100644 --- a/test/e2e/suites/import-gitops-v3/suite_test.go +++ b/test/e2e/suites/import-gitops-v3/suite_test.go @@ -193,7 +193,9 @@ var _ = BeforeSuite(func() { Image: fmt.Sprintf("ghcr.io/rancher/turtles-e2e-%s", runtime.GOARCH), Tag: "v0.0.1", WaitDeploymentsReadyInterval: e2eConfig.GetIntervals(setupClusterResult.BootstrapClusterProxy.GetName(), "wait-controllers"), - AdditionalValues: map[string]string{}, + AdditionalValues: map[string]string{ + "rancherTurtles.features.addon-provider-fleet.enabled": "true", + }, } if flagVals.UseEKS { rtInput.AdditionalValues["rancherTurtles.imagePullSecrets"] = "{regcred}" diff --git a/test/e2e/suites/import-gitops/suite_test.go b/test/e2e/suites/import-gitops/suite_test.go index c0375e35..8b945041 100644 --- a/test/e2e/suites/import-gitops/suite_test.go +++ b/test/e2e/suites/import-gitops/suite_test.go @@ -30,11 +30,14 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/rancher/turtles/test/e2e" - "github.com/rancher/turtles/test/framework" + opframework "github.com/rancher/turtles/test/framework" turtlesframework "github.com/rancher/turtles/test/framework" "github.com/rancher/turtles/test/testenv" + appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/klog/v2" + "sigs.k8s.io/cluster-api/test/framework" "sigs.k8s.io/cluster-api/test/framework/clusterctl" ctrl "sigs.k8s.io/controller-runtime" ) @@ -144,7 +147,7 @@ var _ = BeforeSuite(func() { hostName = svcRes.Hostname By("Deploying ghcr details") - framework.CreateDockerRegistrySecret(ctx, framework.CreateDockerRegistrySecretInput{ + opframework.CreateDockerRegistrySecret(ctx, opframework.CreateDockerRegistrySecretInput{ Name: "regcred", BootstrapClusterProxy: setupClusterResult.BootstrapClusterProxy, Namespace: "rancher-turtles-system", @@ -212,6 +215,7 @@ var _ = BeforeSuite(func() { Tag: "v0.0.1", WaitDeploymentsReadyInterval: e2eConfig.GetIntervals(setupClusterResult.BootstrapClusterProxy.GetName(), "wait-controllers"), AdditionalValues: rtInput.AdditionalValues, + PostUpgradeSteps: []func(){}, } if flagVals.UseEKS { @@ -226,6 +230,17 @@ var _ = BeforeSuite(func() { rtInput.AdditionalValues["rancherTurtles.features.addon-provider-fleet.enabled"] = "true" rtInput.AdditionalValues["rancherTurtles.features.managementv3-cluster.enabled"] = "false" // disable the default management.cattle.io/v3 controller + upgradeInput.PostUpgradeSteps = append(upgradeInput.PostUpgradeSteps, func() { + By("Waiting for CAAPF deployment to be available") + framework.WaitForDeploymentsAvailable(ctx, framework.WaitForDeploymentsAvailableInput{ + Getter: setupClusterResult.BootstrapClusterProxy.GetClient(), + Deployment: &appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{ + Name: "caapf-controller-manager", + Namespace: "rancher-turtles-system", + }}, + }, e2eConfig.GetIntervals(setupClusterResult.BootstrapClusterProxy.GetName(), "wait-controllers")...) + }) + testenv.UpgradeRancherTurtles(ctx, upgradeInput) } else { rtInput := testenv.DeployRancherTurtlesInput{ diff --git a/test/e2e/suites/migrate-gitops/suite_test.go b/test/e2e/suites/migrate-gitops/suite_test.go index 651e8f7c..48854bb1 100644 --- a/test/e2e/suites/migrate-gitops/suite_test.go +++ b/test/e2e/suites/migrate-gitops/suite_test.go @@ -32,8 +32,12 @@ import ( "github.com/rancher/turtles/test/e2e" turtlesframework "github.com/rancher/turtles/test/framework" "github.com/rancher/turtles/test/testenv" + appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/klog/v2" + "sigs.k8s.io/cluster-api/test/framework" "sigs.k8s.io/cluster-api/test/framework/clusterctl" ctrl "sigs.k8s.io/controller-runtime" ) @@ -183,6 +187,17 @@ var _ = BeforeSuite(func() { rtInput.AdditionalValues["rancherTurtles.features.addon-provider-fleet.enabled"] = "true" rtInput.AdditionalValues["rancherTurtles.features.managementv3-cluster.enabled"] = "false" // disable the default management.cattle.io/v3 controller + upgradeInput.PostUpgradeSteps = append(upgradeInput.PostUpgradeSteps, func() { + By("Waiting for CAAPF deployment to be available") + framework.WaitForDeploymentsAvailable(ctx, framework.WaitForDeploymentsAvailableInput{ + Getter: setupClusterResult.BootstrapClusterProxy.GetClient(), + Deployment: &appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{ + Name: "caapf-controller-manager", + Namespace: "rancher-turtles-system", + }}, + }, e2eConfig.GetIntervals(setupClusterResult.BootstrapClusterProxy.GetName(), "wait-controllers")...) + }) + testenv.UpgradeRancherTurtles(ctx, upgradeInput) giteaValues := map[string]string{ diff --git a/test/testenv/turtles.go b/test/testenv/turtles.go index 4f2661e8..8a552589 100644 --- a/test/testenv/turtles.go +++ b/test/testenv/turtles.go @@ -194,6 +194,7 @@ type UpgradeRancherTurtlesInput struct { AdditionalValues map[string]string Image string Tag string + PostUpgradeSteps []func() SkipCleanup bool } @@ -259,6 +260,10 @@ func UpgradeRancherTurtles(ctx context.Context, input UpgradeRancherTurtlesInput if err != nil { Expect(fmt.Errorf("Unable to perform chart upgrade: %w\nOutput: %s, Command: %s", err, out, strings.Join(append(values, additionalValues...), " "))).ToNot(HaveOccurred()) } + + for _, step := range input.PostUpgradeSteps { + step() + } } func UninstallRancherTurtles(ctx context.Context, input UninstallRancherTurtlesInput) {