@@ -4,7 +4,6 @@ use stackable_operator::{
44 meta:: ObjectMetaBuilder ,
55 pod:: {
66 PodBuilder ,
7- container:: ContainerBuilder ,
87 resources:: ResourceRequirementsBuilder ,
98 security:: PodSecurityContextBuilder ,
109 volume:: {
@@ -25,7 +24,10 @@ use stackable_operator::{
2524 kube:: { ResourceExt , api:: ObjectMeta } ,
2625 kvp:: { Annotation , Label , LabelError } ,
2726 utils:: COMMON_BASH_TRAP_FUNCTIONS ,
28- v2:: { builder:: meta:: ownerreference_from_resource, types:: operator:: RoleGroupName } ,
27+ v2:: {
28+ builder:: { meta:: ownerreference_from_resource, pod:: container:: new_container_builder} ,
29+ types:: operator:: RoleGroupName ,
30+ } ,
2931} ;
3032
3133use crate :: {
@@ -46,19 +48,14 @@ use crate::{
4648 controller_commons:: { self , CONFIG_VOLUME_NAME , LOG_CONFIG_VOLUME_NAME , LOG_VOLUME_NAME } ,
4749 crd:: {
4850 AirflowExecutor , AirflowRole , CONFIG_PATH , Container , HTTP_PORT_NAME , LISTENER_VOLUME_DIR ,
49- LISTENER_VOLUME_NAME , LOG_CONFIG_DIR , METRICS_PORT , METRICS_PORT_NAME , STACKABLE_LOG_DIR ,
50- TEMPLATE_LOCATION , TEMPLATE_VOLUME_NAME ,
51+ LISTENER_VOLUME_NAME , LOG_CONFIG_DIR , METRICS_CONTAINER_NAME , METRICS_PORT ,
52+ METRICS_PORT_NAME , STACKABLE_LOG_DIR , TEMPLATE_LOCATION , TEMPLATE_VOLUME_NAME ,
5153 } ,
5254} ;
5355
5456#[ derive( Snafu , Debug ) ]
5557#[ snafu( visibility( pub ( crate ) ) ) ]
5658pub enum Error {
57- #[ snafu( display( "invalid container name" ) ) ]
58- InvalidContainerName {
59- source : stackable_operator:: builder:: pod:: container:: Error ,
60- } ,
61-
6259 #[ snafu( display( "failed to configure graceful shutdown" ) ) ]
6360 GracefulShutdown {
6461 source : crate :: controller:: build:: graceful_shutdown:: Error ,
@@ -154,8 +151,7 @@ pub fn build_server_rolegroup_statefulset(
154151 . service_account_name ( service_account. name_any ( ) )
155152 . security_context ( PodSecurityContextBuilder :: new ( ) . fs_group ( 1000 ) . build ( ) ) ;
156153
157- let mut airflow_container = ContainerBuilder :: new ( & Container :: Airflow . to_string ( ) )
158- . context ( InvalidContainerNameSnafu ) ?;
154+ let mut airflow_container = new_container_builder ( & Container :: Airflow . to_container_name ( ) ) ;
159155
160156 add_authentication_volumes_and_volume_mounts (
161157 authentication_config,
@@ -283,8 +279,7 @@ pub fn build_server_rolegroup_statefulset(
283279
284280 pb. add_container ( airflow_container. build ( ) ) ;
285281
286- let metrics_container = ContainerBuilder :: new ( "metrics" )
287- . context ( InvalidContainerNameSnafu ) ?
282+ let metrics_container = new_container_builder ( & METRICS_CONTAINER_NAME )
288283 . image_from_product_image ( resolved_product_image)
289284 . command ( vec ! [
290285 "/bin/bash" . to_string( ) ,
0 commit comments