Skip to content

Commit 052b7a6

Browse files
committed
feat: Support removing properties from catalogs
1 parent 5ce74ff commit 052b7a6

File tree

4 files changed

+35
-1
lines changed

4 files changed

+35
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ All notable changes to this project will be documented in this file.
1111
- Run a `containerdebug` process in the background of each Trino container to collect debugging information ([#687]).
1212
- Support configuring JVM arguments ([#677]).
1313
- Aggregate emitted Kubernetes events on the CustomResources ([#677]).
14+
- Support removing properties from catalogs.
15+
This is helpful, because Trino fails to start in case you have any unused config properties ([#XXX]).
1416

1517
## Changed
1618

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1985,6 +1985,17 @@ spec:
19851985
description: A [TPC-H](https://docs.stackable.tech/home/nightly/trino/usage-guide/catalogs/tpch) connector.
19861986
type: object
19871987
type: object
1988+
experimentalConfigRemovals:
1989+
default: []
1990+
description: |-
1991+
List of config properties which should be removed.
1992+
1993+
This is helpful, because Trino fails to start in case you have any unused config properties. The removals are executed after the `configOverrides`.
1994+
1995+
This field is experimental, as ideally some general solution for the removal of properties is found and added to configOverrides. This mechanism would replace this field.
1996+
items:
1997+
type: string
1998+
type: array
19881999
required:
19892000
- connector
19902001
type: object

rust/operator-binary/src/catalog/config.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,16 @@ impl CatalogConfig {
160160
.properties
161161
.extend(catalog.spec.config_overrides.clone());
162162

163+
for removal in &catalog.spec.config_removals {
164+
if catalog_config.properties.remove(removal).is_none() {
165+
tracing::warn!(
166+
catalog.name = catalog_name,
167+
property = removal,
168+
"You asked to remove a non-existing config property from a catalog"
169+
);
170+
}
171+
}
172+
163173
Ok(catalog_config)
164174
}
165175
}

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,22 @@ pub mod versioned {
4848
pub struct TrinoCatalogSpec {
4949
/// The `connector` defines which connector is used.
5050
pub connector: TrinoCatalogConnector,
51-
#[serde(default)]
5251

5352
/// The `configOverrides` allow overriding arbitrary Trino settings.
5453
/// For example, for Hive you could add `hive.metastore.username: trino`.
54+
#[serde(default)]
5555
pub config_overrides: HashMap<String, String>,
56+
57+
/// List of config properties which should be removed.
58+
///
59+
/// This is helpful, because Trino fails to start in case you have any unused config
60+
/// properties. The removals are executed after the `configOverrides`.
61+
///
62+
/// This field is experimental, as ideally some general solution for the removal of
63+
/// properties is found and added to configOverrides. This mechanism would replace this
64+
/// field.
65+
#[serde(default, rename = "experimentalConfigRemovals")]
66+
pub config_removals: Vec<String>,
5667
}
5768
}
5869

0 commit comments

Comments
 (0)