Skip to content

Commit 8ae3303

Browse files
committed
use ephemeral listeners classes; fix test missing dimension
1 parent 8270343 commit 8ae3303

6 files changed

Lines changed: 16 additions & 40 deletions

File tree

rust/operator-binary/src/airflow_controller.rs

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@ use stackable_operator::{
2323
container::ContainerBuilder,
2424
resources::ResourceRequirementsBuilder,
2525
security::PodSecurityContextBuilder,
26-
volume::{
27-
ListenerOperatorVolumeSourceBuilder, ListenerOperatorVolumeSourceBuilderError,
28-
ListenerReference, VolumeBuilder,
29-
},
26+
volume::{ListenerOperatorVolumeSourceBuilderError, VolumeBuilder},
3027
},
3128
},
3229
cluster_resources::{ClusterResourceApplyStrategy, ClusterResources},
@@ -980,26 +977,14 @@ fn build_server_rolegroup_statefulset(
980977
}
981978

982979
let listener_class = &merged_airflow_config.listener_class;
983-
// externally-reachable listener endpoints should use a pvc volume...
984-
let pvcs = if listener_class.discoverable() {
985-
let pvc = ListenerOperatorVolumeSourceBuilder::new(
986-
&ListenerReference::ListenerClass(listener_class.to_string()),
987-
&recommended_labels,
988-
)
989-
.context(BuildListenerVolumeSnafu)?
990-
.build_pvc(LISTENER_VOLUME_NAME.to_string())
991-
.context(BuildListenerVolumeSnafu)?;
992-
Some(vec![pvc])
993-
} else {
994-
// ...whereas others will use ephemeral volumes
995-
pb.add_listener_volume_by_listener_class(
996-
LISTENER_VOLUME_NAME,
997-
&listener_class.to_string(),
998-
&recommended_labels,
999-
)
1000-
.context(AddVolumeSnafu)?;
1001-
None
1002-
};
980+
// all listeners will use ephemeral volumes as they can/should
981+
// be removed when the pods is re-started, and no data needs to be preserved
982+
pb.add_listener_volume_by_listener_class(
983+
LISTENER_VOLUME_NAME,
984+
&listener_class.to_string(),
985+
&recommended_labels,
986+
)
987+
.context(AddVolumeSnafu)?;
1003988

1004989
airflow_container
1005990
.add_volume_mount(LISTENER_VOLUME_NAME, LISTENER_VOLUME_DIR)
@@ -1157,7 +1142,6 @@ fn build_server_rolegroup_statefulset(
11571142
},
11581143
service_name: rolegroup_ref.object_name(),
11591144
template: pod_template,
1160-
volume_claim_templates: pvcs,
11611145
..StatefulSetSpec::default()
11621146
};
11631147

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ use stackable_operator::{
4343
versioned::versioned,
4444
};
4545
use strum::{Display, EnumIter, EnumString, IntoEnumIterator};
46-
use utils::{PodRef, get_persisted_listener_podrefs};
46+
use utils::{PodRef, get_listener_podrefs};
4747

4848
use crate::crd::{
4949
affinity::{get_affinity, get_executor_affinity},
@@ -555,7 +555,7 @@ impl v1alpha1::AirflowCluster {
555555
if let Ok(Some(listener_class)) = self.merged_listener_class(role, rolegroup_name) {
556556
listener_class.discoverable()
557557
} else {
558-
// merged_listener_class returns an error is one of the roles was not found:
558+
// merged_listener_class returns an error if one of the roles was not found:
559559
// all roles are mandatory for airflow to work, but a missing role will by
560560
// definition not have a listener class
561561
false
@@ -592,7 +592,7 @@ impl v1alpha1::AirflowCluster {
592592
let pod_refs = self.pod_refs(role)?;
593593

594594
tracing::debug!("Pod references for role {role}: {:#?}", pod_refs);
595-
get_persisted_listener_podrefs(client, pod_refs, LISTENER_VOLUME_NAME)
595+
get_listener_podrefs(client, pod_refs, LISTENER_VOLUME_NAME)
596596
.await
597597
.context(ListenerPodRefSnafu)
598598
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ impl PodRef {
5959
}
6060
}
6161

62-
pub async fn get_persisted_listener_podrefs(
62+
pub async fn get_listener_podrefs(
6363
client: &stackable_operator::client::Client,
6464
pod_refs: Vec<PodRef>,
6565
listener_prefix: &str,
6666
) -> Result<Vec<PodRef>, Error> {
6767
try_join_all(pod_refs.into_iter().map(|pod_ref| async {
68-
// N.B. use the naming convention for persistent listener volumes as we
69-
// only want externally-reachable endpoints.
70-
let listener_name = format!("{listener_prefix}-{}", pod_ref.pod_name);
68+
// N.B. use the naming convention for ephemeral listener volumes as we
69+
// have defined all listeners to be so.
70+
let listener_name = format!("{}-{listener_prefix}", pod_ref.pod_name);
7171
let listener_ref = || ObjectRef::<Listener>::new(&listener_name).within(&pod_ref.namespace);
7272
let pod_obj_ref = || ObjectRef::<Pod>::new(&pod_ref.pod_name).within(&pod_ref.namespace);
7373
let listener = client

tests/templates/kuttl/external-access/20-assert.yaml.j2 renamed to tests/templates/kuttl/external-access/20-assert.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{% if test_scenario['values']['executor'] == 'celery' %}
21
---
32
apiVersion: kuttl.dev/v1beta1
43
kind: TestAssert
@@ -21,4 +20,3 @@ metadata:
2120
status:
2221
readyReplicas: 1
2322
replicas: 1
24-
{% endif %}

tests/templates/kuttl/external-access/20-install-redis.yaml.j2 renamed to tests/templates/kuttl/external-access/20-install-redis.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{% if test_scenario['values']['executor'] == 'celery' %}
21
---
32
apiVersion: kuttl.dev/v1beta1
43
kind: TestStep
@@ -11,4 +10,3 @@ commands:
1110
--repo https://charts.bitnami.com/bitnami redis
1211
--wait
1312
timeout: 600
14-
{% endif %}

tests/templates/kuttl/external-access/40-assert.yaml.j2 renamed to tests/templates/kuttl/external-access/40-assert.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ metadata:
4040
status:
4141
readyReplicas: 1
4242
replicas: 1
43-
{% if test_scenario['values']['executor'] == 'celery' %}
4443
---
4544
apiVersion: apps/v1
4645
kind: StatefulSet
@@ -53,7 +52,6 @@ spec:
5352
status:
5453
readyReplicas: 2
5554
replicas: 2
56-
{% endif %}
5755
---
5856
apiVersion: apps/v1
5957
kind: StatefulSet
@@ -75,7 +73,6 @@ status:
7573
expectedPods: 3
7674
currentHealthy: 3
7775
disruptionsAllowed: 1
78-
{% if test_scenario['values']['executor'] == 'celery' %}
7976
---
8077
apiVersion: policy/v1
8178
kind: PodDisruptionBudget
@@ -85,7 +82,6 @@ status:
8582
expectedPods: 2
8683
currentHealthy: 2
8784
disruptionsAllowed: 1
88-
{% endif %}
8985
---
9086
apiVersion: policy/v1
9187
kind: PodDisruptionBudget

0 commit comments

Comments
 (0)