Skip to content

Commit

Permalink
[kube-prometheus-stack] Move CRDs into sub-charts (prometheus-communi…
Browse files Browse the repository at this point in the history
…ty#3547)

* [kube-prometheus-stack] Move CRDs into sub-charts

Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>

* fix lint

Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>

* Add toggle for sub-chart

Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>

* [kube-prometheus-stack] Move CRDs into sub-charts

Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>

* [kube-prometheus-stack] Add upgrade node

Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>

* fix lint

Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>

* Adjust CI values

Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>

---------

Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
Signed-off-by: Jan-Otto Kröpke <github@jkroepke.de>
  • Loading branch information
jkroepke authored and Matiasmct committed Aug 25, 2023
1 parent caac1a1 commit e98647c
Show file tree
Hide file tree
Showing 18 changed files with 36 additions and 5 deletions.
5 changes: 5 additions & 0 deletions charts/kube-prometheus-stack/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Python development for hack
venv
pyvenv.cfg
!**
charts/*
!charts/crds/
!charts/crds/**
Chart.lock
5 changes: 4 additions & 1 deletion charts/kube-prometheus-stack/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ name: kube-prometheus-stack
sources:
- https://github.com/prometheus-community/helm-charts
- https://github.com/prometheus-operator/kube-prometheus
version: 47.6.1
version: 48.0.0
appVersion: v0.66.0
kubeVersion: ">=1.16.0-0"
home: https://github.com/prometheus-operator/kube-prometheus
Expand All @@ -39,6 +39,9 @@ annotations:
url: https://github.com/prometheus-operator/kube-prometheus
dependencies:
- name: crds
version: "0.0.0"
condition: crds.enabled
- name: kube-state-metrics
version: "5.8.*"
repository: https://prometheus-community.github.io/helm-charts
Expand Down
7 changes: 7 additions & 0 deletions charts/kube-prometheus-stack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ _See [helm upgrade](https://helm.sh/docs/helm/helm_upgrade/) for command documen

A major chart version change (like v1.2.3 -> v2.0.0) indicates that there is an incompatible breaking change needing manual actions.

### From 47.x to 48.x

This version moved all CRDs into a dedicated sub-chart. No new CRDs are introduced in this version.
See [#3548](https://github.com/prometheus-community/helm-charts/issues/3548) for more context.

We do not expect any breaking changes in this version.

### From 46.x to 47.x

This version upgrades Prometheus-Operator to v0.66.0 with new CRDs (PrometheusAgent and ScrapeConfig).
Expand Down
3 changes: 3 additions & 0 deletions charts/kube-prometheus-stack/charts/crds/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
apiVersion: v2
name: crds
version: 0.0.0
3 changes: 3 additions & 0 deletions charts/kube-prometheus-stack/charts/crds/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# crds subchart

See: [https://github.com/prometheus-community/helm-charts/issues/3548](https://github.com/prometheus-community/helm-charts/issues/3548)
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ prometheus-node-exporter:
service:
targetPort: 9101
port: 9101

crds:
enabled: false
10 changes: 6 additions & 4 deletions charts/kube-prometheus-stack/hack/update_crds.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#!/bin/bash

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

if [[ $(uname -s) = "Darwin" ]]; then
VERSION="$(grep ^appVersion ../Chart.yaml | sed 's/appVersion: //g')"
VERSION="$(grep ^appVersion "${SCRIPT_DIR}/../Chart.yaml" | sed 's/appVersion: //g')"
else
VERSION="$(grep ^appVersion ../Chart.yaml | sed 's/appVersion:\s//g')"
VERSION="$(grep ^appVersion "${SCRIPT_DIR}/../Chart.yaml" | sed 's/appVersion:\s//g')"
fi

FILES=(
Expand All @@ -27,9 +29,9 @@ for line in "${FILES[@]}"; do

echo -e "Downloading Prometheus Operator CRD with Version ${VERSION}:\n${URL}\n"

echo "# ${URL}" > ../crds/"${DESTINATION}"
echo "# ${URL}" > "${SCRIPT_DIR}/../charts/crds/crds/${DESTINATION}"

if ! curl --silent --retry-all-errors --fail --location "${URL}" >> ../crds/"${DESTINATION}"; then
if ! curl --silent --retry-all-errors --fail --location "${URL}" >> "${SCRIPT_DIR}/../charts/crds/crds/${DESTINATION}"; then
echo -e "Failed to download ${URL}!"
exit 1
fi
Expand Down
5 changes: 5 additions & 0 deletions charts/kube-prometheus-stack/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ commonLabels: {}
# scmhash: abc123
# myLabel: aakkmd

## Install Prometheus Operator CRDs
##
crds:
enabled: true

## Create default rules for monitoring the cluster
##
defaultRules:
Expand Down

0 comments on commit e98647c

Please sign in to comment.