Skip to content

Commit b8bd3b1

Browse files
unguiculusyasker
authored andcommitted
Fix permissions
This is a follow-up PR for #7, since 3256bdf, unfortunately, did not fully fix the issue. The example I supplied is not ideal. It works with your fix because it uses Busybox which doesn't have group 1000 so the user runs with gid=0. I added `id` to the script which prints the following: `uid=1000 gid=0(root) groups=0(root),1000` Now, when I use an image that actually has a user with uid=1000, gid=1000, such as `jenkins/jenkins` it doesn't work because the user does not belong to group 0 in this case: `uid=1000 gid=0(root) groups=0(root),1000` This fixes the issue using `0777` as Minikube does.
1 parent 6647f75 commit b8bd3b1

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

examples/pod-with-security-context.yaml

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ metadata:
77
spec:
88
containers:
99
- name: test
10-
image: busybox
10+
# Jenkins image used for illustration purposes because it has a user
11+
# with uid=1000 and gid=1000 that matches the specified security context
12+
image: jenkins/jenkins
1113
command:
1214
- /config/test.sh
1315
volumeMounts:
@@ -39,6 +41,7 @@ metadata:
3941
data:
4042
test.sh: |
4143
#!/bin/sh
44+
id
4245
ls -al /test && \
4346
echo 'Hello from local-path-test' && \
4447
cp /config/text.txt /test/test.txt && \

provisioner.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ func (p *LocalPathProvisioner) Provision(opts pvController.VolumeOptions) (*v1.P
186186

187187
createCmdsForPath := []string{
188188
"mkdir",
189-
"-m", "0770",
189+
"-m", "0777",
190190
"-p",
191191
}
192192
if err := p.createHelperPod(ActionTypeCreate, createCmdsForPath, name, path, node.Name); err != nil {

0 commit comments

Comments
 (0)