|
1 | 1 | //! Builds the per-rolegroup [`StatefulSet`] that runs a Trino role group. |
2 | 2 |
|
3 | | -use std::{collections::BTreeMap, convert::Infallible, str::FromStr}; |
| 3 | +use std::{convert::Infallible, str::FromStr}; |
4 | 4 |
|
5 | 5 | use snafu::{OptionExt, ResultExt, Snafu}; |
6 | 6 | use stackable_operator::{ |
@@ -30,13 +30,16 @@ use stackable_operator::{ |
30 | 30 | }, |
31 | 31 | apimachinery::pkg::{apis::meta::v1::LabelSelector, util::intstr::IntOrString}, |
32 | 32 | }, |
33 | | - kvp::{Annotation, Annotations}, |
| 33 | + kvp::Annotation, |
34 | 34 | product_logging, |
35 | 35 | shared::time::Duration, |
36 | 36 | v2::{ |
37 | | - builder::{meta::ownerreference_from_resource, pod::container::EnvVarSet}, |
| 37 | + builder::{ |
| 38 | + meta::ownerreference_from_resource, pod::container::EnvVarSet, |
| 39 | + statefulset::restarter_ignore_secret_annotations, |
| 40 | + }, |
38 | 41 | product_logging::framework::{ValidatedContainerLogConfigChoice, vector_container}, |
39 | | - types::kubernetes::{ContainerName, VolumeName}, |
| 42 | + types::kubernetes::{ContainerName, SecretName, VolumeName}, |
40 | 43 | }, |
41 | 44 | }; |
42 | 45 |
|
@@ -102,6 +105,11 @@ pub enum Error { |
102 | 105 | source: stackable_operator::kvp::KeyValuePairError<Infallible>, |
103 | 106 | }, |
104 | 107 |
|
| 108 | + #[snafu(display("failed to parse hot-reloaded Secret name"))] |
| 109 | + ParseSecretName { |
| 110 | + source: stackable_operator::v2::macros::attributed_string_type::Error, |
| 111 | + }, |
| 112 | + |
105 | 113 | #[snafu(display("failed to build Metadata"))] |
106 | 114 | MetadataBuild { |
107 | 115 | source: stackable_operator::builder::meta::Error, |
@@ -443,20 +451,14 @@ pub fn build_rolegroup_statefulset( |
443 | 451 | pod_template.merge_from(role.config.pod_overrides.clone()); |
444 | 452 | pod_template.merge_from(rolegroup.config.pod_overrides.clone()); |
445 | 453 |
|
446 | | - let ignore_secret_annotations = trino_authentication_config |
| 454 | + let ignore_secrets = trino_authentication_config |
447 | 455 | .hot_reloaded_secrets() |
448 | 456 | .iter() |
449 | | - .enumerate() |
450 | | - .map(|(i, secret_name)| { |
451 | | - ( |
452 | | - format!("restarter.stackable.tech/ignore-secret.{i}"), |
453 | | - secret_name, |
454 | | - ) |
455 | | - }) |
456 | | - .collect::<BTreeMap<_, _>>(); |
| 457 | + .map(|secret_name| SecretName::from_str(secret_name)) |
| 458 | + .collect::<std::result::Result<Vec<_>, _>>() |
| 459 | + .context(ParseSecretNameSnafu)?; |
457 | 460 |
|
458 | | - let annotations = |
459 | | - Annotations::try_from(ignore_secret_annotations).context(AnnotationBuildSnafu)?; |
| 461 | + let annotations = restarter_ignore_secret_annotations(ignore_secrets); |
460 | 462 |
|
461 | 463 | Ok(StatefulSet { |
462 | 464 | metadata: ObjectMetaBuilder::new() |
|
0 commit comments