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] Add custom CI actions #4065

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 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: 55.0.0
version: 55.0.1
appVersion: v0.70.0
kubeVersion: ">=1.19.0-0"
home: https://github.com/prometheus-operator/kube-prometheus
Expand Down
36 changes: 36 additions & 0 deletions charts/kube-prometheus-stack/ci/lint.sh
Original file line number Diff line number Diff line change
@@ -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
3 changes: 2 additions & 1 deletion charts/kube-prometheus-stack/hack/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
PyYAML==5.4
PyYAML==6.0.1
requests==2.31.0
jsonnet
7 changes: 4 additions & 3 deletions charts/kube-prometheus-stack/hack/sync_prometheus_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"',
}}
Expand Down Expand Up @@ -509,10 +510,10 @@ def main():

mixin = """
local kp =
{ prometheusAlerts+:: {}, prometheusRules+:: {}} +
(import "%s") +
{ prometheusAlerts+:: {}, prometheusRules+:: {}} +
(import "%s") +
%s;

kp.prometheusAlerts + kp.prometheusRules
"""

Expand Down