-
Notifications
You must be signed in to change notification settings - Fork 46
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
[prometheus-operator] feat: add scripts to make upgrading easier #742
Conversation
This moves all the mesosphere-related templates to the patch folder. This makes it easier to update the operator with a copy and replace as none of the mesosphere files will get lost. Signed-off-by: Sam Tran <[email protected]>
This adds patch files that copy all the mesosphere files into the templates/ folder. This way they get deployed as part of the chart. It makes it easier to keep all the patches in one place and know what changes are needed/differ from upstream. Signed-off-by: Sam Tran <[email protected]>
This adds a helper file so that all the patch files can use the git_add_and_commit function which adds and commits all the files that were changed as part of the patch script. This should make it easy to see the commit history of what changed. Signed-off-by: Sam Tran <[email protected]>
This commit updates the patch script to use a docker image as the previous code did not run on OSX. Also, due to the underlying go-parser lib used in the yq docker image, updating a yaml file automatically reformats the yaml removing empty newlines and converting multiline strings into one line[1]. This makes it hard to see the actual needed change for patch7 which is just to update the crd volumeClaimTemplate.metadata stanza. Thus, patch7 is changed to apply two commits, one to simply let yq format the file with no new changes and a second commit with the needed change. Similar to what we do with chart revision changes. Also updated the helper script to accept a commit message. [1] mikefarah/yq#465 (comment) Signed-off-by: Sam Tran <[email protected]>
This script does a sparse clone of helm/stable/prometheus-operator and replaces all the files in our fork with latest upstream. Then it applies all the patches in the /patch folder which should now make updating our prometheus chart a bit easier. Signed-off-by: Sam Tran <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 I wish we did this with all our forks.
wow nice. Could we get a quick readme about how these scripts are run? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing 🙌 the only other thing i can think of is this change here that we often forget to apply: https://github.com/mesosphere/charts/pull/486/files cc @alejandroEsc
@alejandroEsc oh yeah for sure. I'll add in comments to the scripts as well so it's easier to understand
@gracedo i knew there was something missing! I thought it was this fix but yes, there's more. Okay I'll add a patch for that. Thanks for catching 🙏 |
Signed-off-by: Sam Tran <[email protected]>
Add an UPGRADING doc so users know what to do to upgrade. Add comments to the patch scripts so users know what each one does. crd patch script needed explaining. Signed-off-by: Sam Tran <[email protected]>
This adds back the check for `monitoring.coreos.com/v1` that was removed from upstream. Signed-off-by: Sam Tran <[email protected]>
e695427
to
57af579
Compare
… * chore: move all mesosphere files to patch This moves all the mesosphere-related templates to the patch folder. This makes it easier to update the operator with a copy and replace as none of the mesosphere files will get lost. Signed-off-by: Sam Tran <[email protected]> * feat: add patch files This adds patch files that copy all the mesosphere files into the templates/ folder. This way they get deployed as part of the chart. It makes it easier to keep all the patches in one place and know what changes are needed/differ from upstream. Signed-off-by: Sam Tran <[email protected]> * feat: add helpers script for git commands This adds a helper file so that all the patch files can use the git_add_and_commit function which adds and commits all the files that were changed as part of the patch script. This should make it easy to see the commit history of what changed. Signed-off-by: Sam Tran <[email protected]> * chore: update prometheus crd patch script This commit updates the patch script to use a docker image as the previous code did not run on OSX. Also, due to the underlying go-parser lib used in the yq docker image, updating a yaml file automatically reformats the yaml removing empty newlines and converting multiline strings into one line[1]. This makes it hard to see the actual needed change for patch7 which is just to update the crd volumeClaimTemplate.metadata stanza. Thus, patch7 is changed to apply two commits, one to simply let yq format the file with no new changes and a second commit with the needed change. Similar to what we do with chart revision changes. Also updated the helper script to accept a commit message. [1] mikefarah/yq#465 (comment) Signed-off-by: Sam Tran <[email protected]> * feat: add update_operator script This script does a sparse clone of helm/stable/prometheus-operator and replaces all the files in our fork with latest upstream. Then it applies all the patches in the /patch folder which should now make updating our prometheus chart a bit easier. Signed-off-by: Sam Tran <[email protected]> * chore: add newlines from PR review Signed-off-by: Sam Tran <[email protected]> * chore: add doc for upgrading + patch comments Add an UPGRADING doc so users know what to do to upgrade. Add comments to the patch scripts so users know what each one does. crd patch script needed explaining. Signed-off-by: Sam Tran <[email protected]> * chore: add patch for checking CRD exists again This adds back the check for that was removed from upstream. Signed-off-by: Sam Tran <[email protected]> * chore: fixup shellcheck errors Co-authored-by: Joe Julian <[email protected]>
…ier (#742) * chore: move all mesosphere files to patch This moves all the mesosphere-related templates to the patch folder. This makes it easier to update the operator with a copy and replace as none of the mesosphere files will get lost. Signed-off-by: Sam Tran <[email protected]> * feat: add patch files This adds patch files that copy all the mesosphere files into the templates/ folder. This way they get deployed as part of the chart. It makes it easier to keep all the patches in one place and know what changes are needed/differ from upstream. Signed-off-by: Sam Tran <[email protected]> * feat: add helpers script for git commands This adds a helper file so that all the patch files can use the git_add_and_commit function which adds and commits all the files that were changed as part of the patch script. This should make it easy to see the commit history of what changed. Signed-off-by: Sam Tran <[email protected]> * chore: update prometheus crd patch script This commit updates the patch script to use a docker image as the previous code did not run on OSX. Also, due to the underlying go-parser lib used in the yq docker image, updating a yaml file automatically reformats the yaml removing empty newlines and converting multiline strings into one line[1]. This makes it hard to see the actual needed change for patch7 which is just to update the crd volumeClaimTemplate.metadata stanza. Thus, patch7 is changed to apply two commits, one to simply let yq format the file with no new changes and a second commit with the needed change. Similar to what we do with chart revision changes. Also updated the helper script to accept a commit message. [1] mikefarah/yq#465 (comment) Signed-off-by: Sam Tran <[email protected]> * feat: add update_operator script This script does a sparse clone of helm/stable/prometheus-operator and replaces all the files in our fork with latest upstream. Then it applies all the patches in the /patch folder which should now make updating our prometheus chart a bit easier. Signed-off-by: Sam Tran <[email protected]> * chore: add newlines from PR review Signed-off-by: Sam Tran <[email protected]> * chore: add doc for upgrading + patch comments Add an UPGRADING doc so users know what to do to upgrade. Add comments to the patch scripts so users know what each one does. crd patch script needed explaining. Signed-off-by: Sam Tran <[email protected]> * chore: add patch for checking CRD exists again This adds back the check for that was removed from upstream. Signed-off-by: Sam Tran <[email protected]> * chore: fixup shellcheck errors Co-authored-by: Joe Julian <[email protected]>" This reverts commit 54b4815.
* Revert "[prometheus-operator] chore: upgrade to v9.3.1 (#743) * chore: copy upstream chart version: 9.3.1 * chore: apply patch_1_mesosphere_dashboards.sh * chore: apply patch_2_mesosphere_cron_jobs.sh * chore: apply patch_3_mesosphere_hooks.sh * chore: apply patch_4_ingress_rbac.sh * chore: apply patch_5_mesosphere_rules.sh * chore: apply patch_6_mesosphere_values.sh * chore: apply patch_7_prometheus_crd.sh - reformat yaml with yq (no new changes) * chore: apply patch_7_prometheus_crd.sh - update volumeClaimTemplate * chore: apply patch_8_prometheus_operator_crd.sh" This reverts commit b88c046. * Revert "[prometheus-operator] feat: add scripts to make upgrading easier (#742) * chore: move all mesosphere files to patch This moves all the mesosphere-related templates to the patch folder. This makes it easier to update the operator with a copy and replace as none of the mesosphere files will get lost. Signed-off-by: Sam Tran <[email protected]> * feat: add patch files This adds patch files that copy all the mesosphere files into the templates/ folder. This way they get deployed as part of the chart. It makes it easier to keep all the patches in one place and know what changes are needed/differ from upstream. Signed-off-by: Sam Tran <[email protected]> * feat: add helpers script for git commands This adds a helper file so that all the patch files can use the git_add_and_commit function which adds and commits all the files that were changed as part of the patch script. This should make it easy to see the commit history of what changed. Signed-off-by: Sam Tran <[email protected]> * chore: update prometheus crd patch script This commit updates the patch script to use a docker image as the previous code did not run on OSX. Also, due to the underlying go-parser lib used in the yq docker image, updating a yaml file automatically reformats the yaml removing empty newlines and converting multiline strings into one line[1]. This makes it hard to see the actual needed change for patch7 which is just to update the crd volumeClaimTemplate.metadata stanza. Thus, patch7 is changed to apply two commits, one to simply let yq format the file with no new changes and a second commit with the needed change. Similar to what we do with chart revision changes. Also updated the helper script to accept a commit message. [1] mikefarah/yq#465 (comment) Signed-off-by: Sam Tran <[email protected]> * feat: add update_operator script This script does a sparse clone of helm/stable/prometheus-operator and replaces all the files in our fork with latest upstream. Then it applies all the patches in the /patch folder which should now make updating our prometheus chart a bit easier. Signed-off-by: Sam Tran <[email protected]> * chore: add newlines from PR review Signed-off-by: Sam Tran <[email protected]> * chore: add doc for upgrading + patch comments Add an UPGRADING doc so users know what to do to upgrade. Add comments to the patch scripts so users know what each one does. crd patch script needed explaining. Signed-off-by: Sam Tran <[email protected]> * chore: add patch for checking CRD exists again This adds back the check for that was removed from upstream. Signed-off-by: Sam Tran <[email protected]> * chore: fixup shellcheck errors Co-authored-by: Joe Julian <[email protected]>" This reverts commit 54b4815.
…ier (mesosphere#742)" This reverts commit dcdf015.
What type of PR is this?
Feature
What this PR does/ why we need it:
Upgrading prometheus has been problematic because we have a bunch of patches we apply on top of the upstream chart. Each time has been manual and sometimes we've missed something during an upgrade.
This PR adds all the mesosphere-specific files & changes (templates, hooks, etc) to the
/patches
folder. There are also scripts that apply those patches as a set. This should make it easy to follow which files are added/amended after copying the upstream chart. This is somewhat akin to how DB migrations work in Rails (this was years ago though, things may have changed).Now we can run
./upgrade_operator.sh
and it should take care of all the rest.Here are the files that are mesophere-specific:
Which issue(s) this PR fixes:
https://jira.d2iq.com/browse/D2IQ-67095
Special notes for your reviewer:
I mostly did this from the diff of copying the latest chart and trying to follow PR #619. It's possible I missed some files so definitely would appreciate anyone who's done a prometheus upgrade to make doubly sure I got everything.
Does this PR introduce a user-facing change?:
Checklist