Skip to content

Commit a94f08b

Browse files
chore: Improve code style
1 parent 168c6bb commit a94f08b

File tree

2 files changed

+12
-22
lines changed

2 files changed

+12
-22
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -464,10 +464,10 @@ impl Manager {
464464
let mut additional_trusted_certificates = vec![];
465465
for entry in additional_trust_roots {
466466
let certs = match entry {
467-
AdditionalTrustRoot::ConfigMap { config_map } => {
467+
AdditionalTrustRoot::ConfigMap(config_map) => {
468468
Self::read_certificates_from_config_map(client, config_map).await?
469469
}
470-
AdditionalTrustRoot::Secret { secret } => {
470+
AdditionalTrustRoot::Secret(secret) => {
471471
Self::read_certificates_from_secret(client, secret).await?
472472
}
473473
};

rust/operator-binary/src/crd.rs

+10-20
Original file line numberDiff line numberDiff line change
@@ -149,20 +149,14 @@ pub enum AdditionalTrustRoot {
149149
/// The extensions of the keys denote its contents: A key suffixed with `.crt` contains a stack
150150
/// of base64 encoded DER certificates, a key suffixed with `.der` contains a binary DER
151151
/// certificate.
152-
ConfigMap {
153-
#[serde(flatten)]
154-
config_map: ConfigMapReference,
155-
},
152+
ConfigMap(ConfigMapReference),
156153

157154
/// Reference (name and namespace) to a Kubernetes Secret object where additional certificates
158155
/// are stored.
159156
/// The extensions of the keys denote its contents: A key suffixed with `.crt` contains a stack
160157
/// of base64 encoded DER certificates, a key suffixed with `.der` contains a binary DER
161158
/// certificate.
162-
Secret {
163-
#[serde(flatten)]
164-
secret: SecretReference,
165-
},
159+
Secret(SecretReference),
166160
}
167161

168162
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
@@ -491,18 +485,14 @@ mod test {
491485
key_generation: CertificateKeyGeneration::default()
492486
},
493487
additional_trust_roots: vec![
494-
AdditionalTrustRoot::ConfigMap {
495-
config_map: ConfigMapReference {
496-
name: "tls-root-ca-config-map".to_string(),
497-
namespace: "default".to_string(),
498-
}
499-
},
500-
AdditionalTrustRoot::Secret {
501-
secret: SecretReference {
502-
name: "tls-root-ca-secret".to_string(),
503-
namespace: "default".to_string(),
504-
}
505-
}
488+
AdditionalTrustRoot::ConfigMap(ConfigMapReference {
489+
name: "tls-root-ca-config-map".to_string(),
490+
namespace: "default".to_string(),
491+
}),
492+
AdditionalTrustRoot::Secret(SecretReference {
493+
name: "tls-root-ca-secret".to_string(),
494+
namespace: "default".to_string(),
495+
})
506496
],
507497
max_certificate_lifetime: Duration::from_days_unchecked(31),
508498
})

0 commit comments

Comments
 (0)