kubeplus
kubeplus copied to clipboard
Use PV and PVC backed volumes to store application charts
Application charts are stored on local file system (on the path /) of helmer and kubeconfiggenerator. See below for a reference:
https://github.com/cloud-ark/kubeplus/blob/master/plugins/kubectl-upload-chart#L14-#L15
The corresponding volumes of helmer and kubeconfiggenerator are not persistent. If KubePlus Pod is recreated (for instance, when KubePlus is updated), the charts stored on this local volumes of the Pod are lost. We should use a PVC backed volume with helmer and kubeconfiggenerator for storing the chart.
We should mark such a PVC with the following:
helm.sh/resource-policy: "keep"
Let's mount the PVC on the path: /kubeplus
Following changes will be required after this:
- In kubectl-upload-chart, we will need to specify "/kubeplus" as the target path when copying the local chart
- In helmer, whereever we refer to chart location as ("./
"), we will have to change it to ("./kubeplus/ ") (e.g.: https://github.com/cloud-ark/kubeplus/blob/master/platform-operator/helm-pod/main.go#L945) (lines: 945, 951, 962, 1099) - In ./deploy/kubeconfiggenerator.py, check all the places where "chartName" is referenced. All such places will most likely be pointing to ("./<chartName>"). These will need to be changed to ("./kubeplus/<chartName>"). For example:
- in method download_and_untar_chart (https://github.com/cloud-ark/kubeplus/blob/master/deploy/kubeconfiggenerator.py#L543)
- in method get_chart_yaml (https://github.com/cloud-ark/kubeplus/blob/master/deploy/kubeconfiggenerator.py#L578)
- in method check_and_install_crds (https://github.com/cloud-ark/kubeplus/blob/master/deploy/kubeconfiggenerator.py#L598)
- in method delete_chart_crds (https://github.com/cloud-ark/kubeplus/blob/master/deploy/kubeconfiggenerator.py#L610)
- in method check_chart (https://github.com/cloud-ark/kubeplus/blob/master/deploy/kubeconfiggenerator.py#L798)
@SuyogShinde942 ^^
Carefully go through the code in kubeconfiggenerator.py and helmer/main.go to see if we are not missing any place where we will need to update the chart location.
Thank you, I'll be working on this issue. Will let you know if any doubts.
For testing whether PV works as expected, here are the steps:
- Deploy KubePlus with a version (say, 4.0.0)
- Register HelloWorldService CRD. Use the localchart option. This will require uploading the hello-world chart to KubePlus
- Create an instance of HelloWorldService
- Use helm upgrade command to upgrade KubePlus release to version 4.0.1
- Once new KubePlus Pod is RUNNING, exec into the helmer container and check "/chart" folders. Inside "/chart", there should be expanded hello-world chart
- Create another instance of HelloWorldService
If steps 5 and 6 are successful then it will mean that PV and PVC worked as expected. This is because, even though KubePlus Pod is newely created, its file system is not affected.
https://github.com/cloud-ark/kubeplus/pull/1378
I have created a PR for the above request, Please let me know if any changes are needed