Skip to content

Commit

Permalink
K8OP-295 Expose Medusa's gRPC server port configuration (#1456)
Browse files Browse the repository at this point in the history
* K8OP-295 Expose Medusa's gRPC server port configuration

* Fix indentation in medusa config map

* Update pkg/medusa/reconcile.go

Co-authored-by: Alexander Dejanovski <[email protected]>

* Extract making medusa address to a functin

* Disable the execution of HCD e2e test in CI

---------

Co-authored-by: Alexander Dejanovski <[email protected]>
  • Loading branch information
rzvoncek and adejanovski committed Jan 24, 2025
1 parent 4772eb1 commit df3017b
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG/CHANGELOG-1.21.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ When cutting a new release, update the `unreleased` heading to the tag being gen
* [BUGFIX] [#1460](https://github.com/k8ssandra/k8ssandra-operator/issues/1460) Fix podName calculations in medusa's hostmap.go to account for unbalanced racks also
* [BUGFIX] [#1466](https://github.com/k8ssandra/k8ssandra-operator/issues/1466) Do not overwrite existing status fields or forget to write the changes. Also, add new ContextName for the Datacenter to know where it used to be.
* [ENHANCEMENT] [#1455](https://github.com/k8ssandra/k8ssandra-operator/issues/1455) Expose configuration of Medusa's gRPC server port
* [BUGFIX] [#1471](https://github.com/k8ssandra/k8ssandra-operator/issues/1471) Use namespaced service name when registering k8ssandra cluster to Reaper
3 changes: 2 additions & 1 deletion pkg/reaper/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ func (r *restReaperManager) connect(ctx context.Context, reaperSvc, username, pa
}

func (r *restReaperManager) AddClusterToReaper(ctx context.Context, cassdc *cassdcapi.CassandraDatacenter) error {
return r.reaperClient.AddCluster(ctx, cassdcapi.CleanupForKubernetes(cassdc.Spec.ClusterName), cassdc.GetSeedServiceName())
namespacedServiceName := cassdc.GetSeedServiceName() + "." + cassdc.Namespace
return r.reaperClient.AddCluster(ctx, cassdcapi.CleanupForKubernetes(cassdc.Spec.ClusterName), namespacedServiceName)
}

func (r *restReaperManager) VerifyClusterIsConfigured(ctx context.Context, cassdc *cassdcapi.CassandraDatacenter) (bool, error) {
Expand Down
21 changes: 21 additions & 0 deletions test/e2e/cluster_scope_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ func multiDcMultiCluster(t *testing.T, ctx context.Context, klusterNamespace str

dc1Namespace := "test-1"
dc2Namespace := "test-2"
reaperNamespace := "test-0"

t.Log("check that the K8ssandraCluster was created")
k8ssandra := &api.K8ssandraCluster{}
Expand Down Expand Up @@ -84,4 +85,24 @@ func multiDcMultiCluster(t *testing.T, ctx context.Context, klusterNamespace str
t.Log("check nodes in dc2 see nodes in dc1")
pod = DcPrefix(t, f, dc2Key) + "-rack1-sts-0"
checkNodeToolStatus(t, f, f.DataPlaneContexts[1], dc2Namespace, pod, count, 0, "-u", username, "-pw", password)

t.Log("check that cluster was registered in Reaper")
reaperKey := framework.ClusterKey{K8sContext: f.ControlPlaneContext, NamespacedName: types.NamespacedName{Namespace: reaperNamespace, Name: "reaper1"}}
dcKey := framework.ClusterKey{K8sContext: f.DataPlaneContexts[0], NamespacedName: types.NamespacedName{Namespace: dc1Namespace, Name: "dc1"}}
dcPrefix := DcPrefix(t, f, dcKey)
checkReaperReady(t, f, ctx, reaperKey)
createKeyspaceAndTable(t, f, ctx, f.DataPlaneContexts[0], dc1Namespace, k8ssandra.Name, dcPrefix+"-rack1-sts-0", "test_ks", "test_table", 2)

t.Log("deploying Reaper ingress routes in context", f.ControlPlaneContext)
reaperRestHostAndPort := ingressConfigs[f.ControlPlaneContext].ReaperRest
f.DeployReaperIngresses(t, f.ControlPlaneContext, k8ssandra.Namespace, "reaper1-service", reaperRestHostAndPort)
defer f.UndeployAllIngresses(t, f.ControlPlaneContext, k8ssandra.Namespace)
checkReaperApiReachable(t, ctx, reaperRestHostAndPort)

t.Run("TestReaperApi[0]", func(t *testing.T) {
t.Log("test Reaper API in context", f.ControlPlaneContext)
secretKey := framework.ClusterKey{K8sContext: f.ControlPlaneContext, NamespacedName: types.NamespacedName{Namespace: k8ssandra.Namespace, Name: "reaper-ui-secret"}}
username, password := retrieveCredentials(t, f, ctx, secretKey)
testReaperApi(t, ctx, f.ControlPlaneContext, DcClusterName(t, f, dcKey), "test_ks", username, password)
})
}
7 changes: 7 additions & 0 deletions test/testdata/fixtures/multi-dc-cluster-scope/k8ssandra.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ spec:
concurrent_writes: 2
concurrent_counter_writes: 2
jvmOptions:
cassandra_ring_delay_ms: 0
heapSize: 512Mi
heapNewGenSize: 256Mi
gc: CMS
Expand Down Expand Up @@ -69,3 +70,9 @@ spec:
nodeAffinityLabels:
"topology.kubernetes.io/zone": region2-zone2
mgmtAPIHeap: 64Mi
reaper:
reaperRef:
name: reaper1
namespace: test-0
uiUserSecretRef:
name: reaper-ui-secret
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- medusa-config.yaml
- reaper.yaml
- k8ssandra.yaml
29 changes: 29 additions & 0 deletions test/testdata/fixtures/multi-dc-cluster-scope/reaper.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: v1
kind: Secret
metadata:
name: reaper-ui-secret
data:
# username: reaper-jmx (actually)
username: cmVhcGVyLWpteA==
# password: R3ap3r
password: UjNhcDNy
---
apiVersion: reaper.k8ssandra.io/v1alpha1
kind: Reaper
metadata:
name: reaper1
spec:
storageType: local
storageConfig:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 256Mi
httpManagement:
enabled: true
heapSize: 256Mi
autoScheduling:
enabled: false
uiUserSecretRef:
name: reaper-ui-secret

0 comments on commit df3017b

Please sign in to comment.