Skip to content

Commit

Permalink
makes userGroupId a const
Browse files Browse the repository at this point in the history
  • Loading branch information
aorcholski committed Nov 22, 2024
1 parent 70a8e4c commit 2ab189f
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions pkg/controllers/dynakube/extension/eec/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,8 @@ const (

// misc
logVolumeName = "log"
)

var (
userGroupId = int64(1001)
userGroupId int64 = 1001
)

func (r *reconciler) createOrUpdateStatefulset(ctx context.Context) error {
Expand Down Expand Up @@ -221,8 +219,8 @@ func buildSecurityContext() *corev1.SecurityContext {
},
},
Privileged: address.Of(false),
RunAsUser: &userGroupId,
RunAsGroup: &userGroupId,
RunAsUser: address.Of(userGroupId),
RunAsGroup: address.Of(userGroupId),
RunAsNonRoot: address.Of(true),
ReadOnlyRootFilesystem: address.Of(true),
AllowPrivilegeEscalation: address.Of(false),
Expand All @@ -240,7 +238,7 @@ func buildPodSecurityContext(dk *dynakube.DynaKube) *corev1.PodSecurityContext {
}

if !dk.Spec.Templates.ExtensionExecutionController.UseEphemeralVolume {
podSecurityContext.FSGroup = &userGroupId
podSecurityContext.FSGroup = address.Of(userGroupId)
}

return podSecurityContext
Expand Down

0 comments on commit 2ab189f

Please sign in to comment.