Skip to content

Commit 3757715

Browse files
chore: Address review comments
1 parent 0328e3f commit 3757715

4 files changed

Lines changed: 20 additions & 15 deletions

File tree

extra/crds.yaml

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/operator-binary/src/backend/tls/ca.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -753,13 +753,13 @@ mod tests {
753753
datetime!(2025-01-01 0:00 UTC),
754754
datetime!(2025-01-01 12:00 UTC),
755755
)
756-
.expect("should create a valid certificate");
756+
.expect("must be able to create a valid certificate");
757757
let ca2 = create_certificate_authority(
758758
2,
759759
datetime!(2025-01-01 6:00 UTC),
760760
datetime!(2025-01-01 18:00 UTC),
761761
)
762-
.expect("should create a valid certificate");
762+
.expect("must be able to create a valid certificate");
763763

764764
let manager = Manager {
765765
source_secret: ObjectRef::<Secret>::new("secret-provisioner-tls-ca"),
@@ -794,30 +794,30 @@ mod tests {
794794
datetime!(2025-01-01 0:00 UTC),
795795
datetime!(2025-01-01 12:00 UTC),
796796
)
797-
.expect("should create a valid certificate");
797+
.expect("must be able to create a valid certificate");
798798
let ca1_certificate = ca1.certificate.clone();
799799

800800
let ca2 = create_certificate_authority(
801801
2,
802802
datetime!(2025-01-01 6:00 UTC),
803803
datetime!(2025-01-01 18:00 UTC),
804804
)
805-
.expect("should create a valid certificate");
805+
.expect("must be able to create a valid certificate");
806806
let ca2_certificate = ca2.certificate.clone();
807807

808808
let (trust_root1, _) = create_certificate(
809809
3,
810810
datetime!(2025-01-01 0:00 UTC),
811811
datetime!(2025-01-01 12:00 UTC),
812812
)
813-
.expect("should create a valid certificate");
813+
.expect("must be able to create a valid certificate");
814814

815815
let (trust_root2, _) = create_certificate(
816816
4,
817817
datetime!(2025-01-01 6:00 UTC),
818818
datetime!(2025-01-01 18:00 UTC),
819819
)
820-
.expect("should create a valid certificate");
820+
.expect("must be able to create a valid certificate");
821821

822822
let manager = Manager {
823823
source_secret: ObjectRef::<Secret>::new("secret-provisioner-tls-ca"),

rust/operator-binary/src/backend/tls/mod.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -428,14 +428,16 @@ impl SecretBackend for TlsGenerate {
428428
_selector: &super::TrustSelector,
429429
) -> Result<SecretContents, Self::Error> {
430430
let now = OffsetDateTime::now_utc();
431+
let active_trust_roots = self.ca_manager.trust_roots(now);
432+
let pems = active_trust_roots.into_iter().map(|ca| {
433+
ca.to_pem()
434+
.context(SerializeCertificateSnafu { tpe: CertType::Ca })
435+
});
436+
let concatenated_pem = iterator_try_concat_bytes(pems)?;
437+
431438
Ok(SecretContents::new(SecretData::WellKnown(
432439
WellKnownSecretData::TlsPem(well_known::TlsPem {
433-
ca_pem: iterator_try_concat_bytes(
434-
self.ca_manager.trust_roots(now).into_iter().map(|ca| {
435-
ca.to_pem()
436-
.context(SerializeCertificateSnafu { tpe: CertType::Ca })
437-
}),
438-
)?,
440+
ca_pem: concatenated_pem,
439441
certificate_pem: None,
440442
key_pem: None,
441443
}),

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ pub mod versioned {
164164

165165
/// Duration at the end of the CA certificate lifetime where no signed certificate will exist.
166166
///
167-
/// Retired (or expired) CA certificates will not be published.
167+
/// Retired (or expired) CA certificates will not be published and will not be used for
168+
/// signing leaf certificates.
168169
#[serde(default = "v1alpha2::AutoTlsCa::default_ca_certificate_retirement_duration")]
169170
pub ca_certificate_retirement_duration: Duration,
170171

0 commit comments

Comments
 (0)