Skip to content

Commit 163dc7b

Browse files
authored
fix!: Remove unused PVCs which caused problems (#769)
* fix!: Remove unused PVCs which caused problems * changelog * docs: Document why we need to provide an empty struct * remove missleading leftover comment * Update tests and docs
1 parent 06cb1ff commit 163dc7b

File tree

9 files changed

+34
-311
lines changed

9 files changed

+34
-311
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@ All notable changes to this project will be documented in this file.
3939

4040
- Use `json` file extension for log files ([#733]).
4141
- Fix a bug where changes to ConfigMaps that are referenced in the TrinoCluster spec didn't trigger a reconciliation ([#734]).
42+
- BREAKING: The PersistentVolumeClaims for coordinator and workers have been removed ([#769])
43+
- They caused problems, as Trino kept it's process ID in `/stackable/data/var/run/launcher.pid`.
44+
A forceful stop (e.g. OOMKilled) could result in a leftover PID in this file.
45+
In this case Trino would refuse startup with `trino ERROR: already running as 21`.
46+
As the PersistentVolumeClaims didn't store any actual data, they have been removed.
47+
- Upgrading will result in the error message `Failed to reconcile object [...]: Forbidden: updates to statefulset spec for fields other than [...] are forbidden`
48+
as Kubernetes currently does not allow changing the `volumeClaimTemplates` field. Simply delete the mentioned StatefulSet, the operator will re-create it.
49+
- You might want to clean up now useless PVCs.
50+
Tip: You can list all Trino-related PVCs using `kubectl get pvc -l app.kubernetes.io/name=trino`.
51+
- The `.spec.(coordinators|workers).config.resources.storage.data` field has been removed, as it's not needed anymore.
4252

4353
### Removed
4454

@@ -58,6 +68,7 @@ All notable changes to this project will be documented in this file.
5868
[#755]: https://github.com/stackabletech/trino-operator/pull/755
5969
[#760]: https://github.com/stackabletech/trino-operator/pull/760
6070
[#766]: https://github.com/stackabletech/trino-operator/pull/766
71+
[#769]: https://github.com/stackabletech/trino-operator/pull/769
6172

6273
## [25.3.0] - 2025-03-21
6374

deploy/helm/trino-operator/crds/crds.yaml

Lines changed: 4 additions & 188 deletions
Large diffs are not rendered by default.

docs/modules/trino/pages/usage-guide/configuration.adoc

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -108,36 +108,7 @@ workers:
108108

109109
Here too, overriding properties such as `http-server.https.port` will lead to broken installations.
110110

111-
== Resources
112-
113-
=== Storage for data volumes
114-
115-
You can mount a volume where data (config and logs of Trino) is stored by specifying https://kubernetes.io/docs/concepts/storage/persistent-volumes[PersistentVolumeClaims] for each individual role or role group:
116-
117-
[source,yaml]
118-
----
119-
workers:
120-
config:
121-
resources:
122-
storage:
123-
data:
124-
capacity: 2Gi
125-
roleGroups:
126-
default:
127-
config:
128-
resources:
129-
storage:
130-
data:
131-
capacity: 3Gi
132-
----
133-
134-
In the above example, all Trino workers in the default group store data (the location of the property `--data-dir`) on a `3Gi` volume.
135-
Additional role groups not specifying any resources inherit the config provided on the role level (`2Gi` volume).
136-
This works the same for memory or CPU requests.
137-
138-
By default, in case nothing is configured in the custom resource for a certain role group, each Pod has a `2Gi` large local volume mount for the data location containing mainly logs.
139-
140-
=== Resource Requests
111+
== Resource Requests
141112

142113
include::home:concepts:stackable_resource_requests.adoc[]
143114

@@ -161,9 +132,6 @@ spec:
161132
max: '2000m'
162133
memory:
163134
limit: '4Gi'
164-
storage:
165-
data:
166-
capacity: '1Gi'
167135
workers:
168136
config:
169137
resources:
@@ -172,9 +140,6 @@ spec:
172140
max: '4000m'
173141
memory:
174142
limit: '4Gi'
175-
storage:
176-
data:
177-
capacity: '1Gi'
178143
----
179144

180145
WARNING: The default values are _most likely_ not sufficient to run a proper cluster in production.

examples/simple-trino-cluster-resource-limits.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ spec:
1818
replicas: 1
1919
config:
2020
resources:
21-
storage:
22-
data:
23-
capacity: 3Gi
2421
cpu:
2522
min: 300m
2623
max: "2"

rust/operator-binary/src/command.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ use crate::{
1111
catalog::config::CatalogConfig,
1212
controller::{STACKABLE_LOG_CONFIG_DIR, STACKABLE_LOG_DIR},
1313
crd::{
14-
CONFIG_DIR_NAME, Container, DATA_DIR_NAME, LOG_PROPERTIES, RW_CONFIG_DIR_NAME,
15-
STACKABLE_CLIENT_TLS_DIR, STACKABLE_INTERNAL_TLS_DIR, STACKABLE_MOUNT_INTERNAL_TLS_DIR,
14+
CONFIG_DIR_NAME, Container, LOG_PROPERTIES, RW_CONFIG_DIR_NAME, STACKABLE_CLIENT_TLS_DIR,
15+
STACKABLE_INTERNAL_TLS_DIR, STACKABLE_MOUNT_INTERNAL_TLS_DIR,
1616
STACKABLE_MOUNT_SERVER_TLS_DIR, STACKABLE_SERVER_TLS_DIR, STACKABLE_TLS_STORE_PASSWORD,
1717
SYSTEM_TRUST_STORE, SYSTEM_TRUST_STORE_PASSWORD, TrinoRole, v1alpha1,
1818
},
@@ -119,7 +119,7 @@ pub fn container_trino_args(
119119
{remove_vector_shutdown_file_command}
120120
prepare_signal_handlers
121121
containerdebug --output={STACKABLE_LOG_DIR}/containerdebug-state.json --loop &
122-
bin/launcher run --etc-dir={RW_CONFIG_DIR_NAME} --data-dir={DATA_DIR_NAME} &
122+
bin/launcher run --etc-dir={RW_CONFIG_DIR_NAME} &
123123
wait_for_termination $!
124124
{create_vector_shutdown_file_command}
125125
",

rust/operator-binary/src/controller.rs

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,11 @@ use crate::{
7878
command, config,
7979
crd::{
8080
ACCESS_CONTROL_PROPERTIES, APP_NAME, CONFIG_DIR_NAME, CONFIG_PROPERTIES, Container,
81-
DATA_DIR_NAME, DISCOVERY_URI, ENV_INTERNAL_SECRET, HTTP_PORT, HTTP_PORT_NAME, HTTPS_PORT,
82-
HTTPS_PORT_NAME, JVM_CONFIG, JVM_SECURITY_PROPERTIES, LOG_PROPERTIES,
83-
MAX_TRINO_LOG_FILES_SIZE, METRICS_PORT, METRICS_PORT_NAME, NODE_PROPERTIES,
84-
RW_CONFIG_DIR_NAME, STACKABLE_CLIENT_TLS_DIR, STACKABLE_INTERNAL_TLS_DIR,
85-
STACKABLE_MOUNT_INTERNAL_TLS_DIR, STACKABLE_MOUNT_SERVER_TLS_DIR, STACKABLE_SERVER_TLS_DIR,
86-
TrinoRole,
81+
DISCOVERY_URI, ENV_INTERNAL_SECRET, HTTP_PORT, HTTP_PORT_NAME, HTTPS_PORT, HTTPS_PORT_NAME,
82+
JVM_CONFIG, JVM_SECURITY_PROPERTIES, LOG_PROPERTIES, MAX_TRINO_LOG_FILES_SIZE,
83+
METRICS_PORT, METRICS_PORT_NAME, NODE_PROPERTIES, RW_CONFIG_DIR_NAME,
84+
STACKABLE_CLIENT_TLS_DIR, STACKABLE_INTERNAL_TLS_DIR, STACKABLE_MOUNT_INTERNAL_TLS_DIR,
85+
STACKABLE_MOUNT_SERVER_TLS_DIR, STACKABLE_SERVER_TLS_DIR, TrinoRole,
8786
authentication::resolve_authentication_classes,
8887
catalog,
8988
discovery::{TrinoDiscovery, TrinoDiscoveryProtocol, TrinoPodRef},
@@ -1008,8 +1007,6 @@ fn build_rolegroup_statefulset(
10081007
"-c".to_string(),
10091008
])
10101009
.args(vec![prepare_args.join("\n")])
1011-
.add_volume_mount("data", DATA_DIR_NAME)
1012-
.context(AddVolumeMountSnafu)?
10131010
.add_volume_mount("rwconfig", RW_CONFIG_DIR_NAME)
10141011
.context(AddVolumeMountSnafu)?
10151012
.add_volume_mount("log-config", STACKABLE_LOG_CONFIG_DIR)
@@ -1026,14 +1023,7 @@ fn build_rolegroup_statefulset(
10261023
)
10271024
.build();
10281025

1029-
// for rw config
1030-
let mut persistent_volume_claims = vec![
1031-
merged_config
1032-
.resources
1033-
.storage
1034-
.data
1035-
.build_pvc("data", Some(vec!["ReadWriteOnce"])),
1036-
];
1026+
let mut persistent_volume_claims = vec![];
10371027
// Add listener
10381028
if let Some(group_listener_name) = group_listener_name(trino, trino_role) {
10391029
cb_trino
@@ -1069,8 +1059,6 @@ fn build_rolegroup_statefulset(
10691059
command::container_trino_args(trino_authentication_config, catalogs).join("\n"),
10701060
])
10711061
.add_env_vars(env)
1072-
.add_volume_mount("data", DATA_DIR_NAME)
1073-
.context(AddVolumeMountSnafu)?
10741062
.add_volume_mount("config", CONFIG_DIR_NAME)
10751063
.context(AddVolumeMountSnafu)?
10761064
.add_volume_mount("rwconfig", RW_CONFIG_DIR_NAME)

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

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use stackable_operator::{
1616
product_image_selection::ProductImage,
1717
resources::{
1818
CpuLimitsFragment, MemoryLimitsFragment, NoRuntimeLimits, NoRuntimeLimitsFragment,
19-
PvcConfig, PvcConfigFragment, Resources, ResourcesFragment,
19+
Resources, ResourcesFragment,
2020
},
2121
},
2222
config::{
@@ -91,7 +91,6 @@ pub const NODE_INTERNAL_ADDRESS_SOURCE_FQDN: &str = "FQDN";
9191
// directories
9292
pub const CONFIG_DIR_NAME: &str = "/stackable/config";
9393
pub const RW_CONFIG_DIR_NAME: &str = "/stackable/rwconfig";
94-
pub const DATA_DIR_NAME: &str = "/stackable/data";
9594
pub const STACKABLE_SERVER_TLS_DIR: &str = "/stackable/server_tls";
9695
pub const STACKABLE_CLIENT_TLS_DIR: &str = "/stackable/client_tls";
9796
pub const STACKABLE_INTERNAL_TLS_DIR: &str = "/stackable/internal_tls";
@@ -232,11 +231,17 @@ pub mod versioned {
232231
pub struct TrinoConfig {
233232
// config.properties
234233
pub query_max_memory: Option<String>,
234+
235235
pub query_max_memory_per_node: Option<String>,
236+
236237
#[fragment_attrs(serde(default))]
237238
pub logging: Logging<Container>,
239+
240+
// We need to provide *something* that implements `Fragment`, so we pick an empty struct here.
241+
// Note that a unit "()" would not work, as we need something that implements `Fragment`.
238242
#[fragment_attrs(serde(default))]
239243
pub resources: Resources<TrinoStorageConfig, NoRuntimeLimits>,
244+
240245
#[fragment_attrs(serde(default))]
241246
pub affinity: StackableAffinity,
242247

@@ -327,10 +332,7 @@ pub mod versioned {
327332
),
328333
serde(rename_all = "camelCase")
329334
)]
330-
pub struct TrinoStorageConfig {
331-
#[fragment_attrs(serde(default))]
332-
pub data: PvcConfig,
333-
}
335+
pub struct TrinoStorageConfig {}
334336

335337
#[derive(Clone, Default, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)]
336338
#[serde(rename_all = "camelCase")]
@@ -490,13 +492,7 @@ impl v1alpha1::TrinoConfig {
490492
limit: Some(Quantity(memory.to_string())),
491493
runtime_limits: NoRuntimeLimitsFragment {},
492494
},
493-
storage: v1alpha1::TrinoStorageConfigFragment {
494-
data: PvcConfigFragment {
495-
capacity: Some(Quantity("1Gi".to_owned())),
496-
storage_class: None,
497-
selectors: None,
498-
},
499-
},
495+
storage: v1alpha1::TrinoStorageConfigFragment {},
500496
},
501497
query_max_memory: None,
502498
query_max_memory_per_node: None,

tests/templates/kuttl/resources/10-assert.yaml.j2

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,6 @@ status:
2626
readyReplicas: 1
2727
replicas: 1
2828
---
29-
apiVersion: v1
30-
kind: PersistentVolumeClaim
31-
metadata:
32-
name: data-trino-coordinator-resources-default-0
33-
spec:
34-
accessModes:
35-
- ReadWriteOnce
36-
resources:
37-
requests:
38-
storage: 1Gi
39-
---
4029
apiVersion: apps/v1
4130
kind: StatefulSet
4231
metadata:
@@ -60,17 +49,6 @@ status:
6049
readyReplicas: 1
6150
replicas: 1
6251
---
63-
apiVersion: v1
64-
kind: PersistentVolumeClaim
65-
metadata:
66-
name: data-trino-worker-resources-from-role-0
67-
spec:
68-
accessModes:
69-
- ReadWriteOnce
70-
resources:
71-
requests:
72-
storage: 3Gi
73-
---
7452
apiVersion: apps/v1
7553
kind: StatefulSet
7654
metadata:
@@ -94,17 +72,6 @@ status:
9472
readyReplicas: 1
9573
replicas: 1
9674
---
97-
apiVersion: v1
98-
kind: PersistentVolumeClaim
99-
metadata:
100-
name: data-trino-worker-resources-from-role-group-0
101-
spec:
102-
accessModes:
103-
- ReadWriteOnce
104-
resources:
105-
requests:
106-
storage: 4Gi
107-
---
10875
apiVersion: apps/v1
10976
kind: StatefulSet
11077
metadata:
@@ -127,14 +94,3 @@ spec:
12794
status:
12895
readyReplicas: 1
12996
replicas: 1
130-
---
131-
apiVersion: v1
132-
kind: PersistentVolumeClaim
133-
metadata:
134-
name: data-trino-worker-resources-from-pod-overrides-0
135-
spec:
136-
accessModes:
137-
- ReadWriteOnce
138-
resources:
139-
requests:
140-
storage: 3Gi

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ spec:
3030
logging:
3131
enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }}
3232
resources:
33-
storage:
34-
data:
35-
capacity: 3Gi
3633
cpu:
3734
min: 300m
3835
max: 600m
@@ -45,9 +42,6 @@ spec:
4542
replicas: 1
4643
config:
4744
resources:
48-
storage:
49-
data:
50-
capacity: 4Gi
5145
cpu:
5246
min: 400m
5347
max: 800m

0 commit comments

Comments
 (0)