-
Notifications
You must be signed in to change notification settings - Fork 450
Closed
Description
I am able to do a GIT clone with a non-root user i.e via different UID and GID passes as podSecurityContext.runAsUser and podSecurityContext.fsGroup.
But while using GIT_SYNC_PERMISSIONS, argument, as "0755" I am getting this below error.
INFO: detected pid 1, running init handler
I0317 12:48:55.834540 11 main.go:321] "level"=0 "msg"="starting up" "args"=["/git-sync"] "pid"=11
I0317 12:48:55.834621 11 main.go:574] "level"=0 "msg"="cloning repo" "origin"="git@bitbucket.org:XXXX/YYYY.git" "path"="/workspace"
I0317 12:49:26.223966 11 main.go:480] "level"=0 "msg"="syncing git" "hash"="719007cc322f9cd1d1e3141c99f899e2be860a8c" "rev"="HEAD"
I0317 12:49:27.144134 11 main.go:501] "level"=0 "msg"="adding worktree" "branch"="origin/feature_1.0" "path"="/workspace/rev-719007cc322f9cd1d1e3141c99f899e2be860a8c"
I0317 12:49:27.164566 11 main.go:524] "level"=0 "msg"="reset worktree to hash" "hash"="719007cc322f9cd1d1e3141c99f899e2be860a8c" "path"="/workspace/rev-719007cc322f9cd1d1e3141c99f899e2be860a8c"
I0317 12:49:27.164676 11 main.go:528] "level"=0 "msg"="updating submodules"
I0317 12:49:27.196228 11 main.go:541] "level"=0 "msg"="changing file permissions" "mode"="01363"
E0317 12:49:27.197236 11 main.go:347] "msg"="failed to sync repo, aborting" "error"="error running command: exit status 1: { stdout: \"\", stderr: \"chmod: cannot read directory '/workspace/rev-719007cc322f9cd1d1e3141c99f899e2be860a8c': Permission denied\\n\" }"
YAML Configuration
apiVersion: apps/v1
kind: Deployment
metadata:
name: poc
spec:
selector:
matchLabels:
app: poc
replicas: 1
template:
metadata:
labels:
app: poc
spec:
securityContext:
runAsUser: 1004
fsGroup: 1004
containers:
- name: busybox
image: busybox
volumeMounts:
- name: buildproperties
mountPath: /opt/deployment/data # /opt/deployment is already present
subPath: data
stdin: true
initContainers:
- name: git-sync
image: k8s.gcr.io/git-sync/git-sync:v3.2.2
volumeMounts:
- name: buildproperties
mountPath: "/workspace"
- name: ssh-key
mountPath: /etc/git-secret/
readOnly: true
env:
- name: GIT_SYNC_SSH
value: "true"
- name: GIT_KNOWN_HOSTS
value: "false"
- name: GIT_SYNC_REPO
value: git@bitbucket.org:XXX/YYY.git
- name: GIT_SYNC_BRANCH
value: "master"
- name: GIT_SYNC_DEST
value: "data"
- name: GIT_SYNC_ONE_TIME
value: "true"
- name: GIT_SYNC_PERMISSIONS
value: "0777"
- name: GIT_SYNC_ADD_USER
value: "true"
- name: GIT_SYNC_ROOT
value: "/workspace"
volumes:
- name: buildproperties
emptyDir: {}
- name: ssh-key
secret:
secretName: bitbucket-ssh-key
defaultMode: 0400
Metadata
Metadata
Assignees
Labels
No labels