Skip to content

Add listener volume scope for secret volume builders #858

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions crates/stackable-operator/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file.
### Added

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

### Changed

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

## [0.74.0] - 2024-08-22

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

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

## [0.71.0] - 2024-07-29

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

[#644]: https://github.com/stackabletech/operator-rs/pull/644
[#645]: https://github.com/stackabletech/operator-rs/pull/645

### Changed

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

### Changed

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

### Removed

Expand Down
7 changes: 7 additions & 0 deletions crates/stackable-operator/src/builder/pod/volume.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,12 @@ impl SecretOperatorVolumeSourceBuilder {
self
}

pub fn with_listener_volume_scope(&mut self, name: impl Into<String>) -> &mut Self {
self.scopes
.push(SecretOperatorVolumeScope::ListenerVolume { name: name.into() });
self
}

pub fn with_format(&mut self, format: SecretFormat) -> &mut Self {
self.format = Some(format);
self
Expand Down Expand Up @@ -394,6 +400,7 @@ pub enum SecretOperatorVolumeScope {
Node,
Pod,
Service { name: String },
ListenerVolume { name: String },
}

/// Reference to a listener class or listener name
Expand Down
11 changes: 10 additions & 1 deletion crates/stackable-operator/src/commons/secret_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ impl SecretClassVolume {
for service in &scope.services {
secret_operator_volume_builder.with_service_scope(service);
}
for listener_volume in &scope.listener_volumes {
secret_operator_volume_builder.with_listener_volume_scope(listener_volume);
}
}

secret_operator_volume_builder
Expand Down Expand Up @@ -84,6 +87,11 @@ pub struct SecretClassVolumeScope {
/// This should typically correspond to Service objects that the Pod participates in.
#[serde(default)]
pub services: Vec<String>,

/// The listener volume scope allows Node and Service scopes to be inferred from the applicable listeners.
/// This must correspond to Volume names in the Pod that mount Listeners.
#[serde(default)]
pub listener_volumes: Vec<String>,
}

#[cfg(test)]
Expand All @@ -99,6 +107,7 @@ mod tests {
pod: true,
node: false,
services: vec!["myservice".to_string()],
listener_volumes: vec!["mylistener".to_string()],
}),
}
.to_ephemeral_volume_source()
Expand All @@ -111,7 +120,7 @@ mod tests {
),
(
"secrets.stackable.tech/scope".to_string(),
"pod,service=myservice".to_string(),
"pod,service=myservice,listener-volume=mylistener".to_string(),
),
]);

Expand Down
4 changes: 4 additions & 0 deletions crates/stackable-operator/src/kvp/annotation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ impl Annotation {
value.push_str("service=");
value.push_str(name);
}
SecretOperatorVolumeScope::ListenerVolume { name } => {
value.push_str("listener-volume=");
value.push_str(name);
}
}
}

Expand Down
Loading