Skip to content

Commit d2bdfb5

Browse files
authored
chore: Remove hardcoded uid and gid (#862)
1 parent 274709a commit d2bdfb5

File tree

4 files changed

+6
-14
lines changed

4 files changed

+6
-14
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ All notable changes to this project will be documented in this file.
2323
of having the operator write it to the vector config ([#844]).
2424
- test: Bump to Vector `0.46.1` ([#855]).
2525
- Use versioned common structs ([#861]).
26+
- BREAKING: Previously this operator would hardcode the UID and GID of the Pods being created to 1000/0, this has changed now ([#862])
27+
- The `runAsUser` and `runAsGroup` fields will not be set anymore by the operator
28+
- The defaults from the docker images itself will now apply, which will be different from 1000/0 going forward
29+
- This is marked as breaking because tools and policies might exist, which require these fields to be set
2630

2731
### Fixed
2832

@@ -43,6 +47,7 @@ All notable changes to this project will be documented in this file.
4347
[#855]: https://github.com/stackabletech/kafka-operator/pull/855
4448
[#860]: https://github.com/stackabletech/kafka-operator/pull/860
4549
[#861]: https://github.com/stackabletech/kafka-operator/pull/861
50+
[#862]: https://github.com/stackabletech/kafka-operator/pull/862
4651

4752
## [25.3.0] - 2025-03-21
4853

rust/operator-binary/src/kafka_controller.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,6 @@ use crate::{
9797
pub const KAFKA_CONTROLLER_NAME: &str = "kafkacluster";
9898
pub const KAFKA_FULL_CONTROLLER_NAME: &str = concatcp!(KAFKA_CONTROLLER_NAME, '.', OPERATOR_NAME);
9999

100-
/// Used as runAsUser in the pod security context. This is specified in the kafka image file
101-
pub const KAFKA_UID: i64 = 1000;
102-
103100
pub struct Ctx {
104101
pub client: stackable_operator::client::Client,
105102
pub product_config: ProductConfigManager,
@@ -1088,13 +1085,7 @@ fn build_broker_rolegroup_statefulset(
10881085
)
10891086
.context(AddVolumeSnafu)?
10901087
.service_account_name(service_account.name_any())
1091-
.security_context(
1092-
PodSecurityContextBuilder::new()
1093-
.run_as_user(KAFKA_UID)
1094-
.run_as_group(0)
1095-
.fs_group(1000)
1096-
.build(),
1097-
);
1088+
.security_context(PodSecurityContextBuilder::new().fs_group(1000).build());
10981089

10991090
// Add vector container after kafka container to keep the defaulting into kafka container
11001091
if merged_config.logging.enable_vector_agent {

tests/templates/kuttl/kerberos/30-access-kafka.txt.j2

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ spec:
6666
volumeMode: Filesystem
6767
securityContext:
6868
fsGroup: 1000
69-
runAsGroup: 1000
70-
runAsUser: 1000
7169
restartPolicy: OnFailure
7270
---
7371
apiVersion: v1

tests/templates/kuttl/tls/31_test-tls-job.yaml.j2

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,5 @@ spec:
9090
storage: "1"
9191
securityContext:
9292
fsGroup: 1000
93-
runAsGroup: 1000
94-
runAsUser: 1000
9593
serviceAccountName: test-sa
9694
restartPolicy: OnFailure

0 commit comments

Comments
 (0)