Skip to content

Commit

Permalink
🐛 Run task pods with hub UID
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Montleon <[email protected]>
  • Loading branch information
jmontleon committed Nov 11, 2024
1 parent f99f88d commit bf2cf88
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions task/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"
"io"
"os"
"os/user"
"path"
"sort"
"strconv"
Expand Down Expand Up @@ -1699,6 +1700,14 @@ func (r *Task) containers(
},
},
}
user, err := user.Current()
if err != nil {
err = liberr.Wrap(err)
}
uid, err := strconv.ParseInt(user.Uid, 10, 64)
if err != nil {
err = liberr.Wrap(err)
}
plain = append(plain, addon.Spec.Container)
plain[0].Name = "addon"
for i := range extensions {
Expand All @@ -1714,6 +1723,9 @@ func (r *Task) containers(
container := &plain[i]
injector.Inject(container)
r.propagateEnv(&plain[0], container)
container.SecurityContext = &core.SecurityContext{
RunAsUser: &uid,
}
container.VolumeMounts = append(
container.VolumeMounts,
core.VolumeMount{
Expand Down

0 comments on commit bf2cf88

Please sign in to comment.