Skip to content

Commit ecba67b

Browse files
committed
Formatting
1 parent cca4df6 commit ecba67b

File tree

5 files changed

+120
-156
lines changed

5 files changed

+120
-156
lines changed

rust/operator-binary/src/container.rs

Lines changed: 25 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -880,52 +880,37 @@ wait_for_termination $!
880880
// See https://github.com/stackabletech/hdfs-operator/issues/138 for details
881881
if let ContainerConfig::Hdfs { role, .. } = self {
882882
let role_opts_name = role.hadoop_opts_env_var_for_role().to_string();
883-
env.insert(
884-
role_opts_name.clone(),
885-
EnvVar {
886-
name: role_opts_name,
887-
value: Some(self.build_hadoop_opts(hdfs, role_group, resources)?),
888-
..EnvVar::default()
889-
},
890-
);
883+
env.insert(role_opts_name.clone(), EnvVar {
884+
name: role_opts_name,
885+
value: Some(self.build_hadoop_opts(hdfs, role_group, resources)?),
886+
..EnvVar::default()
887+
});
891888
}
892889

893-
env.insert(
894-
"HADOOP_OPTS".to_string(),
895-
EnvVar {
896-
name: "HADOOP_OPTS".to_string(),
897-
value: Some(construct_global_jvm_args(hdfs.has_kerberos_enabled())),
898-
..EnvVar::default()
899-
},
900-
);
890+
env.insert("HADOOP_OPTS".to_string(), EnvVar {
891+
name: "HADOOP_OPTS".to_string(),
892+
value: Some(construct_global_jvm_args(hdfs.has_kerberos_enabled())),
893+
..EnvVar::default()
894+
});
901895
if hdfs.has_kerberos_enabled() {
902-
env.insert(
903-
"KRB5_CONFIG".to_string(),
904-
EnvVar {
905-
name: "KRB5_CONFIG".to_string(),
906-
value: Some(format!("{KERBEROS_CONTAINER_PATH}/krb5.conf")),
907-
..EnvVar::default()
908-
},
909-
);
910-
env.insert(
911-
"KRB5_CLIENT_KTNAME".to_string(),
912-
EnvVar {
913-
name: "KRB5_CLIENT_KTNAME".to_string(),
914-
value: Some(format!("{KERBEROS_CONTAINER_PATH}/keytab")),
915-
..EnvVar::default()
916-
},
917-
);
896+
env.insert("KRB5_CONFIG".to_string(), EnvVar {
897+
name: "KRB5_CONFIG".to_string(),
898+
value: Some(format!("{KERBEROS_CONTAINER_PATH}/krb5.conf")),
899+
..EnvVar::default()
900+
});
901+
env.insert("KRB5_CLIENT_KTNAME".to_string(), EnvVar {
902+
name: "KRB5_CLIENT_KTNAME".to_string(),
903+
value: Some(format!("{KERBEROS_CONTAINER_PATH}/keytab")),
904+
..EnvVar::default()
905+
});
918906
}
919907

920908
// Needed for the `containerdebug` process to log it's tracing information to.
921-
env.insert(
922-
"CONTAINERDEBUG_LOG_DIRECTORY".to_string(),
923-
EnvVar {
924-
name: "CONTAINERDEBUG_LOG_DIRECTORY".to_string(),
925-
value: Some(format!("{STACKABLE_LOG_DIR}/containerdebug")),
926-
value_from: None,
927-
},
928-
);
909+
env.insert("CONTAINERDEBUG_LOG_DIRECTORY".to_string(), EnvVar {
910+
name: "CONTAINERDEBUG_LOG_DIRECTORY".to_string(),
911+
value: Some(format!("{STACKABLE_LOG_DIR}/containerdebug")),
912+
value_from: None,
913+
});
929914

930915
// Overrides need to come last
931916
let mut env_override_vars: BTreeMap<String, EnvVar> =

rust/operator-binary/src/crd/affinity.rs

Lines changed: 53 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -74,64 +74,58 @@ spec:
7474
let hdfs: v1alpha1::HdfsCluster = serde_yaml::from_str(input).unwrap();
7575
let merged_config = role.merged_config(&hdfs, "default").unwrap();
7676

