|
1 | 1 | use stackable_operator::{ |
2 | | - commons::affinity::{affinity_between_role_pods, StackableAffinityFragment}, |
| 2 | + commons::affinity::{StackableAffinityFragment, affinity_between_role_pods}, |
3 | 3 | k8s_openapi::api::core::v1::{PodAffinity, PodAntiAffinity}, |
4 | 4 | }; |
5 | 5 |
|
6 | | -use crate::crd::{DeepStorageSpec, DruidRole, HdfsDeepStorageSpec, APP_NAME}; |
| 6 | +use crate::crd::{APP_NAME, DeepStorageSpec, DruidRole, HdfsDeepStorageSpec}; |
7 | 7 |
|
8 | 8 | /// Please have a look at the architecture diagram in <https://druid.apache.org/assets/images/druid-architecture-7db1cd79d2d70b2e5ccc73b6bebfcaa4.svg> |
9 | 9 | /// to understand which roles do communicate with each other. |
@@ -257,45 +257,39 @@ mod tests { |
257 | 257 | _ => (), |
258 | 258 | }; |
259 | 259 |
|
260 | | - assert_eq!( |
261 | | - merged_config.affinity, |
262 | | - StackableAffinity { |
263 | | - pod_affinity: Some(PodAffinity { |
264 | | - preferred_during_scheduling_ignored_during_execution: Some(expected_affinities), |
265 | | - required_during_scheduling_ignored_during_execution: None, |
266 | | - }), |
267 | | - pod_anti_affinity: Some(PodAntiAffinity { |
268 | | - preferred_during_scheduling_ignored_during_execution: Some(vec![ |
269 | | - WeightedPodAffinityTerm { |
270 | | - pod_affinity_term: PodAffinityTerm { |
271 | | - label_selector: Some(LabelSelector { |
272 | | - match_expressions: None, |
273 | | - match_labels: Some(BTreeMap::from([ |
274 | | - ("app.kubernetes.io/name".to_string(), "druid".to_string(),), |
275 | | - ( |
276 | | - "app.kubernetes.io/instance".to_string(), |
277 | | - "simple-druid".to_string(), |
278 | | - ), |
279 | | - ( |
280 | | - "app.kubernetes.io/component".to_string(), |
281 | | - role.to_string(), |
282 | | - ) |
283 | | - ])) |
284 | | - }), |
285 | | - match_label_keys: None, |
286 | | - mismatch_label_keys: None, |
287 | | - namespace_selector: None, |
288 | | - namespaces: None, |
289 | | - topology_key: "kubernetes.io/hostname".to_string(), |
290 | | - }, |
291 | | - weight: 70 |
292 | | - } |
293 | | - ]), |
294 | | - required_during_scheduling_ignored_during_execution: None, |
295 | | - }), |
296 | | - node_affinity: None, |
297 | | - node_selector: None, |
298 | | - } |
299 | | - ); |
| 260 | + assert_eq!(merged_config.affinity, StackableAffinity { |
| 261 | + pod_affinity: Some(PodAffinity { |
| 262 | + preferred_during_scheduling_ignored_during_execution: Some(expected_affinities), |
| 263 | + required_during_scheduling_ignored_during_execution: None, |
| 264 | + }), |
| 265 | + pod_anti_affinity: Some(PodAntiAffinity { |
| 266 | + preferred_during_scheduling_ignored_during_execution: Some(vec![ |
| 267 | + WeightedPodAffinityTerm { |
| 268 | + pod_affinity_term: PodAffinityTerm { |
| 269 | + label_selector: Some(LabelSelector { |
| 270 | + match_expressions: None, |
| 271 | + match_labels: Some(BTreeMap::from([ |
| 272 | + ("app.kubernetes.io/name".to_string(), "druid".to_string(),), |
| 273 | + ( |
| 274 | + "app.kubernetes.io/instance".to_string(), |
| 275 | + "simple-druid".to_string(), |
| 276 | + ), |
| 277 | + ("app.kubernetes.io/component".to_string(), role.to_string(),) |
| 278 | + ])) |
| 279 | + }), |
| 280 | + match_label_keys: None, |
| 281 | + mismatch_label_keys: None, |
| 282 | + namespace_selector: None, |
| 283 | + namespaces: None, |
| 284 | + topology_key: "kubernetes.io/hostname".to_string(), |
| 285 | + }, |
| 286 | + weight: 70 |
| 287 | + } |
| 288 | + ]), |
| 289 | + required_during_scheduling_ignored_during_execution: None, |
| 290 | + }), |
| 291 | + node_affinity: None, |
| 292 | + node_selector: None, |
| 293 | + }); |
300 | 294 | } |
301 | 295 | } |
0 commit comments