Skip to content
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] WIP: upgrade CRDs using helm #5175

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

jkroepke
Copy link
Member

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)

  • fixes #

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

  • DCO signed
  • Chart Version bumped
  • Title of the PR starts with chart name (e.g. [prometheus-couchdb-exporter])

@jkroepke
Copy link
Member Author

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]>
@GMartinez-Sisti
Copy link
Member

@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

I'm all up for it! 🙌 -> #4507

Comment on lines 25 to 34
- alertmanagerconfigs.monitoring.coreos.com
- alertmanagers.monitoring.coreos.com
- podmonitors.monitoring.coreos.com
- probes.monitoring.coreos.com
- prometheusagents.monitoring.coreos.com
- prometheuses.monitoring.coreos.com
- prometheusrules.monitoring.coreos.com
- scrapeconfigs.monitoring.coreos.com
- servicemonitors.monitoring.coreos.com
- thanosrulers.monitoring.coreos.com
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible we should make this dynamic so we don't miss new CRDs.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

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]>
@jkroepke
Copy link
Member Author

I'm all up for it! 🙌 -> #4507

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]>
@GMartinez-Sisti
Copy link
Member

I'm all up for it! 🙌 -> #4507

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?

Checksum? We can add a checksum file next to it, then run the same on ci and check the match.

@jkroepke
Copy link
Member Author

jkroepke commented Jan 15, 2025

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.

@GMartinez-Sisti
Copy link
Member

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.

@jkroepke jkroepke force-pushed the upgrade-crds branch 3 times, most recently from 0b25bf6 to d4e4126 Compare January 15, 2025 22:21
@jkroepke jkroepke force-pushed the upgrade-crds branch 8 times, most recently from 05bb2ce to f481141 Compare January 15, 2025 23:47
@jkroepke
Copy link
Member Author

What about check,

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.

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.

@GMartinez-Sisti
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants