Skip to content

Commit f108bad

Browse files
committed
fix: use loop for mkdir, remove clone
1 parent 7754cd4 commit f108bad

2 files changed

Lines changed: 11 additions & 8 deletions

File tree

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

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@ pub enum Error {
142142
source: stackable_operator::builder::pod::container::Error,
143143
},
144144

145+
#[snafu(display("failed to convert the User Info Fetcher Kerberos SecretClass into a volume"))]
146+
ConvertUserInfoFetcherKerberosSecretClassVolume {
147+
source: stackable_operator::commons::secret_class::SecretClassVolumeError,
148+
},
149+
145150
#[snafu(display(
146151
"failed to build volume or volume mount spec for the User Info Fetcher TLS config"
147152
))]
@@ -478,7 +483,7 @@ pub fn build_server_rolegroup_daemonset(
478483
// The user-info-fetcher needs both the keytab (private) and the Kerberos config (public).
479484
SecretClassVolumeProvisionParts::PublicPrivate,
480485
)
481-
.unwrap(),
486+
.context(ConvertUserInfoFetcherKerberosSecretClassVolumeSnafu)?,
482487
)
483488
.context(UserInfoFetcherKerberosVolumeSnafu)?;
484489
cb_user_info_fetcher
@@ -834,12 +839,10 @@ fn build_prepare_start_command(
834839
));
835840
}
836841

837-
prepare_container_args.push(format!("echo \"Create dir [{BUNDLES_ACTIVE_DIR}]\""));
838-
prepare_container_args.push(format!("mkdir -p {BUNDLES_ACTIVE_DIR}"));
839-
prepare_container_args.push(format!("echo \"Create dir [{BUNDLES_INCOMING_DIR}]\""));
840-
prepare_container_args.push(format!("mkdir -p {BUNDLES_INCOMING_DIR}"));
841-
prepare_container_args.push(format!("echo \"Create dir [{BUNDLES_TMP_DIR}]\""));
842-
prepare_container_args.push(format!("mkdir -p {BUNDLES_TMP_DIR}"));
842+
for dir in [BUNDLES_ACTIVE_DIR, BUNDLES_INCOMING_DIR, BUNDLES_TMP_DIR] {
843+
prepare_container_args.push(format!("echo \"Create dir [{dir}]\""));
844+
prepare_container_args.push(format!("mkdir -p {dir}"));
845+
}
843846

844847
prepare_container_args
845848
}

rust/operator-binary/src/opa_controller.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ pub async fn reconcile_opa(
200200
build_rbac_resources(opa, APP_NAME, required_labels).context(BuildRbacResourcesSnafu)?;
201201

202202
let rbac_sa = cluster_resources
203-
.add(client, rbac_sa.clone())
203+
.add(client, rbac_sa)
204204
.await
205205
.context(ApplyServiceAccountSnafu)?;
206206
cluster_resources

0 commit comments

Comments
 (0)