Preserve probe handler configuration for mTLS#951
Open
ossarga wants to merge 1 commit into
Open
Conversation
* Preserves probe configuration when mTLS is enabled * Extracts management API port from container port specification * Default probes are initialised using host and port values set for management API * Checks the probe handlers to ensure only one of the four probe mechanisms is set * Updated built pod host function to use new port resolution logic
ossarga
commented
Jul 14, 2026
Comment on lines
+222
to
+229
| func GetMgmtApiPortFromContainer(container *corev1.Container) int { | ||
| for _, port := range container.Ports { | ||
| if port.Name == "mgmt-api-http" { | ||
| return int(port.ContainerPort) | ||
| } | ||
| } | ||
| return MgmtApiTargetPort | ||
| } |
Author
There was a problem hiding this comment.
@adejanovski this is needed for another fix I am going to raise for the k8ssandra-operator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change Summary
Fixes #950
Testing
Unit tests were updated and executed on the latest changes. Details are as follows.
Total Tests Run: 27
Status: 27 PASSED
Change Details
This change helps simplify probe configuration particularly when enabling mTLS.
The following explains how to configure the Management API port and its relationship to Kubernetes probe configurations.
Steps to Configure a Custom Management API Port
By default, the Management API listens on port 8080 and uses the port name
mgmt-api-http.The following steps can be used to specify a custom port for the Management API
Step 1: Define the Port in PodTemplateSpec
To use a custom Management API port, the value must be defined in the
cassandracontainer's port specifications within the CassandraDatacenter manifest:mgmt-api-httpfor the operator to correctly identify and use it.Step 2: Update Probe Configurations
If custom liveness or readiness probes are in use, the port can be specified using the Kubernetes name reference. To use a named port reference, the custom probes must be defined in the
podTemplateSpec.spec.containers[].livenessProbeorreadinessProbeconfiguration.In the following Custom Resource Definition (CRD) for a CassandraDatacenter, the
portvalues for thelivenessProbeandreadinessProbeare set to the mgmt-api-http named value.In the above case the port value for the probes will reference the
cassandracontainer'scontainerPortvalue.The cass-operator resolves the Management API port using the following logic:
mgmt-api-httpin the container's port listmgmt-api-httpis undefinedExample
The following CassandraDatacenter CRD defines a Custom Port with mTLS