Skip to content

Commit e54361e

Browse files
committed
fix: consolidate catalog naming
1 parent 3389aca commit e54361e

3 files changed

Lines changed: 16 additions & 7 deletions

File tree

rust/operator-binary/src/controller/build/resource/config_map.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,7 @@ pub fn build_rolegroup_catalog_config_map(
202202
role_group_name: &str,
203203
recommended_labels: &Labels,
204204
) -> Result<ConfigMap> {
205-
let catalog_config_map_name = format!(
206-
"{}-catalog",
207-
cluster
208-
.resource_names(role, role_group_name)
209-
.role_group_config_map()
210-
);
205+
let catalog_config_map_name = cluster.role_group_catalog_config_map_name(role, role_group_name);
211206
ConfigMapBuilder::new()
212207
.metadata(
213208
cluster

rust/operator-binary/src/controller/build/resource/statefulset.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ pub fn build_rolegroup_statefulset(
409409
.add_volume(Volume {
410410
name: CATALOG_VOLUME_NAME.to_string(),
411411
config_map: Some(ConfigMapVolumeSource {
412-
name: format!("{config_map_name}-catalog"),
412+
name: cluster.role_group_catalog_config_map_name(trino_role, role_group_name),
413413
..ConfigMapVolumeSource::default()
414414
}),
415415
..Volume::default()

rust/operator-binary/src/controller/mod.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,20 @@ impl ValidatedCluster {
198198
}
199199
}
200200

201+
/// Name of the rolegroup's catalog [`ConfigMap`], derived from the rolegroup config map name
202+
/// by appending the `-catalog` suffix.
203+
pub(crate) fn role_group_catalog_config_map_name(
204+
&self,
205+
role: &TrinoRole,
206+
role_group_name: &str,
207+
) -> String {
208+
format!(
209+
"{}-catalog",
210+
self.resource_names(role, role_group_name)
211+
.role_group_config_map()
212+
)
213+
}
214+
201215
/// Returns an [`ObjectMetaBuilder`] pre-filled with this cluster's namespace, an owner
202216
/// reference back to the cluster, the resource `name` and the given `recommended_labels`.
203217
///

0 commit comments

Comments
 (0)