Skip to content
Merged
3 changes: 3 additions & 0 deletions crates/stackable-operator/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ All notable changes to this project will be documented in this file.
fieldPath: spec.nodeName
```

- Methods on RoleGroupRef to return the rolegroup service `-headless` and `-metrics` name ([#1069]).

### Changed

- Update `kube` to `1.1.0` ([#1049]).
Expand All @@ -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
Expand Down
21 changes: 21 additions & 0 deletions crates/stackable-operator/src/role_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,27 @@ impl<K: Resource> RoleGroupRef<K> {
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<K: Resource> Display for RoleGroupRef<K> {
Expand Down