-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PWX-30455] feat: volume-mount override via custom mount #1168
Conversation
Signed-off-by: Shivanjan Chakravorty <schakravorty@purestorage.com>
Signed-off-by: Shivanjan Chakravorty <schakravorty@purestorage.com>
0b99808
to
e394504
Compare
Signed-off-by: Shivanjan Chakravorty <schakravorty@purestorage.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #1168 +/- ##
==========================================
+ Coverage 75.82% 75.85% +0.02%
==========================================
Files 64 64
Lines 18100 18122 +22
==========================================
+ Hits 13724 13746 +22
Misses 3403 3403
Partials 973 973
☔ View full report in Codecov by Sentry. |
Signed-off-by: Shivanjan Chakravorty <schakravorty@purestorage.com>
Signed-off-by: Shivanjan Chakravorty <schakravorty@purestorage.com>
f23644f
to
cdc561f
Compare
This PR is stale because it has been in review for 3 days with no activity. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we please add a "manual test" to prove that the code-change is working?
For example:
- add the following into the STC:
kind: StorageCluster
spec:
volumes:
- hostPath:
path: /apps/px/cores
mountPath: /var/cores
name: px-cores
- get the POD-yaml from the resulting deployment, and
- show that the POD is using the overridden mount (either as the only mounting to
/var/cores
destination, or as the last one mounting to this destination).
return t.mountsFromVolInfo(volumeInfoList) | ||
} | ||
|
||
func (t *template) overrideVolumeMount(volInfos []volumeInfo) []volumeInfo { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this called overrideVolumeMount
?
- we are not overriding the internal mounts-list
- instead, we are filtering (and extending) the list that was provided as input
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are not just filtering but also modifying the host path property inside the function
volPaths[volInfos[i].mountPath] = i | ||
} | ||
|
||
for i := range t.cluster.Spec.Volumes { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we'll take the volInfos
first, then we'll append all the previous cluster.Spec.Volumes
This seems to be clashing with how the px-runc is working on the "lower level":
- "default" mounts "go in" first
- "custom mounts" will go after the "default mounts" -- and have the opportunity to override the defaults
Is this code behaving the same?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the ticket requires allowing to existing mount paths with a custom hostpath
this function is triggered at last as this will allow us to add more mount paths as well as modify any existing mount paths that is utilized by our application
}) | ||
} else { | ||
volInfos[existingVolIdx].hostPath = v.HostPath.String() | ||
volInfos[existingVolIdx].mountPropagation = v.MountPropagation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we overriding only the host-path and the mount-propagation?
Shouldn't we at least copy the mount-options (i.e. read-only)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for existing mounts, if a stc yaml overrides the mount options then it could affect the functionality of porx
imagine someone makes the oci log file to be read only then we do not get to write the logs
Ping? |
This PR is stale because it has been in review for 3 days with no activity. |
I have added the output of the requested changes as well image: stc
ls inside one of the node
|
Uh.. that doesn't seem right (I'm glad we tested this)
Could you run
|
Signed-off-by: Shivanjan Chakravorty <schakravorty@purestorage.com>
Ok.. did some extra testing, using px-operator image TEST's input modification -- using 2 modifications with the same destination ( apiVersion: core.libopenstorage.org/v1
kind: StorageCluster
spec:
volumes:
- hostPath:
path: /mnt/px-cores
mountPath: /var/cores
name: px-cores
- hostPath:
path: /mnt/px-cores22
mountPath: /var/cores
name: px-cores22 RESULT= FAIL: Portworx POX has
kind: Pod
spec:
containers:
- name: portworx
volumeMounts:
- mountPath: /var/cores
name: diagsdump
...
volumes:
- hostPath:
path: /var/cores
type: ""
name: diagsdump
- hostPath:
path: /mnt/px-cores
type: ""
name: user-px-cores
- hostPath:
path: /mnt/px-cores22
type: ""
name: user-px-cores22 RESULT= FAIL: Actual
[
{
"destination": "/var/cores",
"type": "bind",
"source": "/var/cores",
"options": [
"rbind",
"rprivate"
]
},
...
] Please DO NOT merge this PR! |
Hi, @zoxpx appoligies for the confusion the later results I sent you uses this image
the previous image was missing this commit e105361 it uses the same storage cluster file and doesn't crash
|
Closing this as we will use #1226 for this fix. |
What this PR does / why we need it:
override volume mounts in stc to mount it different host path
Which issue(s) this PR fixes (optional)
Closes #PWX-30455