Skip to content

Commit 3f28598

Browse files
xeniapesbernauer
andauthored
refactor: Don't modify ContainerBuilder after it has been build (#838)
* fix: propagate auth volumeMounts to nifi container * remove nifi container from auth config mount * move code to previous place * bump url crate version * Update rust/operator-binary/src/controller.rs Co-authored-by: Sebastian Bernauer <[email protected]> --------- Co-authored-by: Sebastian Bernauer <[email protected]>
1 parent c1f9133 commit 3f28598

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.nix

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ snafu = "0.8"
3131
strum = { version = "0.27", features = ["derive"] }
3232
tokio = { version = "1.40", features = ["full"] }
3333
tracing = "0.1"
34-
url = { version = "2.5.2" }
34+
url = { version = "2.5.7" }
3535
xml-rs = "0.8"
3636

3737
# [patch."https://github.com/stackabletech/operator-rs.git"]

rust/operator-binary/src/controller.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,11 +1064,12 @@ async fn build_node_rolegroup_statefulset(
10641064
);
10651065

10661066
let nifi_container_name = Container::Nifi.to_string();
1067-
let mut container_builder = ContainerBuilder::new(&nifi_container_name).with_context(|_| {
1068-
IllegalContainerNameSnafu {
1069-
container_name: nifi_container_name,
1070-
}
1071-
})?;
1067+
let mut container_nifi_builder =
1068+
ContainerBuilder::new(&nifi_container_name).with_context(|_| {
1069+
IllegalContainerNameSnafu {
1070+
container_name: nifi_container_name,
1071+
}
1072+
})?;
10721073

10731074
let nifi_args = vec![formatdoc! {"
10741075
{COMMON_BASH_TRAP_FUNCTIONS}
@@ -1084,7 +1085,7 @@ async fn build_node_rolegroup_statefulset(
10841085
create_vector_shutdown_file_command =
10851086
create_vector_shutdown_file_command(STACKABLE_LOG_DIR),
10861087
}];
1087-
let container_nifi = container_builder
1088+
let container_nifi = container_nifi_builder
10881089
.image_from_product_image(resolved_product_image)
10891090
.command(vec![
10901091
"/bin/bash".to_string(),
@@ -1226,6 +1227,8 @@ async fn build_node_rolegroup_statefulset(
12261227

12271228
// We want to add nifi container first for easier defaulting into this container
12281229
pod_builder.add_container(container_nifi.build());
1230+
// After calling `build()` the ContainerBuilder shouldn't be used anymore, so we drop it
1231+
drop(container_nifi_builder);
12291232

12301233
for container in git_sync_resources.git_sync_containers.iter().cloned() {
12311234
pod_builder.add_container(container);
@@ -1294,10 +1297,7 @@ async fn build_node_rolegroup_statefulset(
12941297
}
12951298

12961299
authentication_config
1297-
.add_volumes_and_mounts(
1298-
&mut pod_builder,
1299-
vec![&mut container_prepare, container_nifi],
1300-
)
1300+
.add_volumes_and_mounts(&mut pod_builder, vec![&mut container_prepare])
13011301
.context(AddAuthVolumesSnafu)?;
13021302

13031303
let metadata = ObjectMetaBuilder::new()

0 commit comments

Comments
 (0)