You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "hernanDatgDev (via GitHub)" <gi...@apache.org> on 2024/07/25 22:22:25 UTC
[PR] (#5654) Added emptyDir support to mount trait [camel-k]
hernanDatgDev opened a new pull request, #5709:
URL: https://github.com/apache/camel-k/pull/5709
<!-- Description -->
Handles: https://github.com/apache/camel-k/issues/5654
Currently there is no way to add an emptyDir volume without using a pod template. This is useful but using the pod template will override any volumes mounted when using the mount trait e.g. configmaps, secrets.
This PR adds the trait field `mount.empty-dirs` which uses the same syntax as the existing `mount.volumes` trait field. To add an emptyDir volume use:
`trait=mount.empty-dirs=my-empty-dir:/var/test`
📓 Note that the trait field `empty-dirs` will be translated to `emptyDirs` in the integration yaml (if using helm or working with yaml directly)
The example above will add the following to your integration yaml
```yaml
spec:
containers:
- name: integration
volumeMounts:
- mountPath: /var/test
name: my-empty-dir
volumes:
- emptyDir: {}
name: my-empty-dir
```
<!--
Enter your extended release note in the below block. If the PR requires
additional action from users switching to the new release, include the string
"action required". If no release note is required, write "NONE".
You can (optionally) mark this PR with labels "kind/bug" or "kind/feature" to make sure
the text is added to the right section of the release notes.
-->
**Release Note**
```release-note
NONE
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] (#5654) Added emptyDir support to mount trait [camel-k]
Posted by "hernanDatgDev (via GitHub)" <gi...@apache.org>.
hernanDatgDev commented on PR #5709:
URL: https://github.com/apache/camel-k/pull/5709#issuecomment-2253595777
@squakez Made the appropriate changes and updated the test as well. Thanks for the feedback!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] (#5654) Added emptyDir support to mount trait [camel-k]
Posted by "hernanDatgDev (via GitHub)" <gi...@apache.org>.
hernanDatgDev commented on PR #5709:
URL: https://github.com/apache/camel-k/pull/5709#issuecomment-2251513592
Also I renamed the existing mount trait field `mount.volumes` to `mount.persistent-volume-claims` since it is accurate to what the operator is actually mounting, a persistent volume claim. This is to help avoid confusion and make a distinction clear for what type of volume was being mounted. This seemed important since I was adding support for another volume type.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] (#5654) Added emptyDir support to mount trait [camel-k]
Posted by "squakez (via GitHub)" <gi...@apache.org>.
squakez merged PR #5709:
URL: https://github.com/apache/camel-k/pull/5709
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] (#5654) Added emptyDir support to mount trait [camel-k]
Posted by "squakez (via GitHub)" <gi...@apache.org>.
squakez commented on code in PR #5709:
URL: https://github.com/apache/camel-k/pull/5709#discussion_r1692815744
##########
pkg/trait/mount_test.go:
##########
@@ -160,9 +168,10 @@ func getNominalEnv(t *testing.T, traitCatalog *Catalog) *Environment {
},
Traits: v1.Traits{
Mount: &traitv1.MountTrait{
- Configs: []string{"configmap:my-cm"},
- Resources: []string{"secret:my-secret"},
- Volumes: []string{"my-pvc:/over/the/rainbow"},
+ Configs: []string{"configmap:my-cm"},
+ Resources: []string{"secret:my-secret"},
+ PersistentVolumeClaims: []string{"my-pvc:/over/the/rainbow"},
+ EmptyDirs: []string{"my-empty-dir:/some/path"},
Review Comment:
We should create a new test with empty dirs instead. So we test both the default (void) and the presence of the parameter.
##########
pkg/apis/camel/v1/trait/mount.go:
##########
@@ -33,7 +33,9 @@ type MountTrait struct {
// Syntax: [configmap|secret]:name[/key][@path], where name represents the resource name, key optionally represents the resource key to be filtered and path represents the destination path
Resources []string `property:"resources" json:"resources,omitempty"`
// A list of Persistent Volume Claims to be mounted. Syntax: [pvcname:/container/path]
- Volumes []string `property:"volumes" json:"volumes,omitempty"`
+ PersistentVolumeClaims []string `property:"persistent-volume-claims" json:"persistentVolumeClaims,omitempty"`
Review Comment:
We cannot change this without a period of deprecation notice. This change affects the API specification, so, it must be reverted. It was an unfortunate choice when we created it as it really was meant to be PersistentVolumeClaims. We may think to change this when moving to a major API upgrade.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org