From 8d0f5688080ecbaa813a1be50c98d6858e0334a3 Mon Sep 17 00:00:00 2001 From: Michael Burman Date: Wed, 27 Nov 2024 22:28:53 +0200 Subject: [PATCH] Some logging, some prefix changes --- controllers/k8ssandra/schemas.go | 1 + test/e2e/reaper_test.go | 25 +++++++++++++------------ test/e2e/stop_dc_test.go | 17 +++++++++-------- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/controllers/k8ssandra/schemas.go b/controllers/k8ssandra/schemas.go index 3c32c8866..218a3de5f 100644 --- a/controllers/k8ssandra/schemas.go +++ b/controllers/k8ssandra/schemas.go @@ -57,6 +57,7 @@ func (r *K8ssandraClusterReconciler) checkSchemas( } decommCassDcName, dcNameOverride := k8ssandra.GetDatacenterForDecommission(kc) + logger.Info("Checking if user keyspace replication needs to be updated", "decommissioning_dc", decommCassDcName, "dc_name_override", dcNameOverride) decommission := false if decommCassDcName != "" { decommission = kc.Status.Datacenters[decommCassDcName].DecommissionProgress == api.DecommUpdatingReplication diff --git a/test/e2e/reaper_test.go b/test/e2e/reaper_test.go index e3c73d275..7f26035f8 100644 --- a/test/e2e/reaper_test.go +++ b/test/e2e/reaper_test.go @@ -156,20 +156,21 @@ func createMultiReaper(t *testing.T, ctx context.Context, namespace string, f *f checkDatacenterReady(t, ctx, dc2Key, f) dc1Prefix := DcPrefix(t, f, dc1Key) - dc2Prefix := DcPrefixOverride(t, f, dc2Key) + dc2Prefix := DcPrefix(t, f, dc2Key) + reaperStargate2Prefix := DcPrefixOverride(t, f, dc2Key) reaper1Key := framework.ClusterKey{K8sContext: f.DataPlaneContexts[0], NamespacedName: types.NamespacedName{Namespace: namespace, Name: dc1Prefix + "-reaper"}} - reaper2Key := framework.ClusterKey{K8sContext: f.DataPlaneContexts[1], NamespacedName: types.NamespacedName{Namespace: namespace, Name: dc2Prefix + "-reaper"}} + reaper2Key := framework.ClusterKey{K8sContext: f.DataPlaneContexts[1], NamespacedName: types.NamespacedName{Namespace: namespace, Name: reaperStargate2Prefix + "-reaper"}} stargate1Key := framework.ClusterKey{K8sContext: f.DataPlaneContexts[0], NamespacedName: types.NamespacedName{Namespace: namespace, Name: dc1Prefix + "-stargate"}} - stargate2Key := framework.ClusterKey{K8sContext: f.DataPlaneContexts[1], NamespacedName: types.NamespacedName{Namespace: namespace, Name: dc2Prefix + "-stargate"}} + stargate2Key := framework.ClusterKey{K8sContext: f.DataPlaneContexts[1], NamespacedName: types.NamespacedName{Namespace: namespace, Name: reaperStargate2Prefix + "-stargate"}} - t.Logf("check Stargate auth keyspace created in both clusters. DC prefixes: %s / %s ", dc1Prefix, dc2Prefix) + t.Logf("check Stargate auth keyspace created in both clusters. DC prefixes: %s / %s ", dc1Prefix, reaperStargate2Prefix) checkKeyspaceExists(t, f, ctx, f.DataPlaneContexts[0], namespace, kc.SanitizedName(), dc1Prefix+"-default-sts-0", stargate.AuthKeyspace) - checkKeyspaceExists(t, f, ctx, f.DataPlaneContexts[1], namespace, kc.SanitizedName(), dc2Prefix+"-default-sts-0", stargate.AuthKeyspace) + checkKeyspaceExists(t, f, ctx, f.DataPlaneContexts[1], namespace, kc.SanitizedName(), reaperStargate2Prefix+"-default-sts-0", stargate.AuthKeyspace) t.Log("check Reaper custom keyspace created in both clusters") checkKeyspaceExists(t, f, ctx, f.DataPlaneContexts[0], namespace, kc.SanitizedName(), dc1Prefix+"-default-sts-0", "reaper_ks") - checkKeyspaceExists(t, f, ctx, f.DataPlaneContexts[1], namespace, kc.SanitizedName(), dc2Prefix+"-default-sts-0", "reaper_ks") + checkKeyspaceExists(t, f, ctx, f.DataPlaneContexts[1], namespace, kc.SanitizedName(), reaperStargate2Prefix+"-default-sts-0", "reaper_ks") checkStargateReady(t, f, ctx, stargate1Key) checkStargateK8cStatusReady(t, f, ctx, kcKey, dc1Key) @@ -207,9 +208,9 @@ func createMultiReaper(t *testing.T, ctx context.Context, namespace string, f *f stargateGrpcHostAndPort = ingressConfigs[f.DataPlaneContexts[1]].StargateGrpc stargateCqlHostAndPort = ingressConfigs[f.DataPlaneContexts[1]].StargateCql reaperRestHostAndPort = ingressConfigs[f.DataPlaneContexts[1]].ReaperRest - f.DeployStargateIngresses(t, f.DataPlaneContexts[1], namespace, dc2Prefix+"-stargate-service", stargateRestHostAndPort, stargateGrpcHostAndPort) - f.DeployReaperIngresses(t, f.DataPlaneContexts[1], namespace, dc2Prefix+"-reaper-service", reaperRestHostAndPort) - checkStargateApisReachable(t, ctx, f.DataPlaneContexts[1], namespace, dc2Prefix, stargateRestHostAndPort, stargateGrpcHostAndPort, stargateCqlHostAndPort, username, password, false, f) + f.DeployStargateIngresses(t, f.DataPlaneContexts[1], namespace, reaperStargate2Prefix+"-stargate-service", stargateRestHostAndPort, stargateGrpcHostAndPort) + f.DeployReaperIngresses(t, f.DataPlaneContexts[1], namespace, reaperStargate2Prefix+"-reaper-service", reaperRestHostAndPort) + checkStargateApisReachable(t, ctx, f.DataPlaneContexts[1], namespace, reaperStargate2Prefix, stargateRestHostAndPort, stargateGrpcHostAndPort, stargateCqlHostAndPort, username, password, false, f) checkReaperApiReachable(t, ctx, reaperRestHostAndPort) defer f.UndeployAllIngresses(t, f.DataPlaneContexts[0], namespace) @@ -241,10 +242,10 @@ func createMultiReaperWithEncryption(t *testing.T, ctx context.Context, namespac checkDatacenterReady(t, ctx, dc2Key, f) dc1Prefix := DcPrefix(t, f, dc1Key) - dc2Prefix := DcPrefixOverride(t, f, dc2Key) + reaper2Prefix := DcPrefixOverride(t, f, dc2Key) reaper1Key := framework.ClusterKey{K8sContext: f.DataPlaneContexts[0], NamespacedName: types.NamespacedName{Namespace: namespace, Name: dc1Prefix + "-reaper"}} - reaper2Key := framework.ClusterKey{K8sContext: f.DataPlaneContexts[1], NamespacedName: types.NamespacedName{Namespace: namespace, Name: dc2Prefix + "-reaper"}} + reaper2Key := framework.ClusterKey{K8sContext: f.DataPlaneContexts[1], NamespacedName: types.NamespacedName{Namespace: namespace, Name: reaper2Prefix + "-reaper"}} checkReaperReady(t, f, ctx, reaper1Key) checkReaperK8cStatusReady(t, f, ctx, kcKey, dc1Key) @@ -257,7 +258,7 @@ func createMultiReaperWithEncryption(t *testing.T, ctx context.Context, namespac f.DeployReaperIngresses(t, f.DataPlaneContexts[0], namespace, dc1Prefix+"-reaper-service", reaperRestHostAndPort) checkReaperApiReachable(t, ctx, reaperRestHostAndPort) reaperRestHostAndPort = ingressConfigs[f.DataPlaneContexts[1]].ReaperRest - f.DeployReaperIngresses(t, f.DataPlaneContexts[1], namespace, dc2Prefix+"-reaper-service", reaperRestHostAndPort) + f.DeployReaperIngresses(t, f.DataPlaneContexts[1], namespace, reaper2Prefix+"-reaper-service", reaperRestHostAndPort) checkReaperApiReachable(t, ctx, reaperRestHostAndPort) defer f.UndeployAllIngresses(t, f.DataPlaneContexts[0], namespace) diff --git a/test/e2e/stop_dc_test.go b/test/e2e/stop_dc_test.go index 020be2e46..d981acf02 100644 --- a/test/e2e/stop_dc_test.go +++ b/test/e2e/stop_dc_test.go @@ -34,11 +34,12 @@ func stopAndRestartDc(t *testing.T, ctx context.Context, namespace string, f *fr checkDatacenterReady(t, ctx, dc2Key, f) dc1Prefix := DcPrefix(t, f, dc1Key) - dc2Prefix := DcPrefixOverride(t, f, dc2Key) + dc2Prefix := DcPrefix(t, f, dc2Key) + reaperStargate2Prefix := DcPrefixOverride(t, f, dc2Key) sg1Key := framework.NewClusterKey(f.DataPlaneContexts[0], namespace, fmt.Sprintf("%s-stargate", dc1Prefix)) reaper1Key := framework.NewClusterKey(f.DataPlaneContexts[0], namespace, fmt.Sprintf("%s-reaper", dc1Prefix)) - sg2Key := framework.NewClusterKey(f.DataPlaneContexts[1], namespace, fmt.Sprintf("%s-stargate", dc2Prefix)) - reaper2Key := framework.NewClusterKey(f.DataPlaneContexts[1], namespace, fmt.Sprintf("%s-reaper", dc2Prefix)) + sg2Key := framework.NewClusterKey(f.DataPlaneContexts[1], namespace, fmt.Sprintf("%s-stargate", reaperStargate2Prefix)) + reaper2Key := framework.NewClusterKey(f.DataPlaneContexts[1], namespace, fmt.Sprintf("%s-reaper", reaperStargate2Prefix)) checkStargateReady(t, f, ctx, sg1Key) checkReaperReady(t, f, ctx, reaper1Key) @@ -59,10 +60,10 @@ func stopAndRestartDc(t *testing.T, ctx context.Context, namespace string, f *fr stargateGrpcHostAndPort := ingressConfigs[f.DataPlaneContexts[1]].StargateGrpc stargateCqlHostAndPort := ingressConfigs[f.DataPlaneContexts[1]].StargateCql reaperRestHostAndPort := ingressConfigs[f.DataPlaneContexts[1]].ReaperRest - f.DeployStargateIngresses(t, f.DataPlaneContexts[1], namespace, fmt.Sprintf("%s-stargate-service", dc2Prefix), stargateRestHostAndPort, stargateGrpcHostAndPort) - f.DeployReaperIngresses(t, f.DataPlaneContexts[1], namespace, fmt.Sprintf("%s-reaper-service", dc2Prefix), reaperRestHostAndPort) + f.DeployStargateIngresses(t, f.DataPlaneContexts[1], namespace, fmt.Sprintf("%s-stargate-service", reaperStargate2Prefix), stargateRestHostAndPort, stargateGrpcHostAndPort) + f.DeployReaperIngresses(t, f.DataPlaneContexts[1], namespace, fmt.Sprintf("%s-reaper-service", reaperStargate2Prefix), reaperRestHostAndPort) defer f.UndeployAllIngresses(t, f.DataPlaneContexts[1], namespace) - checkStargateApisReachable(t, ctx, f.DataPlaneContexts[1], namespace, dc2Prefix, stargateRestHostAndPort, stargateGrpcHostAndPort, stargateCqlHostAndPort, username, password, false, f) + checkStargateApisReachable(t, ctx, f.DataPlaneContexts[1], namespace, reaperStargate2Prefix, stargateRestHostAndPort, stargateGrpcHostAndPort, stargateCqlHostAndPort, username, password, false, f) checkReaperApiReachable(t, ctx, reaperRestHostAndPort) pod1Name := fmt.Sprintf("%s-default-sts-0", dc1Prefix) @@ -71,7 +72,7 @@ func stopAndRestartDc(t *testing.T, ctx context.Context, namespace string, f *fr checkKeyspaceReplicationsUnaltered(t, f, ctx, f.DataPlaneContexts[1], namespace, pod2Name, DcName(t, f, dc1Key), DcName(t, f, dc2Key)) t.Run("TestApisDc1Stopped", func(t *testing.T) { - testStargateApis(t, f, ctx, f.DataPlaneContexts[1], namespace, dc2Prefix, username, password, false, map[string]int{DcName(t, f, dc2Key): 1}) + testStargateApis(t, f, ctx, f.DataPlaneContexts[1], namespace, reaperStargate2Prefix, username, password, false, map[string]int{DcName(t, f, dc2Key): 1}) uiKey := framework.NewClusterKey(f.DataPlaneContexts[1], namespace, reaper.DefaultUiSecretName("cluster1")) uiUsername, uiPassword := retrieveCredentials(t, f, ctx, uiKey) connectReaperApi(t, ctx, f.DataPlaneContexts[1], "cluster1", uiUsername, uiPassword) @@ -119,7 +120,7 @@ func stopAndRestartDc(t *testing.T, ctx context.Context, namespace string, f *fr t.Run("TestApisDcsRestarted", func(t *testing.T) { testStargateApis(t, f, ctx, f.DataPlaneContexts[0], namespace, dc1Prefix, username, password, false, map[string]int{DcName(t, f, dc1Key): 1, DcName(t, f, dc2Key): 1}) - testStargateApis(t, f, ctx, f.DataPlaneContexts[1], namespace, dc2Prefix, username, password, false, map[string]int{DcName(t, f, dc1Key): 1, DcName(t, f, dc2Key): 1}) + testStargateApis(t, f, ctx, f.DataPlaneContexts[1], namespace, reaperStargate2Prefix, username, password, false, map[string]int{DcName(t, f, dc1Key): 1, DcName(t, f, dc2Key): 1}) uiKey := framework.NewClusterKey(f.DataPlaneContexts[0], namespace, reaper.DefaultUiSecretName("cluster1")) uiUsername, uiPassword := retrieveCredentials(t, f, ctx, uiKey) testReaperApi(t, ctx, f.DataPlaneContexts[0], "cluster1", reaperapi.DefaultKeyspace, uiUsername, uiPassword)