Skip to content

Commit

Permalink
Some logging, some prefix changes
Browse files Browse the repository at this point in the history
  • Loading branch information
burmanm committed Nov 27, 2024
1 parent a8af6d0 commit 8d0f568
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 20 deletions.
1 change: 1 addition & 0 deletions controllers/k8ssandra/schemas.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 13 additions & 12 deletions test/e2e/reaper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
17 changes: 9 additions & 8 deletions test/e2e/stop_dc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 8d0f568

Please sign in to comment.