Skip to content

Commit 9b103e9

Browse files
MalewareTechassisbernauer
authored
feat(stackable-operator): Add headless/metrics service name functions to RoleGroupRef (#1069)
* Add metrics and headless service name functions to RoleGroupRef * Better descriptions suggested by reviewer Co-authored-by: Techassi <[email protected]> * Update Changelog.md * Fixing markdown lint * Pre-commit is happy now * Update crates/stackable-operator/CHANGELOG.md Co-authored-by: Techassi <[email protected]> --------- Co-authored-by: Techassi <[email protected]> Co-authored-by: Sebastian Bernauer <[email protected]>
1 parent 4ca1c0d commit 9b103e9

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

crates/stackable-operator/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ All notable changes to this project will be documented in this file.
3131
fieldPath: spec.nodeName
3232
```
3333

34+
- Add associated functions on `RoleGroupRef` to return the rolegroup headless and metrics service name ([#1069]).
35+
3436
### Changed
3537

3638
- Update `kube` to `1.1.0` ([#1049]).
@@ -51,6 +53,7 @@ All notable changes to this project will be documented in this file.
5153
[#1060]: https://github.com/stackabletech/operator-rs/pull/1060
5254
[#1064]: https://github.com/stackabletech/operator-rs/pull/1064
5355
[#1068]: https://github.com/stackabletech/operator-rs/pull/1068
56+
[#1069]: https://github.com/stackabletech/operator-rs/pull/1069
5457
[#1071]: https://github.com/stackabletech/operator-rs/pull/1071
5558

5659
## [0.93.2] - 2025-05-26

crates/stackable-operator/src/role_utils.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,27 @@ impl<K: Resource> RoleGroupRef<K> {
472472
pub fn object_name(&self) -> String {
473473
format!("{}-{}-{}", self.cluster.name, self.role, self.role_group)
474474
}
475+
476+
/// Returns the service name used by rolegroups for cluster internal communication only.
477+
///
478+
/// The internal use of of this service name is indicated by the `-headless` suffix.
479+
/// This service should not be used for communication to external services or clients
480+
/// and also should not be used to export metrics (like Prometheus). Metrics should be
481+
/// instead exposed via a dedicated service. Use [`Self::rolegroup_metrics_service_name`]
482+
/// instead.
483+
pub fn rolegroup_headless_service_name(&self) -> String {
484+
format!("{name}-headless", name = self.object_name())
485+
}
486+
487+
/// Returns the service name used by rolegroups to expose metrics (like Prometheus).
488+
///
489+
/// The use for metrics only is indicated by the `-metrics` suffix. This service
490+
/// should not be used for any internal communication or any other external
491+
/// communication. For internal communication, use [`Self::rolegroup_headless_service_name`]
492+
/// instead.
493+
pub fn rolegroup_metrics_service_name(&self) -> String {
494+
format!("{name}-metrics", name = self.object_name())
495+
}
475496
}
476497

477498
impl<K: Resource> Display for RoleGroupRef<K> {

0 commit comments

Comments
 (0)