Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 741 fix #748

Merged
merged 2 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -32,7 +32,18 @@
import ai.langstream.runtime.api.application.ApplicationSetupConstants;
import ai.langstream.runtime.api.deployer.RuntimeDeployerConfiguration;
import ai.langstream.runtime.api.deployer.RuntimeDeployerConstants;
import io.fabric8.kubernetes.api.model.*;
import io.fabric8.kubernetes.api.model.Container;
import io.fabric8.kubernetes.api.model.ContainerBuilder;
import io.fabric8.kubernetes.api.model.EmptyDirVolumeSource;
import io.fabric8.kubernetes.api.model.EnvVar;
import io.fabric8.kubernetes.api.model.EnvVarBuilder;
import io.fabric8.kubernetes.api.model.KeyToPathBuilder;
import io.fabric8.kubernetes.api.model.Pod;
import io.fabric8.kubernetes.api.model.Quantity;
import io.fabric8.kubernetes.api.model.Volume;
import io.fabric8.kubernetes.api.model.VolumeBuilder;
import io.fabric8.kubernetes.api.model.VolumeMount;
import io.fabric8.kubernetes.api.model.VolumeMountBuilder;
import io.fabric8.kubernetes.api.model.batch.v1.Job;
import io.fabric8.kubernetes.api.model.batch.v1.JobBuilder;
import io.fabric8.kubernetes.client.KubernetesClient;
Expand Down Expand Up @@ -382,7 +393,6 @@ private static Job generateJob(
.withLabels(labels)
.endMetadata()
.withNewSpec()
.withSecurityContext(getPodSecurityContext())
.withTolerations(podTemplate != null ? podTemplate.tolerations() : null)
.withNodeSelector(podTemplate != null ? podTemplate.nodeSelector() : null)
.withServiceAccountName(serviceAccountName)
Expand Down Expand Up @@ -456,10 +466,6 @@ private static Map<String, String> getPodAnnotations(PodTemplate podTemplate) {
return annotations;
}

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

public static Map<String, String> getLabelsForDeployer(boolean delete, String applicationId) {
return Map.of(
CRDConstants.COMMON_LABEL_APP,
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
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,6 @@ void testDeployerJob() {
- mountPath: /cluster-runtime-config
name: cluster-runtime-config
restartPolicy: Never
securityContext:
fsGroup: 10000
serviceAccountName: my-tenant
volumes:
- emptyDir: {}
Expand Down Expand Up @@ -228,8 +226,6 @@ void testDeployerJob() {
- mountPath: /cluster-runtime-config
name: cluster-runtime-config
restartPolicy: Never
securityContext:
fsGroup: 10000
serviceAccountName: my-tenant
volumes:
- emptyDir: {}
Expand Down Expand Up @@ -346,8 +342,6 @@ void testSetupJob() {
- mountPath: /cluster-runtime-config
name: cluster-runtime-config
restartPolicy: Never
securityContext:
fsGroup: 10000
serviceAccountName: runtime-my-tenant
volumes:
- emptyDir: {}
Expand Down Expand Up @@ -444,8 +438,6 @@ void testSetupJob() {
- mountPath: /cluster-runtime-config
name: cluster-runtime-config
restartPolicy: Never
securityContext:
fsGroup: 10000
serviceAccountName: runtime-my-tenant
volumes:
- emptyDir: {}
Expand Down
Loading