Skip to content

Commit 04f3b11

Browse files
authored
Add listener volume scope for secret volume builders (#858)
* Add listener volume scope for secret volume builders See https://docs.stackable.tech/home/stable/secret-operator/scope#listener-volume * changelog * remove duplicated link * Because I'm dumb and linked to the wrong PR * Fix old changelog formatting errors
1 parent 1b8c400 commit 04f3b11

File tree

4 files changed

+24
-6
lines changed

4 files changed

+24
-6
lines changed

crates/stackable-operator/CHANGELOG.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file.
77
### Added
88

99
- Add `Hostname` and `KerberosRealmName` types extracted from secret-operator ([#851]).
10+
- Add support for listener volume scopes to `SecretOperatorVolumeSourceBuilder` ([#858]).
1011

1112
### Changed
1213

@@ -20,6 +21,7 @@ All notable changes to this project will be documented in this file.
2021
[#846]: https://github.com/stackabletech/operator-rs/pull/846
2122
[#851]: https://github.com/stackabletech/operator-rs/pull/851
2223
[#855]: https://github.com/stackabletech/operator-rs/pull/855
24+
[#858]: https://github.com/stackabletech/operator-rs/pull/858
2325

2426
## [0.74.0] - 2024-08-22
2527

@@ -72,7 +74,6 @@ All notable changes to this project will be documented in this file.
7274

7375
[#821]: https://github.com/stackabletech/operator-rs/pull/821
7476
[#827]: https://github.com/stackabletech/operator-rs/pull/827
75-
[#840]: https://github.com/stackabletech/operator-rs/pull/840
7677

7778
## [0.71.0] - 2024-07-29
7879

@@ -516,9 +517,6 @@ Only rust documentation was changed.
516517
- `PodListeners` CRD ([#644]).
517518
- Add support for tls pkcs12 password to secret operator volume builder ([#645]).
518519

519-
[#644]: https://github.com/stackabletech/operator-rs/pull/644
520-
[#645]: https://github.com/stackabletech/operator-rs/pull/645
521-
522520
### Changed
523521

524522
- Derive `Eq` and `Copy` where applicable for listener CRDs ([#644]).
@@ -1185,7 +1183,7 @@ This is a rerelease of 0.25.1 which some last-minute incompatible API changes to
11851183

11861184
### Changed
11871185

1188-
- BREAKING: kube 0.68 -> 0.69.1 ([#319, [#322]]).
1186+
- BREAKING: kube 0.68 -> 0.69.1 ([#319], [#322]).
11891187

11901188
### Removed
11911189

crates/stackable-operator/src/builder/pod/volume.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,12 @@ impl SecretOperatorVolumeSourceBuilder {
309309
self
310310
}
311311

312+
pub fn with_listener_volume_scope(&mut self, name: impl Into<String>) -> &mut Self {
313+
self.scopes
314+
.push(SecretOperatorVolumeScope::ListenerVolume { name: name.into() });
315+
self
316+
}
317+
312318
pub fn with_format(&mut self, format: SecretFormat) -> &mut Self {
313319
self.format = Some(format);
314320
self
@@ -394,6 +400,7 @@ pub enum SecretOperatorVolumeScope {
394400
Node,
395401
Pod,
396402
Service { name: String },
403+
ListenerVolume { name: String },
397404
}
398405

399406
/// Reference to a listener class or listener name

crates/stackable-operator/src/commons/secret_class.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ impl SecretClassVolume {
5252
for service in &scope.services {
5353
secret_operator_volume_builder.with_service_scope(service);
5454
}
55+
for listener_volume in &scope.listener_volumes {
56+
secret_operator_volume_builder.with_listener_volume_scope(listener_volume);
57+
}
5558
}
5659

5760
secret_operator_volume_builder
@@ -84,6 +87,11 @@ pub struct SecretClassVolumeScope {
8487
/// This should typically correspond to Service objects that the Pod participates in.
8588
#[serde(default)]
8689
pub services: Vec<String>,
90+
91+
/// The listener volume scope allows Node and Service scopes to be inferred from the applicable listeners.
92+
/// This must correspond to Volume names in the Pod that mount Listeners.
93+
#[serde(default)]
94+
pub listener_volumes: Vec<String>,
8795
}
8896

8997
#[cfg(test)]
@@ -99,6 +107,7 @@ mod tests {
99107
pod: true,
100108
node: false,
101109
services: vec!["myservice".to_string()],
110+
listener_volumes: vec!["mylistener".to_string()],
102111
}),
103112
}
104113
.to_ephemeral_volume_source()
@@ -111,7 +120,7 @@ mod tests {
111120
),
112121
(
113122
"secrets.stackable.tech/scope".to_string(),
114-
"pod,service=myservice".to_string(),
123+
"pod,service=myservice,listener-volume=mylistener".to_string(),
115124
),
116125
]);
117126

crates/stackable-operator/src/kvp/annotation/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ impl Annotation {
104104
value.push_str("service=");
105105
value.push_str(name);
106106
}
107+
SecretOperatorVolumeScope::ListenerVolume { name } => {
108+
value.push_str("listener-volume=");
109+
value.push_str(name);
110+
}
107111
}
108112
}
109113

0 commit comments

Comments
 (0)