Skip to content

Commit

Permalink
[Issue #741] Fixes previous commit. fsGroup will now be assign to Age…
Browse files Browse the repository at this point in the history
…nt STS and not App
  • Loading branch information
Dobosz committed Dec 14, 2023
1 parent 4abf702 commit cfc993e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
import io.fabric8.kubernetes.api.model.PersistentVolumeClaim;
import io.fabric8.kubernetes.api.model.PersistentVolumeClaimBuilder;
import io.fabric8.kubernetes.api.model.Pod;
import io.fabric8.kubernetes.api.model.PodSecurityContext;
import io.fabric8.kubernetes.api.model.PodSecurityContextBuilder;
import io.fabric8.kubernetes.api.model.Probe;
import io.fabric8.kubernetes.api.model.ProbeBuilder;
import io.fabric8.kubernetes.api.model.Quantity;
Expand Down Expand Up @@ -304,6 +306,7 @@ public static StatefulSet generateStatefulSet(GenerateStatefulsetParams params)
.withTolerations(podTemplate != null ? podTemplate.tolerations() : null)
.withNodeSelector(podTemplate != null ? podTemplate.nodeSelector() : null)
.withTerminationGracePeriodSeconds(60L)
.withSecurityContext(getPodSecurityContext())
.withInitContainers(
List.of(
injectConfigForDownloadCodeInitContainer,
Expand Down Expand Up @@ -464,6 +467,10 @@ private static Map<String, String> getPodAnnotations(AgentSpec spec, PodTemplate
return annotations;
}

private static PodSecurityContext getPodSecurityContext() {
return new PodSecurityContextBuilder().withFsGroup(10_000L).build();
}

private static String getStsImagePullPolicy(GenerateStatefulsetParams params) {
final String imagePullPolicy = params.getImagePullPolicy();
final String containerImagePullPolicy =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ void testStatefulsetAndService() {
name: download-config
- mountPath: /app-code-download
name: code-download
securityContext:
fsGroup: 10000
serviceAccountName: runtime-my-tenant
terminationGracePeriodSeconds: 60
volumes:
Expand Down

0 comments on commit cfc993e

Please sign in to comment.