camel-k icon indicating copy to clipboard operation
camel-k copied to clipboard

Add a property to Mount trait that creates then mounts a PVC

Open haanhvu opened this issue 3 years ago • 5 comments

Release Note

NONE

fixes #2994

@squakez please review

haanhvu avatar Apr 22 '22 19:04 haanhvu

The latest changes have hardly broken the build. Please, have a look.

squakez avatar Apr 29 '22 08:04 squakez

The latest changes have hardly broken the build. Please, have a look.

Yeah the errors are mostly about go syntax and kubernetes api. I'll take a look shortly.

haanhvu avatar Apr 29 '22 12:04 haanhvu

@squakez when creating the example I found out several things:

  1. accessModes was missed in the pvc definition. So I added a ReadWriteOnce accessModes in the pvc definition. In fact another option would be letting users specify the accessModes in the trait property. What do you prefer?

  2. The pvc couldn't be created due to this error: Cannot reconcile Integration routes: error executing post actions: error during apply resource: /pvc-example1: persistentvolumeclaims "pvc-example1" is forbidden: User "system:serviceaccount:default:camel-k-operator" cannot patch resource "persistentvolumeclaims" in API group "" at the cluster scope.

This can be easily fixed with the kubectl create clusterrolebinding command. However, is this strange that the operator cannot patch pvc by default? Because from what I see in https://github.com/apache/camel-k/blob/main/config/rbac/operator-role.yaml#L70&L80 and https://github.com/apache/camel-k/blob/main/config/rbac/patch-role-to-clusterrole.yaml the operator can patch pvc at the cluster scope?

haanhvu avatar May 17 '22 11:05 haanhvu

About 1) I think it would be nice to let the user provide the info, so we might add to the trait parse. As for 2) I think you're missing in the creation of the PersistentVolumeClaim struct to define the namespace, so probably it tries to install at cluster scope, for which the namespaced operator has no privileges. Try to amend that and see how it goes.

squakez avatar May 17 '22 14:05 squakez

This PR has been automatically marked as stale due to 90 days of inactivity. It will be closed if no further activity occurs within 15 days. If you think that’s incorrect or the issue should never stale, please simply write any comment. Thanks for your contributions!

github-actions[bot] avatar Sep 19 '22 00:09 github-actions[bot]