|
| 1 | +--- |
| 2 | +name: bump-prometheus-operator |
| 3 | +description: >- |
| 4 | + Bump the prometheus-operator version shipped by the kube-prometheus-stack |
| 5 | + chart. Use when a new prometheus-operator/prometheus-operator release is out |
| 6 | + and the chart's appVersion needs to follow it: syncs CRDs, checks for new CRD |
| 7 | + kinds and RBAC changes, bumps the chart version, updates UPGRADE.md, and opens |
| 8 | + a PR. Triggers on "bump prometheus-operator", "update kube-prometheus-stack to |
| 9 | + the latest operator", "sync operator CRDs". |
| 10 | +--- |
| 11 | + |
| 12 | +# Bump prometheus-operator in kube-prometheus-stack |
| 13 | + |
| 14 | +Promotes the `appVersion` of `charts/kube-prometheus-stack` to a new |
| 15 | +`prometheus-operator/prometheus-operator` release and brings everything that |
| 16 | +travels with the operator (CRDs, RBAC, upgrade notes) along with it. |
| 17 | + |
| 18 | +## Scope of an operator bump |
| 19 | + |
| 20 | +The operator version is the chart's `appVersion`. A bump touches a small, |
| 21 | +fixed set of files — mirror the most recent merged bump PR (search |
| 22 | +`git log --oneline -S "appVersion: v" -- charts/kube-prometheus-stack/Chart.yaml`) |
| 23 | +rather than improvising: |
| 24 | + |
| 25 | +- `charts/kube-prometheus-stack/Chart.yaml` — `appVersion` + chart `version` |
| 26 | +- `charts/kube-prometheus-stack/charts/crds/crds/crd-*.yaml` (10 CRDs) and |
| 27 | + `charts/crds/files/crds.bz2` — regenerated, never hand-edited |
| 28 | +- `charts/kube-prometheus-stack/UPGRADE.md` — new section |
| 29 | +- `charts/kube-prometheus-stack/templates/prometheus-operator/clusterrole.yaml` |
| 30 | + — only if the operator's RBAC actually changed (see step 4) |
| 31 | + |
| 32 | +## Procedure |
| 33 | + |
| 34 | +### 1. Find the target version & branch |
| 35 | + |
| 36 | +```bash |
| 37 | +# Latest non-prerelease operator tag |
| 38 | +curl -s https://api.github.com/repos/prometheus-operator/prometheus-operator/releases/latest | jq -r .tag_name |
| 39 | +git checkout -b kube-prometheus-stack-bump-operator-<vX.Y.Z> upstream/main |
| 40 | +``` |
| 41 | + |
| 42 | +Always branch off a fresh `upstream/main` so the PR diff is just the bump. |
| 43 | + |
| 44 | +### 2. Bump Chart.yaml |
| 45 | + |
| 46 | +Set `appVersion` to the new `vX.Y.Z`. Bump the chart `version` following the |
| 47 | +precedent of the previous bump: historically a **minor** operator bump |
| 48 | +(e.g. `v0.91.0 → v0.92.0`) is released as a **major** chart bump |
| 49 | +(e.g. `86.x → 87.0.0`). Confirm the convention against the last bump PR. |
| 50 | + |
| 51 | +### 3. Regenerate CRDs |
| 52 | + |
| 53 | +`hack/update_crds.sh` reads `appVersion` from `Chart.yaml`, so bump Chart.yaml |
| 54 | +**first**, then: |
| 55 | + |
| 56 | +```bash |
| 57 | +bash charts/kube-prometheus-stack/hack/update_crds.sh |
| 58 | +``` |
| 59 | + |
| 60 | +This downloads the 10 CRDs from |
| 61 | +`prometheus-operator/.../<appVersion>/example/prometheus-operator-crd/` and |
| 62 | +rebuilds `charts/crds/files/crds.bz2`. |
| 63 | + |
| 64 | +**Check for new CRD kinds** — if the operator added a CRD, the `FILES` array in |
| 65 | +`update_crds.sh` (and the `crds` subchart) must be extended: |
| 66 | + |
| 67 | +```bash |
| 68 | +diff \ |
| 69 | + <(curl -s "https://api.github.com/repos/prometheus-operator/prometheus-operator/contents/example/prometheus-operator-crd?ref=<OLD>" | jq -r '.[].name' | sort) \ |
| 70 | + <(curl -s "https://api.github.com/repos/prometheus-operator/prometheus-operator/contents/example/prometheus-operator-crd?ref=<NEW>" | jq -r '.[].name' | sort) |
| 71 | +``` |
| 72 | + |
| 73 | +### 4. Check RBAC |
| 74 | + |
| 75 | +The chart's operator `ClusterRole` is maintained by hand, so confirm whether the |
| 76 | +operator's required RBAC changed between versions: |
| 77 | + |
| 78 | +```bash |
| 79 | +f=example/rbac/prometheus-operator/prometheus-operator-cluster-role.yaml |
| 80 | +diff \ |
| 81 | + <(curl -s "https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/<OLD>/$f") \ |
| 82 | + <(curl -s "https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/<NEW>/$f") |
| 83 | +``` |
| 84 | + |
| 85 | +A diff in only the `app.kubernetes.io/version` label = **no change needed**. |
| 86 | +Any new/removed `rules` entry = update |
| 87 | +`templates/prometheus-operator/clusterrole.yaml` to match. Most patch/minor |
| 88 | +operator bumps need no RBAC change. |
| 89 | + |
| 90 | +### 5. Update UPGRADE.md |
| 91 | + |
| 92 | +Prepend a `## From <old-major>.x to <new-major>.x` section. Copy the previous |
| 93 | +section's wording and the 10 `kubectl apply --server-side -f .../<NEW>/...` |
| 94 | +CRD commands, swapping the version. |
| 95 | + |
| 96 | +### 6. Validate |
| 97 | + |
| 98 | +```bash |
| 99 | +cd charts/kube-prometheus-stack |
| 100 | +helm dependency build . # required, or lint nil-pointers on subchart values |
| 101 | +helm lint . |
| 102 | +helm template t . | grep 'prometheus-operator:' # must show the new vX.Y.Z |
| 103 | +``` |
| 104 | + |
| 105 | +> CRDs live in the Helm-native `charts/crds/crds/` directory and are **not** |
| 106 | +> rendered by `helm template` — that is expected. The `crds.bz2` only feeds the |
| 107 | +> optional `crds.upgradeJob`. |
| 108 | +
|
| 109 | +### 7. Commit & PR |
| 110 | + |
| 111 | +- Sign off (DCO) — see `CONTRIBUTING.md#sign-off-your-work`. |
| 112 | +- Title: `[kube-prometheus-stack] Bump prometheus-operator to vX.Y.Z`. |
| 113 | +- On review updates, add new commits — **do not squash** (the PR is squashed on |
| 114 | + merge). |
| 115 | +- Fill the PR template; tick DCO + Chart Version bumped + title-starts-with-chart. |
0 commit comments