Fix python script
This commit is contained in:
parent
c94377d6bc
commit
151285b757
@ -9,7 +9,7 @@ REPOS = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TMP_DIR = ".tmp-repos"
|
TMP_DIR = ".tmp-repos"
|
||||||
OUTPUT_FILE = ".tmp-repos/observability-stack/manifests/prometheus-scrape-secret/additional-scrape-configs.yaml"
|
OUTPUT_FILE = os.path.join(TMP_DIR, "observability-stack/manifests/prometheus-scrape-secret/additional-scrape-configs.yaml")
|
||||||
|
|
||||||
os.makedirs(TMP_DIR, exist_ok=True)
|
os.makedirs(TMP_DIR, exist_ok=True)
|
||||||
|
|
||||||
@ -37,11 +37,11 @@ def write_scrape_config(jobs):
|
|||||||
for repo, targets in jobs.items():
|
for repo, targets in jobs.items():
|
||||||
result.append({
|
result.append({
|
||||||
"job_name": repo,
|
"job_name": repo,
|
||||||
"static_configs": [
|
"static_configs": [{"targets": targets}]
|
||||||
{"targets": targets}
|
|
||||||
]
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
scrape_yaml = "# This content will be auto-updated by the pipeline\n" + yaml.dump(result, sort_keys=False)
|
||||||
|
|
||||||
secret = {
|
secret = {
|
||||||
"apiVersion": "v1",
|
"apiVersion": "v1",
|
||||||
"kind": "Secret",
|
"kind": "Secret",
|
||||||
@ -54,13 +54,13 @@ def write_scrape_config(jobs):
|
|||||||
},
|
},
|
||||||
"type": "Opaque",
|
"type": "Opaque",
|
||||||
"stringData": {
|
"stringData": {
|
||||||
"additional-scrape-configs.yaml": "# This content will be auto-updated by the pipeline\n" + yaml.dump(result)
|
"additional-scrape-configs.yaml": scrape_yaml
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
os.makedirs(os.path.dirname(OUTPUT_FILE), exist_ok=True)
|
os.makedirs(os.path.dirname(OUTPUT_FILE), exist_ok=True)
|
||||||
with open(OUTPUT_FILE, "w") as f:
|
with open(OUTPUT_FILE, "w") as f:
|
||||||
yaml.dump(secret, f)
|
yaml.dump(secret, f, sort_keys=False)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
jobs = collect_targets()
|
jobs = collect_targets()
|
||||||
|
|||||||
@ -23,6 +23,4 @@ else
|
|||||||
git add manifests/prometheus-scrape-secret/additional-scrape-configs.yaml
|
git add manifests/prometheus-scrape-secret/additional-scrape-configs.yaml
|
||||||
git commit -m "auto: update Prometheus scrape config"
|
git commit -m "auto: update Prometheus scrape config"
|
||||||
git push origin master
|
git push origin master
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cat .tmp-repos/observability-stack/manifests/prometheus-scrape-secret/additional-scrape-configs.yaml
|
|
||||||
Loading…
x
Reference in New Issue
Block a user