Skip to content

Commit 9c0eaf0

Browse files
lfranckerazvan
andauthored
chore: Remove hardcoded uid and gid (#752)
* chore: Remove hardcoded uid and gid * fix: add @staticmethod decorators --------- Co-authored-by: Razvan-Daniel Mihai <[email protected]>
1 parent f2f46fb commit 9c0eaf0

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ All notable changes to this project will be documented in this file.
2525
- test: Bump to Vector `0.46.1` ([#743]).
2626
- test: Bump OPA `1.4.2` ([#745]).
2727
- Use versioned common structs ([#748]).
28+
- BREAKING: Previously this operator would hardcode the UID and GID of the Pods being created to 1000/0, this has changed now ([#752])
29+
- The `runAsUser` and `runAsGroup` fields will not be set anymore by the operator
30+
- The defaults from the docker images itself will now apply, which will be different from 1000/0 going forward
31+
- This is marked as breaking because tools and policies might exist, which require these fields to be set
2832

2933
### Fixed
3034

@@ -40,6 +44,7 @@ All notable changes to this project will be documented in this file.
4044
[#743]: https://github.com/stackabletech/trino-operator/pull/743
4145
[#745]: https://github.com/stackabletech/trino-operator/pull/745
4246
[#748]: https://github.com/stackabletech/trino-operator/pull/748
47+
[#752]: https://github.com/stackabletech/trino-operator/pull/752
4348

4449
## [25.3.0] - 2025-03-21
4550

@@ -116,7 +121,7 @@ All notable changes to this project will be documented in this file.
116121

117122
- BREAKING: The fields `connection` and `host` on `S3Connection` as well as `bucketName` on `S3Bucket`are now mandatory ([#646]).
118123
- Don't ignore envOverrides ([#633]).
119-
- Don't print credentials to STDOUT during startup. Ideally we should use [config-utils](https://github.com/stackabletech/config-utils), but that's not easy (see [here](https://github.com/stackabletech/trino-operator/tree/fix/secret-printing)) ([#634]).
124+
- Don't print credentials to STDOUT during startup. Ideally, we should use [config-utils](https://github.com/stackabletech/config-utils), but that's not easy (see [our experimental branch](https://github.com/stackabletech/trino-operator/tree/fix/secret-printing)) ([#634]).
120125
- Invalid `TrinoCluster`, `TrinoCatalog` or `AuthenticationClass` objects don't stop the operator from reconciliation ([#657])
121126

122127
### Removed

rust/operator-binary/src/controller.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ pub struct Ctx {
104104
pub const OPERATOR_NAME: &str = "trino.stackable.tech";
105105
pub const CONTROLLER_NAME: &str = "trinocluster";
106106
pub const FULL_CONTROLLER_NAME: &str = concatcp!(CONTROLLER_NAME, '.', OPERATOR_NAME);
107-
pub const TRINO_UID: i64 = 1000;
108107

109108
pub const STACKABLE_LOG_DIR: &str = "/stackable/log";
110109
pub const STACKABLE_LOG_CONFIG_DIR: &str = "/stackable/log_config";
@@ -1141,13 +1140,7 @@ fn build_rolegroup_statefulset(
11411140
)
11421141
.context(AddVolumeSnafu)?
11431142
.service_account_name(sa_name)
1144-
.security_context(
1145-
PodSecurityContextBuilder::new()
1146-
.run_as_user(TRINO_UID)
1147-
.run_as_group(0)
1148-
.fs_group(1000)
1149-
.build(),
1150-
);
1143+
.security_context(PodSecurityContextBuilder::new().fs_group(1000).build());
11511144

11521145
let mut pod_template = pod_builder.build_template();
11531146
pod_template.merge_from(role.config.pod_overrides.clone());

tests/templates/kuttl/opa-authorization/check-opa.py.j2

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import argparse
33
import pytest
44
import trino
55

6-
from datetime import datetime
6+
from datetime import datetime, UTC
77
from trino.exceptions import TrinoUserError
88

99
import urllib3
@@ -501,15 +501,18 @@ class TestOpa:
501501

502502
print("")
503503

504+
@staticmethod
504505
def log(user, query):
505-
timestamp = datetime.utcnow().isoformat(sep=" ", timespec="milliseconds")
506+
timestamp = datetime.now(UTC).isoformat(sep=" ", timespec="milliseconds")
506507
print(f"[{timestamp}] - {user:20s} -> {query}")
507508

509+
@staticmethod
508510
def run_query(connection, query):
509511
cursor = connection.cursor()
510512
cursor.execute(query)
511513
return cursor.fetchall()
512514

515+
@staticmethod
513516
def get_connection(username, password, namespace, impersonation=None):
514517
connection = trino.dbapi.connect(
515518
host="trino-coordinator.{0}.svc.cluster.local".format(namespace),

0 commit comments

Comments
 (0)