Skip to content

Commit 02ff8d9

Browse files
committed
chore: Remove hardcoded uid and gid
1 parent b549b18 commit 02ff8d9

File tree

5 files changed

+7
-9
lines changed

5 files changed

+7
-9
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ All notable changes to this project will be documented in this file.
2828
- Use versioned common structs ([#572]).
2929
- BREAKING: Change the label `app.kubernetes.io/name` for Spark history and connect objects to use `spark-history` and `spark-connect` instead of `spark-k8s` ([#573]).
3030
- BREAKING: The history Pods now have their own ClusterRole named `spark-history-clusterrole` ([#573]).
31+
- BREAKING: Previously this operator would hardcode the UID and GID of the Pods being created to 1000/0, this has changed now ([#575])
32+
- The `runAsUser` and `runAsGroup` fields will not be set anymore by the operator
33+
- The defaults from the docker images itself will now apply, which will be different from 1000/0 going forward
34+
- This is marked as breaking because tools and policies might exist, which require these fields to be set
3135

3236
### Fixed
3337

@@ -52,6 +56,7 @@ All notable changes to this project will be documented in this file.
5256
[#572]: https://github.com/stackabletech/spark-k8s-operator/pull/572
5357
[#573]: https://github.com/stackabletech/spark-k8s-operator/pull/573
5458
[#574]: https://github.com/stackabletech/spark-k8s-operator/pull/574
59+
[#575]: https://github.com/stackabletech/spark-k8s-operator/pull/575
5560

5661
## [25.3.0] - 2025-03-21
5762

rust/operator-binary/src/connect/server.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ use crate::{
4848
constants::{
4949
JVM_SECURITY_PROPERTIES_FILE, LISTENER_VOLUME_DIR, LISTENER_VOLUME_NAME,
5050
LOG4J2_CONFIG_FILE, MAX_SPARK_LOG_FILES_SIZE, METRICS_PROPERTIES_FILE,
51-
POD_TEMPLATE_FILE, SPARK_DEFAULTS_FILE_NAME, SPARK_UID, VOLUME_MOUNT_NAME_CONFIG,
51+
POD_TEMPLATE_FILE, SPARK_DEFAULTS_FILE_NAME, VOLUME_MOUNT_NAME_CONFIG,
5252
VOLUME_MOUNT_NAME_LOG, VOLUME_MOUNT_NAME_LOG_CONFIG, VOLUME_MOUNT_PATH_CONFIG,
5353
VOLUME_MOUNT_PATH_LOG, VOLUME_MOUNT_PATH_LOG_CONFIG,
5454
},
@@ -246,8 +246,6 @@ pub(crate) fn build_stateful_set(
246246
)
247247
.context(AddVolumeSnafu)?
248248
.security_context(PodSecurityContext {
249-
run_as_user: Some(SPARK_UID),
250-
run_as_group: Some(0),
251249
fs_group: Some(1000),
252250
..PodSecurityContext::default()
253251
});

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ pub const SPARK_DEFAULTS_FILE_NAME: &str = "spark-defaults.conf";
8686
pub const SPARK_ENV_SH_FILE_NAME: &str = "spark-env.sh";
8787

8888
pub const SPARK_CLUSTER_ROLE: &str = "spark-k8s-clusterrole";
89-
pub const SPARK_UID: i64 = 1000;
9089
pub const METRICS_PORT: u16 = 18081;
9190
pub const HISTORY_UI_PORT: u16 = 18080;
9291

rust/operator-binary/src/history/history_controller.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ use crate::{
5858
HISTORY_UI_PORT, JVM_SECURITY_PROPERTIES_FILE, LISTENER_VOLUME_DIR,
5959
LISTENER_VOLUME_NAME, MAX_SPARK_LOG_FILES_SIZE, METRICS_PORT, OPERATOR_NAME,
6060
SECRET_ACCESS_KEY, SPARK_DEFAULTS_FILE_NAME, SPARK_ENV_SH_FILE_NAME,
61-
SPARK_IMAGE_BASE_NAME, SPARK_UID, STACKABLE_TRUST_STORE, VOLUME_MOUNT_NAME_CONFIG,
61+
SPARK_IMAGE_BASE_NAME, STACKABLE_TRUST_STORE, VOLUME_MOUNT_NAME_CONFIG,
6262
VOLUME_MOUNT_NAME_LOG, VOLUME_MOUNT_NAME_LOG_CONFIG, VOLUME_MOUNT_PATH_CONFIG,
6363
VOLUME_MOUNT_PATH_LOG, VOLUME_MOUNT_PATH_LOG_CONFIG,
6464
},
@@ -544,8 +544,6 @@ fn build_stateful_set(
544544
)
545545
.context(AddVolumeSnafu)?
546546
.security_context(PodSecurityContext {
547-
run_as_user: Some(SPARK_UID),
548-
run_as_group: Some(0),
549547
fs_group: Some(1000),
550548
..PodSecurityContext::default()
551549
});

rust/operator-binary/src/spark_k8s_controller.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,8 +1023,6 @@ fn build_spark_role_serviceaccount(
10231023

10241024
fn security_context() -> PodSecurityContext {
10251025
PodSecurityContext {
1026-
run_as_user: Some(SPARK_UID),
1027-
run_as_group: Some(0),
10281026
fs_group: Some(1000),
10291027
..PodSecurityContext::default()
10301028
}

0 commit comments

Comments
 (0)