Skip to content

Commit 5210423

Browse files
committed
refactor: use v2 container builder
1 parent 1d92b97 commit 5210423

1 file changed

Lines changed: 8 additions & 20 deletions

File tree

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

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use stackable_operator::{
2424
kvp::Labels,
2525
product_logging,
2626
v2::{
27-
builder::pod::container::EnvVarSet,
27+
builder::pod::container::{EnvVarSet, new_container_builder},
2828
product_logging::framework::{ValidatedContainerLogConfigChoice, vector_container},
2929
role_group_utils::ResourceNames,
3030
types::{
@@ -64,12 +64,6 @@ const USERDATA_MOUNTPOINT: &str = "/stackable/userdata";
6464

6565
#[derive(Snafu, Debug)]
6666
pub enum Error {
67-
#[snafu(display("failed to create container builder with name [{name}]"))]
68-
FailedContainerBuilderCreation {
69-
source: stackable_operator::builder::pod::container::Error,
70-
name: String,
71-
},
72-
7367
#[snafu(display("failed to configure graceful shutdown"))]
7468
GracefulShutdown {
7569
source: crate::operations::graceful_shutdown::Error,
@@ -146,19 +140,13 @@ pub fn build_rolegroup_statefulset(
146140
let druid_tls_security = &cluster.cluster_config.druid_tls_security;
147141
let druid_auth_config = &cluster.cluster_config.druid_auth_config;
148142
// prepare container builder
149-
let prepare_container_name = Container::Prepare.to_string();
150-
let mut cb_prepare = ContainerBuilder::new(&prepare_container_name).context(
151-
FailedContainerBuilderCreationSnafu {
152-
name: &prepare_container_name,
153-
},
154-
)?;
143+
let prepare_container_name = ContainerName::from_str(&Container::Prepare.to_string())
144+
.expect("'prepare' is a valid container name");
145+
let mut cb_prepare = new_container_builder(&prepare_container_name);
155146
// druid container builder
156-
let druid_container_name = Container::Druid.to_string();
157-
let mut cb_druid = ContainerBuilder::new(&druid_container_name).context(
158-
FailedContainerBuilderCreationSnafu {
159-
name: &druid_container_name,
160-
},
161-
)?;
147+
let druid_container_name = ContainerName::from_str(&Container::Druid.to_string())
148+
.expect("'druid' is a valid container name");
149+
let mut cb_druid = new_container_builder(&druid_container_name);
162150
// init pod builder
163151
let mut pb = PodBuilder::new();
164152
pb.affinity(&merged_rolegroup_config.affinity);
@@ -182,7 +170,7 @@ pub fn build_rolegroup_statefulset(
182170
// otherwise the output of the following commands will not be captured!
183171
prepare_container_commands.push(product_logging::framework::capture_shell_output(
184172
STACKABLE_LOG_DIR,
185-
&prepare_container_name,
173+
prepare_container_name.as_ref(),
186174
log_config,
187175
));
188176
}

0 commit comments

Comments
 (0)