Skip to content

Commit

Permalink
[kube-prometheus-stack] Add custom CI actions
Browse files Browse the repository at this point in the history
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
  • Loading branch information
jkroepke committed Dec 7, 2023
1 parent 1f94123 commit 2e164e6
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 5 deletions.
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 -e

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

0 comments on commit 2e164e6

Please sign in to comment.