Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ All notable changes to this project will be documented in this file.
- Fix a bug where changes to ConfigMaps that are referenced in the NifiCluster spec didn't trigger a reconciliation ([#772]).
- The operator now emits a warning (1.x.x) or errors out (2.x.x) if a deprecated or unsupported sensitive properties algorithm is used ([#799]).
- Allow uppercase characters in domain names ([#817]).
- NiFi v2 now exposes a metrics service (pointing to the same port as the headless service) ([#819]).
Comment thread
sbernauer marked this conversation as resolved.
Outdated

### Removed

Expand All @@ -69,6 +70,7 @@ All notable changes to this project will be documented in this file.
[#801]: https://github.com/stackabletech/nifi-operator/pull/801
[#808]: https://github.com/stackabletech/nifi-operator/pull/808
[#817]: https://github.com/stackabletech/nifi-operator/pull/817
[#819]: https://github.com/stackabletech/nifi-operator/pull/819

## [25.3.0] - 2025-03-21

Expand Down
42 changes: 25 additions & 17 deletions rust/operator-binary/src/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ use crate::{
tls::{KEYSTORE_NIFI_CONTAINER_MOUNT, KEYSTORE_VOLUME_NAME, TRUSTSTORE_VOLUME_NAME},
},
service::{
build_rolegroup_headless_service, build_rolegroup_metrics_service,
rolegroup_headless_service_name,
build_rolegroup_headless_service, build_rolegroup_metrics_service, headless_service_ports,
metrics_service_ports, rolegroup_headless_service_name,
},
};

Expand Down Expand Up @@ -562,22 +562,30 @@ pub async fn reconcile_nifi(
)
.await?;

if resolved_product_image.product_version.starts_with("1.") {
let rg_metrics_service = build_rolegroup_metrics_service(
nifi,
&rolegroup,
role_group_service_recommended_labels,
role_group_service_selector.into(),
)
.context(ServiceConfigurationSnafu)?;
// Determine the service ports to expose
// 1.X.X: extra metrics ports
// 2.X.X: via NiFi HTTP(s) port
let service_ports = if resolved_product_image.product_version.starts_with("1.") {
metrics_service_ports()
} else {
headless_service_ports()
Comment thread
sbernauer marked this conversation as resolved.
Outdated
};

cluster_resources
.add(client, rg_metrics_service)
.await
.with_context(|_| ApplyRoleGroupServiceSnafu {
rolegroup: rolegroup.clone(),
})?;
}
let rg_metrics_service = build_rolegroup_metrics_service(
nifi,
&rolegroup,
role_group_service_recommended_labels,
role_group_service_selector.into(),
service_ports,
)
.context(ServiceConfigurationSnafu)?;

cluster_resources
.add(client, rg_metrics_service)
.await
.with_context(|_| ApplyRoleGroupServiceSnafu {
rolegroup: rolegroup.clone(),
})?;

cluster_resources
.add(client, rg_headless_service)
Expand Down
7 changes: 4 additions & 3 deletions rust/operator-binary/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ pub fn build_rolegroup_metrics_service(
role_group_ref: &RoleGroupRef<v1alpha1::NifiCluster>,
object_labels: ObjectLabels<v1alpha1::NifiCluster>,
selector: BTreeMap<String, String>,
ports: Vec<ServicePort>,
) -> Result<Service, Error> {
Ok(Service {
metadata: ObjectMetaBuilder::new()
Expand All @@ -86,7 +87,7 @@ pub fn build_rolegroup_metrics_service(
// Internal communication does not need to be exposed
type_: Some("ClusterIP".to_string()),
cluster_ip: Some("None".to_string()),
ports: Some(metrics_service_ports()),
ports: Some(ports),
selector: Some(selector),
publish_not_ready_addresses: Some(true),
..ServiceSpec::default()
Expand All @@ -95,7 +96,7 @@ pub fn build_rolegroup_metrics_service(
})
}

fn headless_service_ports() -> Vec<ServicePort> {
pub fn headless_service_ports() -> Vec<ServicePort> {
vec![ServicePort {
name: Some(HTTPS_PORT_NAME.into()),
port: HTTPS_PORT.into(),
Expand All @@ -104,7 +105,7 @@ fn headless_service_ports() -> Vec<ServicePort> {
}]
}

fn metrics_service_ports() -> Vec<ServicePort> {
pub fn metrics_service_ports() -> Vec<ServicePort> {
Comment thread
sbernauer marked this conversation as resolved.
Outdated
vec![ServicePort {
name: Some(METRICS_PORT_NAME.to_string()),
port: METRICS_PORT.into(),
Expand Down
15 changes: 13 additions & 2 deletions tests/templates/kuttl/external-access/30-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ status:
readyReplicas: 2
replicas: 2
---
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
Expand All @@ -25,11 +24,23 @@ status:
currentHealthy: 2
disruptionsAllowed: 1
---
---
apiVersion: v1
kind: Service
metadata:
name: test-nifi-node
spec:
type: NodePort # external-unstable
---
apiVersion: v1
kind: Service
metadata:
name: test-nifi-node-default-headless
spec:
type: ClusterIP
---
apiVersion: v1
kind: Service
metadata:
name: test-nifi-node-default-metrics
spec:
type: ClusterIP