@@ -17,14 +17,14 @@ use stackable_operator::{
17
17
builder:: {
18
18
self ,
19
19
pod:: {
20
+ PodBuilder ,
20
21
container:: ContainerBuilder ,
21
22
resources:: ResourceRequirementsBuilder ,
22
23
volume:: {
23
24
ListenerOperatorVolumeSourceBuilder , ListenerOperatorVolumeSourceBuilderError ,
24
25
ListenerReference , SecretFormat , SecretOperatorVolumeSourceBuilder ,
25
26
SecretOperatorVolumeSourceBuilderError , VolumeBuilder , VolumeMountBuilder ,
26
27
} ,
27
- PodBuilder ,
28
28
} ,
29
29
} ,
30
30
commons:: product_image_selection:: ResolvedProductImage ,
@@ -36,19 +36,19 @@ use stackable_operator::{
36
36
} ,
37
37
apimachinery:: pkg:: util:: intstr:: IntOrString ,
38
38
} ,
39
- kube:: { core:: ObjectMeta , ResourceExt } ,
39
+ kube:: { ResourceExt , core:: ObjectMeta } ,
40
40
kvp:: Labels ,
41
41
product_logging:: {
42
42
self ,
43
43
framework:: {
44
- create_vector_shutdown_file_command , remove_vector_shutdown_file_command , LoggingError ,
44
+ LoggingError , create_vector_shutdown_file_command , remove_vector_shutdown_file_command ,
45
45
} ,
46
46
spec:: {
47
47
ConfigMapLogConfig , ContainerLogConfig , ContainerLogConfigChoice ,
48
48
CustomContainerLogConfig ,
49
49
} ,
50
50
} ,
51
- utils:: { cluster_info:: KubernetesClusterInfo , COMMON_BASH_TRAP_FUNCTIONS } ,
51
+ utils:: { COMMON_BASH_TRAP_FUNCTIONS , cluster_info:: KubernetesClusterInfo } ,
52
52
} ;
53
53
use strum:: { Display , EnumDiscriminants , IntoStaticStr } ;
54
54
@@ -58,6 +58,8 @@ use crate::{
58
58
jvm:: { construct_global_jvm_args, construct_role_specific_jvm_args} ,
59
59
} ,
60
60
crd:: {
61
+ AnyNodeConfig , DataNodeContainer , HdfsNodeRole , HdfsPodRef , NameNodeContainer ,
62
+ UpgradeState ,
61
63
constants:: {
62
64
DATANODE_ROOT_DATA_DIR_PREFIX , DEFAULT_DATA_NODE_METRICS_PORT ,
63
65
DEFAULT_JOURNAL_NODE_METRICS_PORT , DEFAULT_NAME_NODE_METRICS_PORT , LISTENER_VOLUME_DIR ,
@@ -69,8 +71,7 @@ use crate::{
69
71
SERVICE_PORT_NAME_RPC , STACKABLE_ROOT_DATA_DIR ,
70
72
} ,
71
73
storage:: DataNodeStorageConfig ,
72
- v1alpha1, AnyNodeConfig , DataNodeContainer , HdfsNodeRole , HdfsPodRef , NameNodeContainer ,
73
- UpgradeState ,
74
+ v1alpha1,
74
75
} ,
75
76
product_logging:: {
76
77
FORMAT_NAMENODES_LOG4J_CONFIG_FILE , FORMAT_ZOOKEEPER_LOG4J_CONFIG_FILE ,
@@ -104,10 +105,9 @@ pub enum Error {
104
105
role : String ,
105
106
} ,
106
107
107
- #[ snafu(
108
- display( "could not determine any ContainerConfig actions for {container_name:?}. Container not recognized."
109
- )
110
- ) ]
108
+ #[ snafu( display(
109
+ "could not determine any ContainerConfig actions for {container_name:?}. Container not recognized."
110
+ ) ) ]
111
111
UnrecognizedContainerName { container_name : String } ,
112
112
113
113
#[ snafu( display( "invalid container name {name:?}" ) ) ]
@@ -191,22 +191,20 @@ pub enum ContainerConfig {
191
191
}
192
192
193
193
impl ContainerConfig {
194
- // volumes
195
- pub const STACKABLE_LOG_VOLUME_MOUNT_NAME : & ' static str = "log" ;
196
194
pub const DATA_VOLUME_MOUNT_NAME : & ' static str = "data" ;
197
- pub const HDFS_CONFIG_VOLUME_MOUNT_NAME : & ' static str = "hdfs-config" ;
198
-
199
- const HDFS_LOG_VOLUME_MOUNT_NAME : & ' static str = "hdfs-log-config" ;
200
- const ZKFC_CONFIG_VOLUME_MOUNT_NAME : & ' static str = "zkfc-config" ;
201
- const ZKFC_LOG_VOLUME_MOUNT_NAME : & ' static str = "zkfc-log-config" ;
202
195
const FORMAT_NAMENODES_CONFIG_VOLUME_MOUNT_NAME : & ' static str = "format-namenodes-config" ;
203
196
const FORMAT_NAMENODES_LOG_VOLUME_MOUNT_NAME : & ' static str = "format-namenodes-log-config" ;
204
197
const FORMAT_ZOOKEEPER_CONFIG_VOLUME_MOUNT_NAME : & ' static str = "format-zookeeper-config" ;
205
198
const FORMAT_ZOOKEEPER_LOG_VOLUME_MOUNT_NAME : & ' static str = "format-zookeeper-log-config" ;
199
+ const HADOOP_HOME : & ' static str = "/stackable/hadoop" ;
200
+ pub const HDFS_CONFIG_VOLUME_MOUNT_NAME : & ' static str = "hdfs-config" ;
201
+ const HDFS_LOG_VOLUME_MOUNT_NAME : & ' static str = "hdfs-log-config" ;
202
+ // volumes
203
+ pub const STACKABLE_LOG_VOLUME_MOUNT_NAME : & ' static str = "log" ;
206
204
const WAIT_FOR_NAMENODES_CONFIG_VOLUME_MOUNT_NAME : & ' static str = "wait-for-namenodes-config" ;
207
205
const WAIT_FOR_NAMENODES_LOG_VOLUME_MOUNT_NAME : & ' static str = "wait-for-namenodes-log-config" ;
208
-
209
- const HADOOP_HOME : & ' static str = "/stackable/hadoop " ;
206
+ const ZKFC_CONFIG_VOLUME_MOUNT_NAME : & ' static str = "zkfc-config" ;
207
+ const ZKFC_LOG_VOLUME_MOUNT_NAME : & ' static str = "zkfc-log-config " ;
210
208
211
209
/// Add all main, side and init containers as well as required volumes to the pod builder.
212
210
#[ allow( clippy:: too_many_arguments) ]
@@ -802,7 +800,9 @@ wait_for_termination $!
802
800
803
801
// Command to export `KERBEROS_REALM` env var to default real from krb5.conf, e.g. `CLUSTER.LOCAL`
804
802
fn export_kerberos_real_env_var_command ( ) -> String {
805
- format ! ( "export KERBEROS_REALM=$(grep -oP 'default_realm = \\ K.*' {KERBEROS_CONTAINER_PATH}/krb5.conf)\n " )
803
+ format ! (
804
+ "export KERBEROS_REALM=$(grep -oP 'default_realm = \\ K.*' {KERBEROS_CONTAINER_PATH}/krb5.conf)\n "
805
+ )
806
806
}
807
807
808
808
/// Command to `kinit` a ticket using the principal created for the specified hdfs role
@@ -869,52 +869,37 @@ wait_for_termination $!
869
869
// See https://github.com/stackabletech/hdfs-operator/issues/138 for details
870
870
if let ContainerConfig :: Hdfs { role, .. } = self {
871
871
let role_opts_name = role. hadoop_opts_env_var_for_role ( ) . to_string ( ) ;
872
- env. insert (
873
- role_opts_name. clone ( ) ,
874
- EnvVar {
875
- name : role_opts_name,
876
- value : Some ( self . build_hadoop_opts ( hdfs, role_group, resources) ?) ,
877
- ..EnvVar :: default ( )
878
- } ,
879
- ) ;
872
+ env. insert ( role_opts_name. clone ( ) , EnvVar {
873
+ name : role_opts_name,
874
+ value : Some ( self . build_hadoop_opts ( hdfs, role_group, resources) ?) ,
875
+ ..EnvVar :: default ( )
876
+ } ) ;
880
877
}
881
878
882
- env. insert (
883
- "HADOOP_OPTS" . to_string ( ) ,
884
- EnvVar {
885
- name : "HADOOP_OPTS" . to_string ( ) ,
886
- value : Some ( construct_global_jvm_args ( hdfs. has_kerberos_enabled ( ) ) ) ,
887
- ..EnvVar :: default ( )
888
- } ,
889
- ) ;
879
+ env. insert ( "HADOOP_OPTS" . to_string ( ) , EnvVar {
880
+ name : "HADOOP_OPTS" . to_string ( ) ,
881
+ value : Some ( construct_global_jvm_args ( hdfs. has_kerberos_enabled ( ) ) ) ,
882
+ ..EnvVar :: default ( )
883
+ } ) ;
890
884
if hdfs. has_kerberos_enabled ( ) {
891
- env. insert (
892
- "KRB5_CONFIG" . to_string ( ) ,
893
- EnvVar {
894
- name : "KRB5_CONFIG" . to_string ( ) ,
895
- value : Some ( format ! ( "{KERBEROS_CONTAINER_PATH}/krb5.conf" ) ) ,
896
- ..EnvVar :: default ( )
897
- } ,
898
- ) ;
899
- env. insert (
900
- "KRB5_CLIENT_KTNAME" . to_string ( ) ,
901
- EnvVar {
902
- name : "KRB5_CLIENT_KTNAME" . to_string ( ) ,
903
- value : Some ( format ! ( "{KERBEROS_CONTAINER_PATH}/keytab" ) ) ,
904
- ..EnvVar :: default ( )
905
- } ,
906
- ) ;
885
+ env. insert ( "KRB5_CONFIG" . to_string ( ) , EnvVar {
886
+ name : "KRB5_CONFIG" . to_string ( ) ,
887
+ value : Some ( format ! ( "{KERBEROS_CONTAINER_PATH}/krb5.conf" ) ) ,
888
+ ..EnvVar :: default ( )
889
+ } ) ;
890
+ env. insert ( "KRB5_CLIENT_KTNAME" . to_string ( ) , EnvVar {
891
+ name : "KRB5_CLIENT_KTNAME" . to_string ( ) ,
892
+ value : Some ( format ! ( "{KERBEROS_CONTAINER_PATH}/keytab" ) ) ,
893
+ ..EnvVar :: default ( )
894
+ } ) ;
907
895
}
908
896
909
897
// Needed for the `containerdebug` process to log it's tracing information to.
910
- env. insert (
911
- "CONTAINERDEBUG_LOG_DIRECTORY" . to_string ( ) ,
912
- EnvVar {
913
- name : "CONTAINERDEBUG_LOG_DIRECTORY" . to_string ( ) ,
914
- value : Some ( format ! ( "{STACKABLE_LOG_DIR}/containerdebug" ) ) ,
915
- value_from : None ,
916
- } ,
917
- ) ;
898
+ env. insert ( "CONTAINERDEBUG_LOG_DIRECTORY" . to_string ( ) , EnvVar {
899
+ name : "CONTAINERDEBUG_LOG_DIRECTORY" . to_string ( ) ,
900
+ value : Some ( format ! ( "{STACKABLE_LOG_DIR}/containerdebug" ) ) ,
901
+ value_from : None ,
902
+ } ) ;
918
903
919
904
// Overrides need to come last
920
905
let mut env_override_vars: BTreeMap < String , EnvVar > =
@@ -1457,13 +1442,15 @@ impl ContainerVolumeDirs {
1457
1442
pub fn config_mount ( & self ) -> & str {
1458
1443
self . config_mount . as_str ( )
1459
1444
}
1445
+
1460
1446
pub fn config_mount_name ( & self ) -> & str {
1461
1447
self . config_mount_name . as_str ( )
1462
1448
}
1463
1449
1464
1450
pub fn log_mount ( & self ) -> & str {
1465
1451
self . log_mount . as_str ( )
1466
1452
}
1453
+
1467
1454
pub fn log_mount_name ( & self ) -> & str {
1468
1455
self . log_mount_name . as_str ( )
1469
1456
}
0 commit comments