-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
[kube-prometheus-stack] upgrade CRDs using helm #5175
base: main
Are you sure you want to change the base?
Conversation
4ca8953
to
b7ab816
Compare
@QuentinBisson @GMartinez-Sisti this is super WIP (but working) what did you think? It based on https://github.com/vmware-tanzu/helm-charts/tree/main/charts/velero/templates/upgrade-crds?rgh-link-date=2025-01-15T09%3A52%3A20Z |
Signed-off-by: Jan-Otto Kröpke <[email protected]> Signed-off-by: Jan-Otto Kröpke <[email protected]> Signed-off-by: Jan-Otto Kröpke <[email protected]>
b7ab816
to
ba8f7e0
Compare
I'm all up for it! 🙌 -> #4507 |
charts/kube-prometheus-stack/charts/crds/templates/upgrade/clusterrole.yaml
Outdated
Show resolved
Hide resolved
Signed-off-by: Jan-Otto Kröpke <[email protected]> Signed-off-by: Jan-Otto Kröpke <[email protected]> Signed-off-by: Jan-Otto Kröpke <[email protected]>
Please take note that the CRDs needs to be pre-compressed, All CRDs in gzip format are approx. 300KB, while xz just using 80KB. The creation of the tar.xz is part of hack scripts, but how we protect us against suspicious tar files? |
Signed-off-by: Jan-Otto Kröpke <[email protected]> Signed-off-by: Jan-Otto Kröpke <[email protected]> Signed-off-by: Jan-Otto Kröpke <[email protected]>
fc09795
to
dd5fbcb
Compare
Checksum? We can add a checksum file next to it, then run the same on ci and check the match. |
I give-up after an hour to setup an reproducible tar archive which can be generated on any os (e.g. mac and linux) For example, I can't find a tar option on mac where I can drop the mtime of the files. GNU tar adds some pax header while bsd tar does not do it. |
Yeah, it’s hard to find a way with native commands, I usually fix these issues by running the commands in a docker container. |
0b25bf6
to
d4e4126
Compare
Signed-off-by: Jan-Otto Kröpke <[email protected]>
05bb2ce
to
f481141
Compare
Signed-off-by: Jan-Otto Kröpke <[email protected]>
f481141
to
ec80534
Compare
What about check,
please offer a solution. While tar isn't the big issue, xz might be. Seems not possible to get the same archive from macos/linux using xz compression. Even with gnu tar on mac, the archive is different. gz is not an option, because the compression rate is really, really bad. Tests with zstd works fine, however busybox does not support zstd. Then, I tried docker. The ubuntu docker image does not have xz pre installed. starting with apt-get first feels terrible slow. busybox have xz embedded, but does not offer capabilities to strip the mtime. |
Sure, I can test this during the weekend. |
Signed-off-by: Jan-Otto Kröpke <[email protected]>
Signed-off-by: Jan-Otto Kröpke <[email protected]>
Signed-off-by: Jan-Otto Kröpke <[email protected]>
Signed-off-by: Jan-Otto Kröpke <[email protected]>
Ready to review! |
Signed-off-by: Jan-Otto Kröpke <[email protected]>
Is it expected that your PR carry the binary #5175 (comment)? EDIT: Yes it is. Overall I quite like the job approach but i'm not really fond of the archive though. Is there a specific reason why we cannot use curl to fetch the crds from this chart app version instead? |
charts/kube-prometheus-stack/charts/crds/templates/upgrade/clusterrole.yaml
Show resolved
Hide resolved
charts/kube-prometheus-stack/charts/crds/templates/_helpers.tpl
Outdated
Show resolved
Hide resolved
charts/kube-prometheus-stack/charts/crds/templates/upgrade/clusterrole.yaml
Show resolved
Hide resolved
charts/kube-prometheus-stack/charts/crds/templates/upgrade/job.yaml
Outdated
Show resolved
Hide resolved
Signed-off-by: Jan-Otto Kröpke <[email protected]>
Signed-off-by: Jan-Otto Kröpke <[email protected]>
Signed-off-by: Jan-Otto Kröpke <[email protected]>
Yeah, sideloading is not good in enterprise context where internet is restricted. That lead to unexpected situations. One possible solution would be that we provide the CRDs as OCI image. Then, we can mount the image as PVC. but It will take some time: https://kubernetes.io/blog/2024/08/16/kubernetes-1-31-image-volume-source/ |
This is awesome! I started looking at ways I could implement something similar in our wrapper chart. We use Terraform to deploy this chart and manage 20-30 Kubernetes clusters. Performing the CRD upgrades manually when we needed to take a major version upgrade had become tedious. This will help out our org a ton and resolve our biggest pain point with the deployment. |
@aidanleuck great to know. Once implemented, we are happy about feedback. |
Really looking forward to this, too! If you need any early feedback, let me know! |
I like mounting an OCI image, but as you mentioned this is a cutting-edge feature and it won't work with older clusters. If I understand this PR correctly, the busybox image is doing the decompression of the CRD archive, the results of which are placed in a PVC that the kubectl pod uses to apply. Would it be simpler if you created a Dockerfile and extend the kubectl image? That way you don't need a shared PVC at all and you just use a single container image to run the job. CI/Deployment you can build the custom kubectl image and the CRDS bundled together. You can tag the image with the same version as the appVersion. This will get rid of the tar archive issue as well. Here's the pseudocode (Note use a multi-stage build if you want to merge all the crds into a single file)
job.yaml
Let me know if I am off base here and am missing something, but this seems like a simpler solution to the problem. I can whip up a POC if you like this idea. |
What this PR does / why we need it
Since helm does not support upgrading CRDs, it's an manual task for our end-users. However the velero chart https://github.com/vmware-tanzu/helm-charts/tree/main/charts/velero/templates/upgrade-crds implement a upgrade job using helm hooks that works for at least 1 year.
Which issue this PR fixes
(optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged)Special notes for your reviewer
I would leave it disabled for now in order to have the ability to test the job on real upgrades.
Checklist
[prometheus-couchdb-exporter]
)