Use fsGroup and handles NFS shares #413
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes: #395
Fixes: #357
This PR accomplishes a couple of things based on different environments.
When using the
projects_persistence
with aprojects_existing_claim
, depending on the storage provide ablock
device orfilesystem
device will present to the AWX instance writable only by theroot
user. This introduces a problem as theawx
user is unable to write under/var/lib/awx/projects
therefore not being able to sync projects.Using the
fsGroup
address the issue forblock
andfs
mounts so the volume will be mounted allowing theawx
user to write on it. However,fsGroup
does not work forNFS
shares as noted here: kubernetes/examples#260To work around this issue, we can use the
initContainer
approach to change the permissions and privileges for the mounted volume.Please refer to #395 (comment) and #357 (comment) for a full write-up while troubleshooting this issue.
Another important addition is the ability to the user specify extra volumes as mentioned at #395 (comment)
For example:
TL;DR
Before with nfs
Before with block
After with nfs
$ kubectl iexec awx /bin/bash 15:27:14 Namespace: default | Pod: ✔ awx-nfs-696dd649f5-zlqc4 Container: ✔ awx-nfs-web bash-4.4$ df -h /var/lib/awx/projects/ Filesystem Size Used Avail Use% Mounted on 192.168.111.46:/volume1/test-nfs-share 3.5T 1.3T 2.3T 36% /var/lib/awx/projects bash-4.4$ whoami awx bash-4.4$ id uid=1000(awx) gid=0(root) groups=0(root),1000 bash-4.4$ touch /var/lib/awx/projects/testing-works-now bash-4.4$ ls -la /var/lib/awx/projects/testing-works-now -rw-rw-rw-. 1 awx root 0 Jun 19 19:23 /var/lib/awx/projects/testing-works-now
After with block
TODO:
hostPath