77-
assert_eq!(
78-
merged_config.affinity,
79-
StackableAffinity {
80-
pod_affinity: Some(PodAffinity {
81-
preferred_during_scheduling_ignored_during_execution: Some(vec![
82-
WeightedPodAffinityTerm {
83-
pod_affinity_term: PodAffinityTerm {
84-
label_selector: Some(LabelSelector {
85-
match_expressions: None,
86-
match_labels: Some(BTreeMap::from([
87-
("app.kubernetes.io/name".to_string(), "hdfs".to_string(),),
88-
(
89-
"app.kubernetes.io/instance".to_string(),
90-
"simple-hdfs".to_string(),
91-
),
92-
]))
93-
}),
94-
namespace_selector: None,
95-
namespaces: None,
96-
topology_key: "kubernetes.io/hostname".to_string(),
97-
..PodAffinityTerm::default()
98-
},
99-
weight: 20
100-
}
101-
]),
102-
required_during_scheduling_ignored_during_execution: None,
103-
}),
104-
pod_anti_affinity: Some(PodAntiAffinity {
105-
preferred_during_scheduling_ignored_during_execution: Some(vec![
106-
WeightedPodAffinityTerm {
107-
pod_affinity_term: PodAffinityTerm {
108-
label_selector: Some(LabelSelector {
109-
match_expressions: None,
110-
match_labels: Some(BTreeMap::from([
111-
("app.kubernetes.io/name".to_string(), "hdfs".to_string(),),
112-
(
113-
"app.kubernetes.io/instance".to_string(),
114-
"simple-hdfs".to_string(),
115-
),
116-
(
117-
"app.kubernetes.io/component".to_string(),
118-
role.to_string(),
119-
)
120-
]))
121-
}),
122-
namespace_selector: None,
123-
namespaces: None,
124-
topology_key: "kubernetes.io/hostname".to_string(),
125-
..PodAffinityTerm::default()
126-
},
127-
weight: 70
128-
}
129-
]),
130-
required_during_scheduling_ignored_during_execution: None,
131-
}),
132-
node_affinity: None,
133-
node_selector: None,
134-
}
135-
);
77+
assert_eq!(merged_config.affinity, StackableAffinity {
78+
pod_affinity: Some(PodAffinity {
79+
preferred_during_scheduling_ignored_during_execution: Some(vec![
80+
WeightedPodAffinityTerm {
81+
pod_affinity_term: PodAffinityTerm {
82+
label_selector: Some(LabelSelector {
83+
match_expressions: None,
84+
match_labels: Some(BTreeMap::from([
85+
("app.kubernetes.io/name".to_string(), "hdfs".to_string(),),
86+
(
87+
"app.kubernetes.io/instance".to_string(),
88+
"simple-hdfs".to_string(),
89+
),
90+
]))
91+
}),
92+
namespace_selector: None,
93+
namespaces: None,
94+
topology_key: "kubernetes.io/hostname".to_string(),
95+
..PodAffinityTerm::default()
96+
},
97+
weight: 20
98+
}
99+
]),
100+
required_during_scheduling_ignored_during_execution: None,
101+
}),
102+
pod_anti_affinity: Some(PodAntiAffinity {
103+
preferred_during_scheduling_ignored_during_execution: Some(vec![
104+
WeightedPodAffinityTerm {
105+
pod_affinity_term: PodAffinityTerm {
106+
label_selector: Some(LabelSelector {
107+
match_expressions: None,
108+
match_labels: Some(BTreeMap::from([
109+
("app.kubernetes.io/name".to_string(), "hdfs".to_string(),),
110+
(
111+
"app.kubernetes.io/instance".to_string(),
112+
"simple-hdfs".to_string(),
113+
),
114+
("app.kubernetes.io/component".to_string(), role.to_string(),)
115+
]))
116+
}),
117+
namespace_selector: None,
118+
namespaces: None,
119+
topology_key: "kubernetes.io/hostname".to_string(),
120+
..PodAffinityTerm::default()
121+
},
122+
weight: 70
123+
}
124+
]),
125+
required_during_scheduling_ignored_during_execution: None,
126+
}),
127+
node_affinity: None,
128+
node_selector: None,
129+
});
136130
}
137131
}

rust/operator-binary/src/crd/mod.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,18 +1317,15 @@ impl DataNodeConfigFragment {
13171317
limit: Some(Quantity("512Mi".to_owned())),
13181318
runtime_limits: NoRuntimeLimitsFragment {},
13191319
},
1320-
storage: BTreeMap::from([(
1321-
"data".to_string(),
1322-
DataNodePvcFragment {
1323-
pvc: PvcConfigFragment {
1324-
capacity: Some(Quantity("10Gi".to_owned())),
1325-
storage_class: None,
1326-
selectors: None,
1327-
},
1328-
count: Some(1),
1329-
hdfs_storage_type: Some(HdfsStorageType::default()),
1320+
storage: BTreeMap::from([("data".to_string(), DataNodePvcFragment {
1321+
pvc: PvcConfigFragment {
1322+
capacity: Some(Quantity("10Gi".to_owned())),
1323+
storage_class: None,
1324+
selectors: None,
13301325
},
1331-
)]),
1326+
count: Some(1),
1327+
hdfs_storage_type: Some(HdfsStorageType::default()),
1328+
})]),
13321329
},
13331330
logging: product_logging::spec::default_logging(),
13341331
listener_class: Some(DEFAULT_LISTENER_CLASS.to_string()),

