Skip to content

Commit ddccabf

Browse files
committed
chore: migrate to listener volume source builder
1 parent 53c3d50 commit ddccabf

2 files changed

Lines changed: 17 additions & 20 deletions

File tree

rust/operator-binary/src/controller/build/resource/statefulset.rs

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ use stackable_operator::{
66
PodBuilder,
77
resources::ResourceRequirementsBuilder,
88
security::PodSecurityContextBuilder,
9-
volume::{
10-
ListenerOperatorVolumeSourceBuilder, ListenerOperatorVolumeSourceBuilderError,
11-
ListenerReference, VolumeBuilder,
12-
},
9+
volume::VolumeBuilder,
1310
},
1411
},
1512
crd::git_sync,
@@ -25,7 +22,13 @@ use stackable_operator::{
2522
kvp::{Annotation, Label, LabelError},
2623
utils::COMMON_BASH_TRAP_FUNCTIONS,
2724
v2::{
28-
builder::{meta::ownerreference_from_resource, pod::container::new_container_builder},
25+
builder::{
26+
meta::ownerreference_from_resource,
27+
pod::{
28+
container::new_container_builder,
29+
volume::{ListenerReference, listener_operator_volume_source_builder_build_pvc},
30+
},
31+
},
2932
types::operator::RoleGroupName,
3033
},
3134
};
@@ -48,7 +51,7 @@ use crate::{
4851
controller_commons::{self, CONFIG_VOLUME_NAME, LOG_CONFIG_VOLUME_NAME, LOG_VOLUME_NAME},
4952
crd::{
5053
AirflowExecutor, AirflowRole, CONFIG_PATH, Container, HTTP_PORT_NAME, LISTENER_VOLUME_DIR,
51-
LISTENER_VOLUME_NAME, LOG_CONFIG_DIR, METRICS_CONTAINER_NAME, METRICS_PORT,
54+
LISTENER_PVC_NAME, LOG_CONFIG_DIR, METRICS_CONTAINER_NAME, METRICS_PORT,
5255
METRICS_PORT_NAME, STACKABLE_LOG_DIR, TEMPLATE_LOCATION, TEMPLATE_VOLUME_NAME,
5356
},
5457
};
@@ -77,11 +80,6 @@ pub enum Error {
7780
#[snafu(display("failed to build Statefulset environmental variables"))]
7881
BuildStatefulsetEnvVars { source: env_vars::Error },
7982

80-
#[snafu(display("failed to build listener volume"))]
81-
BuildListenerVolume {
82-
source: ListenerOperatorVolumeSourceBuilderError,
83-
},
84-
8583
#[snafu(display("failed to build shared pod resources"))]
8684
Pod {
8785
source: crate::controller::build::resource::pod::Error,
@@ -237,16 +235,15 @@ pub fn build_server_rolegroup_statefulset(
237235
// so that load balancers can hard-code the target addresses. This will
238236
// be the case even when no class is set (and the value defaults to
239237
// cluster-internal) as the address should still be consistent.
240-
let pvc = ListenerOperatorVolumeSourceBuilder::new(
241-
&ListenerReference::ListenerName(listener_group_name.to_string()),
238+
let pvc = listener_operator_volume_source_builder_build_pvc(
239+
&ListenerReference::Listener(listener_group_name),
242240
&unversioned_recommended_labels,
243-
)
244-
.build_pvc(LISTENER_VOLUME_NAME.to_string())
245-
.context(BuildListenerVolumeSnafu)?;
241+
&LISTENER_PVC_NAME,
242+
);
246243
pvcs = Some(vec![pvc]);
247244

248245
airflow_container
249-
.add_volume_mount(&*LISTENER_VOLUME_NAME, LISTENER_VOLUME_DIR)
246+
.add_volume_mount(&*LISTENER_PVC_NAME, LISTENER_VOLUME_DIR)
250247
.context(AddVolumeMountSnafu)?;
251248
}
252249

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ use stackable_operator::{
4343
types::{
4444
common::Port,
4545
kubernetes::{
46-
ConfigMapName, ContainerName, ListenerClassName, ListenerName, SecretName,
47-
VolumeName,
46+
ConfigMapName, ContainerName, ListenerClassName, ListenerName,
47+
PersistentVolumeClaimName, SecretName, VolumeName,
4848
},
4949
},
5050
},
@@ -86,7 +86,7 @@ stackable_operator::constant!(pub TEMPLATE_VOLUME_NAME: VolumeName = "airflow-ex
8686
pub const TEMPLATE_LOCATION: &str = "/templates";
8787
pub const TEMPLATE_NAME: &str = "airflow_executor_pod_template.yaml";
8888

89-
stackable_operator::constant!(pub LISTENER_VOLUME_NAME: VolumeName = "listener");
89+
stackable_operator::constant!(pub LISTENER_PVC_NAME: PersistentVolumeClaimName = "listener");
9090
pub const LISTENER_VOLUME_DIR: &str = "/stackable/listener";
9191

9292
pub const HTTP_PORT_NAME: &str = "http";

0 commit comments

Comments
 (0)