Skip to content

Commit c6e34bc

Browse files
committed
Use builder functions to ensure we can override
1 parent abbc85c commit c6e34bc

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

crates/stackable-operator/src/builder/pod/security.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,15 @@ impl PodSecurityContextBuilder {
168168
///
169169
/// * `runAsNonRoot: true`
170170
pub fn with_stackable_defaults() -> Self {
171-
Self {
172-
pod_security_context: PodSecurityContext {
173-
run_as_non_root: Some(true),
174-
..Default::default()
175-
},
176-
}
171+
// We are using the builder functions to ensure that builder functions exist to override these settings.
172+
let mut builder = Self {
173+
pod_security_context: PodSecurityContext::default(),
174+
};
175+
176+
// Reason: Running as root is bad
177+
builder.run_as_non_root(true);
178+
179+
builder
177180
}
178181

179182
pub fn build(&self) -> PodSecurityContext {

0 commit comments

Comments
 (0)