Add a property to Mount trait that creates then mounts a PVC
Release Note
NONE
fixes #2994
@squakez please review
The latest changes have hardly broken the build. Please, have a look.
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.
@squakez when creating the example I found out several things:
-
accessModeswas 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? -
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?
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.
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!