Skip to content

Commit 0045c90

Browse files
committed
Add helper function SecretOperatorVolumeSourceBuilder::with_kerberos_service_name (#568)
## Description Needed for stackabletech/hdfs-operator#334 and stackabletech/hdfs-operator#178
1 parent 941cd41 commit 0045c90

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

CHANGELOG.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ All notable changes to this project will be documented in this file.
66

77
### Added
88

9-
- Helper Method to add a restart_policy to PodBuilder([#565]).
9+
- Helper function to add a restart_policy to PodBuilder ([#565]).
10+
- Add helper function `SecretOperatorVolumeSourceBuilder::with_kerberos_service_name` ([#568]).
1011

1112
[#565]: https://github.com/stackabletech/operator-rs/pull/565
13+
[#568]: https://github.com/stackabletech/operator-rs/pull/568
1214

1315
## [0.37.0] - 2023-03-06
1416

src/builder/pod/volume.rs

+14
Original file line numberDiff line numberDiff line change
@@ -265,13 +265,15 @@ impl VolumeMountBuilder {
265265
pub struct SecretOperatorVolumeSourceBuilder {
266266
secret_class: String,
267267
scopes: Vec<SecretOperatorVolumeScope>,
268+
kerberos_service_names: Vec<String>,
268269
}
269270

270271
impl SecretOperatorVolumeSourceBuilder {
271272
pub fn new(secret_class: impl Into<String>) -> Self {
272273
Self {
273274
secret_class: secret_class.into(),
274275
scopes: Vec::new(),
276+
kerberos_service_names: Vec::new(),
275277
}
276278
}
277279

@@ -291,6 +293,11 @@ impl SecretOperatorVolumeSourceBuilder {
291293
self
292294
}
293295

296+
pub fn with_kerberos_service_name(&mut self, name: impl Into<String>) -> &mut Self {
297+
self.kerberos_service_names.push(name.into());
298+
self
299+
}
300+
294301
pub fn build(&self) -> EphemeralVolumeSource {
295302
let mut attrs = BTreeMap::from([(
296303
"secrets.stackable.tech/class".to_string(),
@@ -315,6 +322,13 @@ impl SecretOperatorVolumeSourceBuilder {
315322
attrs.insert("secrets.stackable.tech/scope".to_string(), scopes);
316323
}
317324

325+
if !self.kerberos_service_names.is_empty() {
326+
attrs.insert(
327+
"secrets.stackable.tech/kerberos.service.names".to_string(),
328+
self.kerberos_service_names.join(","),
329+
);
330+
}
331+
318332
EphemeralVolumeSource {
319333
volume_claim_template: Some(PersistentVolumeClaimTemplate {
320334
metadata: Some(ObjectMetaBuilder::new().annotations(attrs).build()),

0 commit comments

Comments
 (0)