Skip to content

Commit 362114c

Browse files
authored
fix: Add metrics Service SAN to NiFis certificate (#822)
* fix: Add metrics Service SAN to NiFis certificate * changelog * clippy
1 parent 3c14d1e commit 362114c

File tree

6 files changed

+14
-11
lines changed

6 files changed

+14
-11
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ All notable changes to this project will be documented in this file.
77
### Added
88

99
- Add rolling upgrade support for upgrades between NiFi 2 versions ([#771]).
10-
- BREAKING: Added Listener support for NiFi ([#784], [#818], [#819]).
10+
- BREAKING: Added Listener support for NiFi ([#784], [#818], [#819], [#822]).
1111
- Adds new telemetry CLI arguments and environment variables ([#782]).
1212
- Use `--file-log-max-files` (or `FILE_LOG_MAX_FILES`) to limit the number of log files kept.
1313
- Use `--file-log-rotation-period` (or `FILE_LOG_ROTATION_PERIOD`) to configure the frequency of rotation.
@@ -71,6 +71,7 @@ All notable changes to this project will be documented in this file.
7171
[#817]: https://github.com/stackabletech/nifi-operator/pull/817
7272
[#818]: https://github.com/stackabletech/nifi-operator/pull/818
7373
[#819]: https://github.com/stackabletech/nifi-operator/pull/819
74+
[#822]: https://github.com/stackabletech/nifi-operator/pull/822
7475

7576
## [25.3.0] - 2025-03-21
7677

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: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ pub fn build_rolegroup_metrics_service(
7474
Ok(Service {
7575
metadata: ObjectMetaBuilder::new()
7676
.name_and_namespace(nifi)
77-
.name(rolegroup_metrics_service_name(
78-
&role_group_ref.object_name(),
79-
))
77+
.name(rolegroup_metrics_service_name(role_group_ref.object_name()))
8078
.ownerreference_from_resource(nifi, None, Some(true))
8179
.context(ObjectMissingMetadataForOwnerRefSnafu)?
8280
.with_recommended_labels(object_labels)
@@ -127,7 +125,8 @@ pub fn metrics_service_port(product_version: &str) -> ServicePort {
127125
}
128126

129127
/// 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 {
128+
pub fn rolegroup_metrics_service_name(role_group_ref_object_name: impl AsRef<str>) -> String {
129+
let role_group_ref_object_name = role_group_ref_object_name.as_ref();
131130
format!("{role_group_ref_object_name}-{METRICS_SERVICE_SUFFIX}")
132131
}
133132

0 commit comments

Comments
 (0)