Fix python script
This commit is contained in:
parent
8f1c05e732
commit
c94377d6bc
@ -42,12 +42,27 @@ def write_scrape_config(jobs):
|
|||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
secret = {
|
||||||
|
"apiVersion": "v1",
|
||||||
|
"kind": "Secret",
|
||||||
|
"metadata": {
|
||||||
|
"name": "prometheus-additional-scrape-configs",
|
||||||
|
"namespace": "monitoring",
|
||||||
|
"labels": {
|
||||||
|
"app.kubernetes.io/name": "prometheus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"type": "Opaque",
|
||||||
|
"stringData": {
|
||||||
|
"additional-scrape-configs.yaml": "# This content will be auto-updated by the pipeline\n" + yaml.dump(result)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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(result, f)
|
yaml.dump(secret, f)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
jobs = collect_targets()
|
jobs = collect_targets()
|
||||||
write_scrape_config(jobs)
|
write_scrape_config(jobs)
|
||||||
print(f"✅ Generated: {OUTPUT_FILE}")
|
print(f"✅ Generated: {OUTPUT_FILE}")
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user