rust/operator-binary/src/crd/storage.rs

Lines changed: 30 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -198,18 +198,15 @@ mod test {
198198
#[test]
199199
pub fn test_datanode_storage_defaults() {
200200
let data_node_storage = DataNodeStorageConfig {
201-
pvcs: BTreeMap::from([(
202-
"data".to_string(),
203-
DataNodePvc {
204-
pvc: PvcConfig {
205-
capacity: Some(Quantity("5Gi".to_owned())),
206-
storage_class: None,
207-
selectors: None,
208-
},
209-
count: 1,
210-
hdfs_storage_type: HdfsStorageType::default(),
201+
pvcs: BTreeMap::from([("data".to_string(), DataNodePvc {
202+
pvc: PvcConfig {
203+
capacity: Some(Quantity("5Gi".to_owned())),
204+
storage_class: None,
205+
selectors: None,
211206
},
212-
)]),
207+
count: 1,
208+
hdfs_storage_type: HdfsStorageType::default(),
209+
})]),
213210
};
214211

215212
let pvcs = data_node_storage.build_pvcs();
@@ -239,36 +236,30 @@ mod test {
239236
pub fn test_datanode_storage_multiple_storage_types() {
240237
let data_node_storage = DataNodeStorageConfig {
241238
pvcs: BTreeMap::from([
242-
(
243-
"hdd".to_string(),
244-
DataNodePvc {
245-
pvc: PvcConfig {
246-
capacity: Some(Quantity("12Ti".to_owned())),
247-
storage_class: Some("hdd-storage-class".to_string()),
248-
selectors: Some(LabelSelector {
249-
match_expressions: None,
250-
match_labels: Some(BTreeMap::from([(
251-
"foo".to_string(),
252-
"bar".to_string(),
253-
)])),
254-
}),
255-
},
256-
count: 8,
257-
hdfs_storage_type: HdfsStorageType::Disk,
239+
("hdd".to_string(), DataNodePvc {
240+
pvc: PvcConfig {
241+
capacity: Some(Quantity("12Ti".to_owned())),
242+
storage_class: Some("hdd-storage-class".to_string()),
243+
selectors: Some(LabelSelector {
244+
match_expressions: None,
245+
match_labels: Some(BTreeMap::from([(
246+
"foo".to_string(),
247+
"bar".to_string(),
248+
)])),
249+
}),
258250
},
259-
),
260-
(
261-
"ssd".to_string(),
262-
DataNodePvc {
263-
pvc: PvcConfig {
264-
capacity: Some(Quantity("2Ti".to_owned())),
265-
storage_class: Some("premium-ssd".to_string()),
266-
selectors: None,
267-
},
268-
count: 4,
269-
hdfs_storage_type: HdfsStorageType::Ssd,
251+
count: 8,
252+
hdfs_storage_type: HdfsStorageType::Disk,
253+
}),
254+
("ssd".to_string(), DataNodePvc {
255+
pvc: PvcConfig {
256+
capacity: Some(Quantity("2Ti".to_owned())),
257+
storage_class: Some("premium-ssd".to_string()),
258+
selectors: None,
270259
},
271-
),
260+
count: 4,
261+
hdfs_storage_type: HdfsStorageType::Ssd,
262+
}),
272263
]),
273264
};
274265
let pvcs = data_node_storage.build_pvcs();

rust/operator-binary/src/main.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,10 @@ pub async fn create_controller(
107107
) {
108108
let (store, store_w) = reflector::store();
109109

110-
let hdfs_event_recorder = Arc::new(Recorder::new(
111-
client.as_kube_client(),
112-
Reporter {
113-
controller: HDFS_FULL_CONTROLLER_NAME.to_string(),
114-
instance: None,
115-
},
116-
));
110+
let hdfs_event_recorder = Arc::new(Recorder::new(client.as_kube_client(), Reporter {
111+
controller: HDFS_FULL_CONTROLLER_NAME.to_string(),
112+
instance: None,
113+
}));
117114

118115
// The topology provider will need to build label information by querying kubernetes nodes and this
119116
// requires the clusterrole 'hdfs-clusterrole-nodes': this is bound to each deployed HDFS cluster

0 commit comments

Comments
 (0)