Skip to content

Commit 558afa8

Browse files
committed
fix: Add metrics Service SAN to NiFis certificate
1 parent 3c14d1e commit 558afa8

5 files changed

Lines changed: 11 additions & 7 deletions

File tree

rust/operator-binary/src/controller.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ use crate::{
109109
},
110110
service::{
111111
build_rolegroup_headless_service, build_rolegroup_metrics_service, metrics_service_port,
112-
rolegroup_headless_service_name,
112+
rolegroup_headless_service_name, rolegroup_metrics_service_name,
113113
},
114114
};
115115

@@ -1347,7 +1347,10 @@ async fn build_node_rolegroup_statefulset(
13471347
build_tls_volume(
13481348
nifi,
13491349
KEYSTORE_VOLUME_NAME,
1350-
vec![&build_reporting_task_service_name(&nifi_cluster_name)],
1350+
[
1351+
rolegroup_metrics_service_name(rolegroup_ref.object_name()),
1352+
build_reporting_task_service_name(&nifi_cluster_name),
1353+
],
13511354
SecretFormat::TlsPkcs12,
13521355
&requested_secret_lifetime,
13531356
Some(LISTENER_VOLUME_NAME),

rust/operator-binary/src/reporting_task/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ fn build_reporting_task_job(
350350
build_tls_volume(
351351
nifi,
352352
REPORTING_TASK_CERT_VOLUME_NAME,
353-
vec![],
353+
Vec::<String>::new(),
354354
SecretFormat::TlsPem,
355355
// The certificate is only used for the REST API call, so a short lifetime is sufficient.
356356
// There is no correct way to configure this job since it's an implementation detail.

rust/operator-binary/src/security/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub async fn check_or_generate_oidc_admin_password(
4747
pub fn build_tls_volume(
4848
nifi: &v1alpha1::NifiCluster,
4949
volume_name: &str,
50-
service_scopes: Vec<&str>,
50+
service_scopes: impl IntoIterator<Item = impl AsRef<str>>,
5151
secret_format: SecretFormat,
5252
requested_secret_lifetime: &Duration,
5353
listener_scope: Option<&str>,

rust/operator-binary/src/security/tls.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub enum Error {
2424
pub(crate) fn build_tls_volume(
2525
nifi: &v1alpha1::NifiCluster,
2626
volume_name: &str,
27-
service_scopes: Vec<&str>,
27+
service_scopes: impl IntoIterator<Item = impl AsRef<str>>,
2828
secret_format: SecretFormat,
2929
requested_secret_lifetime: &Duration,
3030
listener_scope: Option<&str>,
@@ -36,7 +36,7 @@ pub(crate) fn build_tls_volume(
3636
secret_volume_source_builder.with_tls_pkcs12_password(STACKABLE_TLS_STORE_PASSWORD);
3737
}
3838
for scope in service_scopes {
39-
secret_volume_source_builder.with_service_scope(scope);
39+
secret_volume_source_builder.with_service_scope(scope.as_ref());
4040
}
4141
if let Some(listener_scope) = listener_scope {
4242
secret_volume_source_builder.with_listener_volume_scope(listener_scope);

rust/operator-binary/src/service.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ pub fn metrics_service_port(product_version: &str) -> ServicePort {
127127
}
128128

129129
/// Returns the metrics rolegroup service name `<cluster>-<role>-<rolegroup>-<METRICS_SERVICE_SUFFIX>`.
130-
fn rolegroup_metrics_service_name(role_group_ref_object_name: &str) -> String {
130+
pub fn rolegroup_metrics_service_name(role_group_ref_object_name: impl AsRef<str>) -> String {
131+
let role_group_ref_object_name = role_group_ref_object_name.as_ref();
131132
format!("{role_group_ref_object_name}-{METRICS_SERVICE_SUFFIX}")
132133
}
133134

0 commit comments

Comments
 (0)