Skip to content

Reaper hardcodes CQL port 9042 in REAPER_CASS_CONTACT_POINTS; breaks when NodePort is enabled #1739

Description

@LipatovAlexander

Originally reported by a user in #1144 (NodePort enabled, Reaper keeps connecting to :9042, "I do not see any way to set up the custom port for reaper").

Bug

The Reaper Deployment hardcodes the Cassandra CQL port 9042 in the REAPER_CASS_CONTACT_POINTS environment variable. When a K8ssandraCluster/CassandraDatacenter enables NodePort (networking.nodePort.native, e.g. 30942), cass-operator moves Cassandra's native_transport_port to the configured NodePort value, so 9042 is no longer listening.

As a result Reaper (v4+) cannot connect to its storage Cassandra: it fails to initialize the reaper_db schema, never becomes ready, and crash-loops on its :8081 liveness probe.

Where

pkg/reaper/deployment.go, computeEnvVars, the isReaperPostV4 branch:

envVars = append(envVars, corev1.EnvVar{
    Name:  "REAPER_CASS_CONTACT_POINTS",
    Value: fmt.Sprintf("[{\"host\": \"%s\", \"port\": 9042}]", dc.GetDatacenterServiceName()),
})

This is still present on main.

Expected

The contact-point port should follow the datacenter, the same way cass-operator derives it for its own services in pkg/reconciliation/construct_service.go:

nativePort := cassdcapi.DefaultNativePort
if dc.IsNodePortEnabled() {
    nativePort = dc.GetNodePortNativePort()
}

Reproduce

Deploy a K8ssandraCluster with cassandra.networking.nodePort.native: 30942 and Reaper enabled → Reaper crash-loops with connection-refused to :9042.

Fix

PR follows: derive the native port via dc.IsNodePortEnabled() / dc.GetNodePortNativePort(), falling back to cassdcapi.DefaultNativePort (9042). Backward compatible for non-NodePort clusters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions