Skip to content

Commit 2bf6107

Browse files
committed
rename resource name functions, remove patch reference
1 parent be4f296 commit 2bf6107

9 files changed

Lines changed: 30 additions & 14 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ indoc = "2"
3131
regex = "1.12"
3232

3333
[patch."https://github.com/stackabletech/operator-rs.git"]
34-
stackable-operator = { git = "https://github.com/stackabletech//operator-rs.git", branch="feat/smooth-operator/build-rbac" }
34+
# stackable-operator = { git = "https://github.com/stackabletech//operator-rs.git", branch="feat/smooth-operator/build-rbac" }
3535
# stackable-operator = { path = "../operator-rs/crates/stackable-operator" }

rust/operator-binary/src/connect/controller/build/rbac.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,19 @@ stackable_operator::constant!(NONE_ROLE_NAME: RoleName = "none");
1717
stackable_operator::constant!(NONE_ROLE_GROUP_NAME: RoleGroupName = "none");
1818

1919
pub fn build_service_account(server: &ValidatedSparkConnectServer) -> ServiceAccount {
20-
rbac::build_service_account(server, &server.rbac_resource_names(), rbac_labels(server))
20+
rbac::build_service_account(
21+
server,
22+
&server.cluster_resource_names(),
23+
rbac_labels(server),
24+
)
2125
}
2226

2327
pub fn build_role_binding(server: &ValidatedSparkConnectServer) -> RoleBinding {
24-
rbac::build_role_binding(server, &server.rbac_resource_names(), rbac_labels(server))
28+
rbac::build_role_binding(
29+
server,
30+
&server.cluster_resource_names(),
31+
rbac_labels(server),
32+
)
2533
}
2634

2735
fn rbac_labels(server: &ValidatedSparkConnectServer) -> Labels {

rust/operator-binary/src/connect/controller/build/server.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ pub(crate) fn build_stateful_set(
190190

191191
let mut pb = PodBuilder::new();
192192

193-
pb.service_account_name(validated.rbac_resource_names().service_account_name())
193+
pb.service_account_name(validated.cluster_resource_names().service_account_name())
194194
.metadata(metadata)
195195
.image_pull_secrets_from_product_image(resolved_product_image)
196196
.add_volume(
@@ -403,7 +403,7 @@ pub(crate) fn server_properties(
403403
let resolved_product_image = &validated.resolved_product_image;
404404
let spark_image = resolved_product_image.image.clone();
405405
let spark_version = resolved_product_image.product_version.clone();
406-
let service_account_name = validated.rbac_resource_names().service_account_name();
406+
let service_account_name = validated.cluster_resource_names().service_account_name();
407407
let namespace = driver_service
408408
.namespace()
409409
.context(ObjectHasNoNamespaceSnafu)?;

rust/operator-binary/src/connect/controller/validate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ impl ValidatedSparkConnectServer {
237237

238238
/// Type-safe names for the per-cluster RBAC resources: the ServiceAccount,
239239
/// its (namespaced) RoleBinding, and the operator-deployed ClusterRole it binds.
240-
pub fn rbac_resource_names(&self) -> role_utils::ResourceNames {
240+
pub fn cluster_resource_names(&self) -> role_utils::ResourceNames {
241241
role_utils::ResourceNames {
242242
cluster_name: self.name.clone(),
243243
product_name: product_name(),

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub(crate) fn build_config_map(
5555
rg: &ValidatedHistoryRoleGroup,
5656
) -> Result<ConfigMap> {
5757
let cm_name = validated
58-
.resource_names(role_group_name)
58+
.role_group_resource_names(role_group_name)
5959
.role_group_config_map()
6060
.to_string();
6161

rust/operator-binary/src/history/controller/build/resource/rbac.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,19 @@ stackable_operator::constant!(NONE_ROLE_NAME: RoleName = "none");
1717
stackable_operator::constant!(NONE_ROLE_GROUP_NAME: RoleGroupName = "none");
1818

1919
pub fn build_service_account(server: &ValidatedSparkHistoryServer) -> ServiceAccount {
20-
rbac::build_service_account(server, &server.rbac_resource_names(), rbac_labels(server))
20+
rbac::build_service_account(
21+
server,
22+
&server.cluster_resource_names(),
23+
rbac_labels(server),
24+
)
2125
}
2226

2327
pub fn build_role_binding(server: &ValidatedSparkHistoryServer) -> RoleBinding {
24-
rbac::build_role_binding(server, &server.rbac_resource_names(), rbac_labels(server))
28+
rbac::build_role_binding(
29+
server,
30+
&server.cluster_resource_names(),
31+
rbac_labels(server),
32+
)
2533
}
2634

2735
fn rbac_labels(server: &ValidatedSparkHistoryServer) -> Labels {

rust/operator-binary/src/history/controller/build/resource/service.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub fn build_rolegroup_metrics_service(
1919
metadata: validated
2020
.object_meta(
2121
validated
22-
.resource_names(role_group_name)
22+
.role_group_resource_names(role_group_name)
2323
.metrics_service_name()
2424
.to_string(),
2525
role_group_name,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ pub(crate) fn build_stateful_set(
8585
log_dir: &ResolvedLogDir,
8686
) -> Result<StatefulSet> {
8787
let resolved_product_image = &validated.resolved_product_image;
88-
let resource_names = validated.resource_names(role_group_name);
88+
let resource_names = validated.role_group_resource_names(role_group_name);
8989

9090
let log_config_map = if let Some(ContainerLogConfig {
9191
choice:
@@ -119,7 +119,7 @@ pub(crate) fn build_stateful_set(
119119
.context(MissingSecretLifetimeSnafu)?;
120120
pb.service_account_name(
121121
validated
122-
.rbac_resource_names()
122+
.cluster_resource_names()
123123
.service_account_name()
124124
.to_string(),
125125
)

rust/operator-binary/src/history/controller/validate.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,15 +204,15 @@ impl ValidatedSparkHistoryServer {
204204

205205
/// Type-safe names for the per-cluster RBAC resources: the ServiceAccount,
206206
/// its (namespaced) RoleBinding, and the operator-deployed ClusterRole it binds.
207-
pub fn rbac_resource_names(&self) -> role_utils::ResourceNames {
207+
pub fn cluster_resource_names(&self) -> role_utils::ResourceNames {
208208
role_utils::ResourceNames {
209209
cluster_name: self.name.clone(),
210210
product_name: product_name(),
211211
}
212212
}
213213

214214
/// Type-safe names for the resources of a given role group.
215-
pub fn resource_names(&self, role_group_name: &RoleGroupName) -> ResourceNames {
215+
pub fn role_group_resource_names(&self, role_group_name: &RoleGroupName) -> ResourceNames {
216216
ResourceNames {
217217
cluster_name: self.name.clone(),
218218
role_name: Self::role_name(),

0 commit comments

Comments
 (0)