Skip to content

Commit e812aba

Browse files
committed
refactor: Decouple StatefulSet builder from applied ServiceAccount
1 parent fdca79f commit e812aba

2 files changed

Lines changed: 5 additions & 8 deletions

File tree

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

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,10 @@ use stackable_operator::{
55
builder::pod::{PodBuilder, security::PodSecurityContextBuilder},
66
k8s_openapi::{
77
DeepMerge,
8-
api::{
9-
apps::v1::{StatefulSet, StatefulSetSpec},
10-
core::v1::ServiceAccount,
11-
},
8+
api::apps::v1::{StatefulSet, StatefulSetSpec},
129
apimachinery::pkg::apis::meta::v1::LabelSelector,
1310
},
14-
kube::{ResourceExt, api::ObjectMeta},
11+
kube::api::ObjectMeta,
1512
kvp::{LabelError, Labels},
1613
utils::cluster_info::KubernetesClusterInfo,
1714
v2::types::operator::RoleGroupName,
@@ -50,7 +47,7 @@ pub(crate) fn build_rolegroup_statefulset(
5047
role: &HdfsNodeRole,
5148
role_group_name: &RoleGroupName,
5249
rolegroup_config: &ValidatedRoleGroupConfig,
53-
service_account: &ServiceAccount,
50+
service_account_name: &str,
5451
) -> Result<StatefulSet, Error> {
5552
tracing::info!("Setting up StatefulSet for role {role} role group {role_group_name}");
5653

@@ -72,7 +69,7 @@ pub(crate) fn build_rolegroup_statefulset(
7269
pb.metadata(pb_metadata)
7370
.image_pull_secrets_from_product_image(image)
7471
.affinity(&merged_config.affinity)
75-
.service_account_name(service_account.name_any())
72+
.service_account_name(service_account_name)
7673
.security_context(PodSecurityContextBuilder::new().fs_group(1000).build());
7774

7875
// Adds all containers and volumes to the pod builder

rust/operator-binary/src/hdfs_controller.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ pub async fn reconcile_hdfs(
269269
&role,
270270
rolegroup_name,
271271
validated_cluster_rg_config,
272-
&rbac_sa,
272+
&rbac_sa.name_any(),
273273
)
274274
.context(BuildRoleGroupStatefulSetSnafu)?;
275275

0 commit comments

Comments
 (0)