diff --git a/crates/stackable-operator/CHANGELOG.md b/crates/stackable-operator/CHANGELOG.md index 709d7d81..101f9ba3 100644 --- a/crates/stackable-operator/CHANGELOG.md +++ b/crates/stackable-operator/CHANGELOG.md @@ -31,6 +31,8 @@ All notable changes to this project will be documented in this file. fieldPath: spec.nodeName ``` +- Add associated functions on `RoleGroupRef` to return the rolegroup headless and metrics service name ([#1069]). + ### Changed - Update `kube` to `1.1.0` ([#1049]). @@ -51,6 +53,7 @@ All notable changes to this project will be documented in this file. [#1060]: https://github.com/stackabletech/operator-rs/pull/1060 [#1064]: https://github.com/stackabletech/operator-rs/pull/1064 [#1068]: https://github.com/stackabletech/operator-rs/pull/1068 +[#1069]: https://github.com/stackabletech/operator-rs/pull/1069 [#1071]: https://github.com/stackabletech/operator-rs/pull/1071 ## [0.93.2] - 2025-05-26 diff --git a/crates/stackable-operator/src/role_utils.rs b/crates/stackable-operator/src/role_utils.rs index fcd8b4df..704b81a0 100644 --- a/crates/stackable-operator/src/role_utils.rs +++ b/crates/stackable-operator/src/role_utils.rs @@ -472,6 +472,27 @@ impl RoleGroupRef { pub fn object_name(&self) -> String { format!("{}-{}-{}", self.cluster.name, self.role, self.role_group) } + + /// Returns the service name used by rolegroups for cluster internal communication only. + /// + /// The internal use of of this service name is indicated by the `-headless` suffix. + /// This service should not be used for communication to external services or clients + /// and also should not be used to export metrics (like Prometheus). Metrics should be + /// instead exposed via a dedicated service. Use [`Self::rolegroup_metrics_service_name`] + /// instead. + pub fn rolegroup_headless_service_name(&self) -> String { + format!("{name}-headless", name = self.object_name()) + } + + /// Returns the service name used by rolegroups to expose metrics (like Prometheus). + /// + /// The use for metrics only is indicated by the `-metrics` suffix. This service + /// should not be used for any internal communication or any other external + /// communication. For internal communication, use [`Self::rolegroup_headless_service_name`] + /// instead. + pub fn rolegroup_metrics_service_name(&self) -> String { + format!("{name}-metrics", name = self.object_name()) + } } impl Display for RoleGroupRef {