diff --git a/charts/kube-prometheus-stack/Chart.yaml b/charts/kube-prometheus-stack/Chart.yaml index 2cb38eee5308..138069901474 100644 --- a/charts/kube-prometheus-stack/Chart.yaml +++ b/charts/kube-prometheus-stack/Chart.yaml @@ -21,7 +21,7 @@ name: kube-prometheus-stack sources: - https://github.com/prometheus-community/helm-charts - https://github.com/prometheus-operator/kube-prometheus -version: 55.0.0 +version: 55.0.1 appVersion: v0.70.0 kubeVersion: ">=1.19.0-0" home: https://github.com/prometheus-operator/kube-prometheus diff --git a/charts/kube-prometheus-stack/ci/lint.sh b/charts/kube-prometheus-stack/ci/lint.sh new file mode 100644 index 000000000000..ab6137cc1eef --- /dev/null +++ b/charts/kube-prometheus-stack/ci/lint.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash + +set -euo pipefail + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +cd "${SCRIPT_DIR}/../" + +./hack/update_crds.sh +if ! git diff --exit-code; then + echo "Please run ./hack/update_crds.sh" + exit 1 +fi + +python3 -m venv venv +source venv/bin/activate +pip3 install -r hack/requirements.txt + +go install -a github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@latest +export PATH="$(go env GOPATH)/bin:$PATH" + +./hack/sync_prometheus_rules.py +if ! git diff --exit-code; then + echo "Changes inside rules are not supported!" + echo "Please run ./hack/sync_prometheus_rules.py" + exit 1 +fi + +./hack/sync_grafana_dashboards.py +if ! git diff --exit-code; then + echo "Changes inside dashboards are not supported!" + echo "Please run ./hack/sync_grafana_dashboards.py" + exit 1 +fi + +rm -rf ./venv ./*.git diff --git a/charts/kube-prometheus-stack/hack/requirements.txt b/charts/kube-prometheus-stack/hack/requirements.txt index 40ace1815776..7a19dec281bd 100644 --- a/charts/kube-prometheus-stack/hack/requirements.txt +++ b/charts/kube-prometheus-stack/hack/requirements.txt @@ -1,2 +1,3 @@ -PyYAML==5.4 +PyYAML==6.0.1 requests==2.31.0 +jsonnet diff --git a/charts/kube-prometheus-stack/hack/sync_prometheus_rules.py b/charts/kube-prometheus-stack/hack/sync_prometheus_rules.py index b7f6a5de091c..058ec66f66ce 100755 --- a/charts/kube-prometheus-stack/hack/sync_prometheus_rules.py +++ b/charts/kube-prometheus-stack/hack/sync_prometheus_rules.py @@ -73,6 +73,7 @@ def new_representer(dumper, data): 'min_kubernetes': '1.14.0-0', 'is_mixin': True, 'mixin_vars': {'_config': { + 'clusterLabel': 'cluster', 'windowsExporterSelector': 'job="windows-exporter"', 'kubeStateMetricsSelector': 'job="kube-state-metrics"', }} @@ -509,10 +510,10 @@ def main(): mixin = """ local kp = - { prometheusAlerts+:: {}, prometheusRules+:: {}} + - (import "%s") + + { prometheusAlerts+:: {}, prometheusRules+:: {}} + + (import "%s") + %s; - + kp.prometheusAlerts + kp.prometheusRules """