Skip to content

Commit b160e08

Browse files
authored
feat: Enable restart controller (#888)
* feat: Enable restart controller * changelog * Remove generation assertion
1 parent 62b3f40 commit b160e08

File tree

10 files changed

+115
-99
lines changed

10 files changed

+115
-99
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file.
88

99
- Support objectOverrides using `.spec.objectOverrides`.
1010
See [objectOverrides concepts page](https://docs.stackable.tech/home/nightly/concepts/overrides/#object-overrides) for details ([#885]).
11+
- Enable the [restart-controller](https://docs.stackable.tech/home/nightly/commons-operator/restarter/), so that the Pods are automatically restarted on config changes ([#888]).
1112

1213
### Changed
1314

@@ -23,6 +24,7 @@ All notable changes to this project will be documented in this file.
2324
[#881]: https://github.com/stackabletech/nifi-operator/pull/881
2425
[#884]: https://github.com/stackabletech/nifi-operator/pull/884
2526
[#885]: https://github.com/stackabletech/nifi-operator/pull/885
27+
[#888]: https://github.com/stackabletech/nifi-operator/pull/888
2628

2729
## [25.11.0] - 2025-11-07
2830

Cargo.lock

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

Cargo.nix

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

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ repository = "https://github.com/stackabletech/nifi-operator"
1111

1212
[workspace.dependencies]
1313
product-config = { git = "https://github.com/stackabletech/product-config.git", tag = "0.8.0" }
14-
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.101.2", features = ["telemetry", "versioned"] }
14+
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.102.0", features = ["telemetry", "versioned"] }
1515

1616
anyhow = "1.0"
1717
built = { version = "0.8", features = ["chrono", "git2"] }

crate-hashes.json

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

rust/operator-binary/src/controller.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ use stackable_operator::{
3030
product_image_selection::{self, ResolvedProductImage},
3131
rbac::build_rbac_resources,
3232
},
33+
constants::RESTART_CONTROLLER_ENABLED_LABEL,
3334
crd::{authentication::oidc::v1alpha1::AuthenticationProvider, git_sync},
3435
k8s_openapi::{
3536
DeepMerge,
@@ -598,6 +599,10 @@ pub async fn reconcile_nifi(
598599
.with_context(|_| ApplyRoleGroupConfigSnafu {
599600
rolegroup: rolegroup.clone(),
600601
})?;
602+
603+
// Note: The StatefulSet needs to be applied after all ConfigMaps and Secrets it mounts
604+
// to prevent unnecessary Pod restarts.
605+
// See https://github.com/stackabletech/commons-operator/issues/111 for details.
601606
ss_cond_builder.add(
602607
cluster_resources
603608
.add(client, rg_statefulset)
@@ -1416,6 +1421,7 @@ async fn build_node_rolegroup_statefulset(
14161421
.context(ObjectMissingMetadataForOwnerRefSnafu)?
14171422
.with_recommended_labels(recommended_object_labels)
14181423
.context(MetadataBuildSnafu)?
1424+
.with_label(RESTART_CONTROLLER_ENABLED_LABEL.to_owned())
14191425
.build(),
14201426
spec: Some(StatefulSetSpec {
14211427
pod_management_policy: Some("Parallel".to_string()),

tests/templates/kuttl/smoke_v1/30-assert.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ apiVersion: apps/v1
77
kind: StatefulSet
88
metadata:
99
name: nifi-node-default
10+
labels:
11+
restarter.stackable.tech/enabled: "true"
1012
spec:
1113
template:
1214
spec:

tests/templates/kuttl/smoke_v1/30-install-nifi.yaml.j2

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,39 @@
11
---
2+
apiVersion: authentication.stackable.tech/v1alpha1
3+
kind: AuthenticationClass
4+
metadata:
5+
name: nifi-users
6+
spec:
7+
provider:
8+
static:
9+
userCredentialsSecret:
10+
name: nifi-users
11+
---
12+
apiVersion: v1
13+
kind: Secret
14+
metadata:
15+
name: nifi-users
16+
stringData:
17+
admin: >
18+
passwordWithSpecialCharacter\@<&>"'
19+
---
20+
apiVersion: v1
21+
kind: Secret
22+
metadata:
23+
name: nifi-sensitive-property-key
24+
stringData:
25+
nifiSensitivePropsKey: mYsUp3rS3cr3tk3y
26+
---
27+
apiVersion: zookeeper.stackable.tech/v1alpha1
28+
kind: ZookeeperZnode
29+
metadata:
30+
name: nifi-znode
31+
spec:
32+
clusterRef:
33+
name: zookeeper
34+
---
35+
# We need to create the NifiCluster last, so that the ConfigMaps/Secrets it mounts are already
36+
# existing to prevent unnecessary Pod restarts.
237
apiVersion: nifi.stackable.tech/v1alpha1
338
kind: NifiCluster
439
metadata:
@@ -49,36 +84,3 @@ spec:
4984
"nifi.properties":
5085
"nifi.diagnostics.on.shutdown.enabled": "false"
5186
"nifi.diagnostics.on.shutdown.max.filecount": "20"
52-
---
53-
apiVersion: authentication.stackable.tech/v1alpha1
54-
kind: AuthenticationClass
55-
metadata:
56-
name: nifi-users
57-
spec:
58-
provider:
59-
static:
60-
userCredentialsSecret:
61-
name: nifi-users
62-
---
63-
apiVersion: v1
64-
kind: Secret
65-
metadata:
66-
name: nifi-users
67-
stringData:
68-
admin: >
69-
passwordWithSpecialCharacter\@<&>"'
70-
---
71-
apiVersion: v1
72-
kind: Secret
73-
metadata:
74-
name: nifi-sensitive-property-key
75-
stringData:
76-
nifiSensitivePropsKey: mYsUp3rS3cr3tk3y
77-
---
78-
apiVersion: zookeeper.stackable.tech/v1alpha1
79-
kind: ZookeeperZnode
80-
metadata:
81-
name: nifi-znode
82-
spec:
83-
clusterRef:
84-
name: zookeeper

tests/templates/kuttl/smoke_v2/30-assert.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ apiVersion: apps/v1
77
kind: StatefulSet
88
metadata:
99
name: nifi-node-default
10+
labels:
11+
restarter.stackable.tech/enabled: "true"
1012
spec:
1113
template:
1214
spec:

tests/templates/kuttl/smoke_v2/30-install-nifi.yaml.j2

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,41 @@
11
---
2+
apiVersion: authentication.stackable.tech/v1alpha1
3+
kind: AuthenticationClass
4+
metadata:
5+
name: nifi-users
6+
spec:
7+
provider:
8+
static:
9+
userCredentialsSecret:
10+
name: nifi-users
11+
---
12+
apiVersion: v1
13+
kind: Secret
14+
metadata:
15+
name: nifi-users
16+
stringData:
17+
admin: >
18+
passwordWithSpecialCharacter\@<&>"'
19+
---
20+
apiVersion: v1
21+
kind: Secret
22+
metadata:
23+
name: nifi-sensitive-property-key
24+
stringData:
25+
nifiSensitivePropsKey: mYsUp3rS3cr3tk3y
26+
{% if test_scenario['values']['use-zookeeper-manager'] == 'true' %}
27+
---
28+
apiVersion: zookeeper.stackable.tech/v1alpha1
29+
kind: ZookeeperZnode
30+
metadata:
31+
name: nifi-znode
32+
spec:
33+
clusterRef:
34+
name: zookeeper
35+
{% endif %}
36+
---
37+
# We need to create the NifiCluster last, so that the ConfigMaps/Secrets it mounts are already
38+
# existing to prevent unnecessary Pod restarts.
239
apiVersion: nifi.stackable.tech/v1alpha1
340
kind: NifiCluster
441
metadata:
@@ -51,38 +88,3 @@ spec:
5188
"nifi.properties":
5289
"nifi.diagnostics.on.shutdown.enabled": "false"
5390
"nifi.diagnostics.on.shutdown.max.filecount": "20"
54-
---
55-
apiVersion: authentication.stackable.tech/v1alpha1
56-
kind: AuthenticationClass
57-
metadata:
58-
name: nifi-users
59-
spec:
60-
provider:
61-
static:
62-
userCredentialsSecret:
63-
name: nifi-users
64-
---
65-
apiVersion: v1
66-
kind: Secret
67-
metadata:
68-
name: nifi-users
69-
stringData:
70-
admin: >
71-
passwordWithSpecialCharacter\@<&>"'
72-
---
73-
apiVersion: v1
74-
kind: Secret
75-
metadata:
76-
name: nifi-sensitive-property-key
77-
stringData:
78-
nifiSensitivePropsKey: mYsUp3rS3cr3tk3y
79-
{% if test_scenario['values']['use-zookeeper-manager'] == 'true' %}
80-
---
81-
apiVersion: zookeeper.stackable.tech/v1alpha1
82-
kind: ZookeeperZnode
83-
metadata:
84-
name: nifi-znode
85-
spec:
86-
clusterRef:
87-
name: zookeeper
88-
{% endif %}

0 commit comments

Comments
 (0)