Skip to content
Merged
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
22 changes: 18 additions & 4 deletions controllers/resource_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,8 @@ done`, CABundleTempPath, CABundleSourceDir, fileList)
},
},
SecurityContext: &corev1.SecurityContext{
AllowPrivilegeEscalation: &[]bool{false}[0],
RunAsNonRoot: &[]bool{false}[0],
AllowPrivilegeEscalation: ptr.To(false),
RunAsNonRoot: ptr.To(false),
Capabilities: &corev1.Capabilities{
Drop: []corev1.Capability{"ALL"},
},
Expand Down Expand Up @@ -446,8 +446,12 @@ func configurePersistentStorage(instance *llamav1alpha1.LlamaStackDistribution,
},
},
SecurityContext: &corev1.SecurityContext{
RunAsUser: ptr.To(int64(0)), // Run as root to be able to change ownership
RunAsGroup: ptr.To(int64(0)),
RunAsUser: ptr.To(int64(0)), // Run as root to be able to change ownership
RunAsGroup: ptr.To(int64(0)),
AllowPrivilegeEscalation: ptr.To(false),
Capabilities: &corev1.Capabilities{
Drop: []corev1.Capability{"ALL"},
},
},
}

Expand Down Expand Up @@ -601,6 +605,16 @@ func configurePodOverrides(instance *llamav1alpha1.LlamaStackDistribution, podSp
podSpec.ServiceAccountName = instance.Name + "-sa"
}

// Configure pod-level security context for OpenShift SCC compatibility
if podSpec.SecurityContext == nil {
podSpec.SecurityContext = &corev1.PodSecurityContext{}
}

// Set fsGroup to allow write access to mounted volumes
if podSpec.SecurityContext.FSGroup == nil {
podSpec.SecurityContext.FSGroup = ptr.To(int64(0))
}

// Apply other pod overrides if specified
if instance.Spec.Server.PodOverrides != nil {
// Add volumes if specified
Expand Down