Skip to content

Commit 3d7a4d1

Browse files
feat: Enable restart controller (#833)
* feat: Enable restart controller * changelog * Update Cargo.toml Co-authored-by: Malte Sander <malte.sander.it@gmail.com> --------- Co-authored-by: Malte Sander <malte.sander.it@gmail.com>
1 parent 1f05551 commit 3d7a4d1

File tree

8 files changed

+98
-87
lines changed

8 files changed

+98
-87
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ 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 ([#831]).
11+
- Enable the [restart-controller](https://docs.stackable.tech/home/nightly/commons-operator/restarter/), so that the Pods are automatically restarted on config changes ([#833]).
1112

1213
### Changed
1314

1415
- Pin k8s-openapi to `0.26.0` ([#831]).
1516

1617
[#831]: https://github.com/stackabletech/trino-operator/pull/831
18+
[#833]: https://github.com/stackabletech/trino-operator/pull/833
1719

1820
## [25.11.0] - 2025-11-07
1921

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/trino-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", features = ["telemetry", "versioned"], tag = "stackable-operator-0.101.2" }
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
async-trait = "0.1"

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: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ use stackable_operator::{
3333
product_image_selection::{self, ResolvedProductImage},
3434
rbac::build_rbac_resources,
3535
},
36+
constants::RESTART_CONTROLLER_ENABLED_LABEL,
3637
k8s_openapi::{
3738
DeepMerge,
3839
api::{
@@ -662,6 +663,9 @@ pub async fn reconcile_trino(
662663
rolegroup: role_group_ref.clone(),
663664
})?;
664665

666+
// Note: The StatefulSet needs to be applied after all ConfigMaps and Secrets it mounts
667+
// to prevent unnecessary Pod restarts.
668+
// See https://github.com/stackabletech/commons-operator/issues/111 for details.
665669
sts_cond_builder.add(
666670
cluster_resources
667671
.add(client, rg_stateful_set)
@@ -1387,6 +1391,7 @@ fn build_rolegroup_statefulset(
13871391
&role_group_ref.role_group,
13881392
))
13891393
.context(MetadataBuildSnafu)?
1394+
.with_label(RESTART_CONTROLLER_ENABLED_LABEL.to_owned())
13901395
.build(),
13911396
spec: Some(StatefulSetSpec {
13921397
pod_management_policy: Some("Parallel".to_string()),

tests/templates/kuttl/smoke/10-assert.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ apiVersion: apps/v1
99
kind: StatefulSet
1010
metadata:
1111
name: trino-coordinator-default
12+
generation: 1 # There should be no unneeded Pod restarts
1213
spec:
1314
template:
1415
spec:
@@ -21,6 +22,7 @@ apiVersion: apps/v1
2122
kind: StatefulSet
2223
metadata:
2324
name: trino-worker-default
25+
generation: 1 # There should be no unneeded Pod restarts
2426
spec:
2527
template:
2628
spec:

tests/templates/kuttl/smoke/10-install-trino.yaml.j2

Lines changed: 58 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,4 @@
11
---
2-
apiVersion: trino.stackable.tech/v1alpha1
3-
kind: TrinoCluster
4-
metadata:
5-
name: trino
6-
spec:
7-
image:
8-
{% if test_scenario['values']['trino'].find(",") > 0 %}
9-
custom: "{{ test_scenario['values']['trino'].split(',')[1] }}"
10-
productVersion: "{{ test_scenario['values']['trino'].split(',')[0] }}"
11-
{% else %}
12-
productVersion: "{{ test_scenario['values']['trino'] }}"
13-
{% endif %}
14-
pullPolicy: IfNotPresent
15-
clusterConfig:
16-
catalogLabelSelector:
17-
matchLabels:
18-
trino: trino
19-
authentication:
20-
- authenticationClass: trino-users-auth
21-
authorization:
22-
opa:
23-
configMapName: opa
24-
package: trino
25-
{% if lookup('env', 'VECTOR_AGGREGATOR') %}
26-
vectorAggregatorConfigMapName: vector-aggregator-discovery
27-
{% endif %}
28-
coordinators:
29-
config:
30-
logging:
31-
enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }}
32-
envOverrides:
33-
COMMON_VAR: role-value # overridden by role group below
34-
ROLE_VAR: role-value # only defined here at role level
35-
roleGroups:
36-
default:
37-
replicas: 1
38-
config: {}
39-
envOverrides:
40-
COMMON_VAR: group-value # overrides role value
41-
GROUP_VAR: group-value # only defined here at group level
42-
workers:
43-
config:
44-
gracefulShutdownTimeout: 5s # Let the test run faster
45-
logging:
46-
enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }}
47-
envOverrides:
48-
COMMON_VAR: role-value # overridden by role group below
49-
ROLE_VAR: role-value # only defined here at role level
50-
roleGroups:
51-
default:
52-
replicas: 1
53-
config: {}
54-
envOverrides:
55-
COMMON_VAR: group-value # overrides role value
56-
GROUP_VAR: group-value # only defined here at group level
57-
---
582
apiVersion: authentication.stackable.tech/v1alpha1
593
kind: AuthenticationClass
604
metadata:
@@ -147,3 +91,61 @@ metadata:
14791
stringData:
14892
user: hive
14993
password: hive
94+
---
95+
# We need to create the TrinoCluster last, so that the ConfigMaps/Secrets it mounts are already
96+
# existing to prevent unnecessary Pod restarts.
97+
apiVersion: trino.stackable.tech/v1alpha1
98+
kind: TrinoCluster
99+
metadata:
100+
name: trino
101+
spec:
102+
image:
103+
{% if test_scenario['values']['trino'].find(",") > 0 %}
104+
custom: "{{ test_scenario['values']['trino'].split(',')[1] }}"
105+
productVersion: "{{ test_scenario['values']['trino'].split(',')[0] }}"
106+
{% else %}
107+
productVersion: "{{ test_scenario['values']['trino'] }}"
108+
{% endif %}
109+
pullPolicy: IfNotPresent
110+
clusterConfig:
111+
catalogLabelSelector:
112+
matchLabels:
113+
trino: trino
114+
authentication:
115+
- authenticationClass: trino-users-auth
116+
authorization:
117+
opa:
118+
configMapName: opa
119+
package: trino
120+
{% if lookup('env', 'VECTOR_AGGREGATOR') %}
121+
vectorAggregatorConfigMapName: vector-aggregator-discovery
122+
{% endif %}
123+
coordinators:
124+
config:
125+
logging:
126+
enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }}
127+
envOverrides:
128+
COMMON_VAR: role-value # overridden by role group below
129+
ROLE_VAR: role-value # only defined here at role level
130+
roleGroups:
131+
default:
132+
replicas: 1
133+
config: {}
134+
envOverrides:
135+
COMMON_VAR: group-value # overrides role value
136+
GROUP_VAR: group-value # only defined here at group level
137+
workers:
138+
config:
139+
gracefulShutdownTimeout: 5s # Let the test run faster
140+
logging:
141+
enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }}
142+
envOverrides:
143+
COMMON_VAR: role-value # overridden by role group below
144+
ROLE_VAR: role-value # only defined here at role level
145+
roleGroups:
146+
default:
147+
replicas: 1
148+
config: {}
149+
envOverrides:
150+
COMMON_VAR: group-value # overrides role value
151+
GROUP_VAR: group-value # only defined here at group level

0 commit comments

Comments
 (0)