INFRA-3343 | Saurabh | Adding cluster migration scripts (#964)
* INFRA-3343 | Saurabh | Adding cluster migration scripts * INFRA-3343 | Saurabh | Adding cluster migration scripts * INFRA-3343 | Saurabh | Add token and cookie * INFRA-3343 | Saurabh | kutegen
This commit is contained in:
committed by
GitHub
parent
607c2e0d06
commit
d59ec2e3f2
2
kutegen
2
kutegen
Submodule kutegen updated: 810d493c2f...4b2711efde
57
scripts/dashboard_migration.py
Normal file
57
scripts/dashboard_migration.py
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
import requests
|
||||||
|
|
||||||
|
|
||||||
|
url = "https://gi-deployment-portal.cmd.navi-tech.in"
|
||||||
|
s = requests.Session()
|
||||||
|
cookie = "" # FILL cookie
|
||||||
|
x_xsrf_token = "" # FILL token
|
||||||
|
s.headers.update({'cookie': cookie, 'x-xsrf-token': x_xsrf_token})
|
||||||
|
list_manifest_path = "/api/grafana/dashboards"
|
||||||
|
|
||||||
|
r = s.post(url + list_manifest_path , json = {
|
||||||
|
"clusterId": 6,
|
||||||
|
"displayName": "Horizontal Pod Autoscaler",
|
||||||
|
"url": "https://grafana.prod.navi-gi.in/d/alJY6yWZz/kubernetes-horizontal-pod-autoscaler?orgId=1&var-datasource=000000001&var-namespace=${$.deployment.namespace}&var-hpa=${$.name}-navi-service&var-show_desired=or&var-show_max=or&var-show_min=or&kiosk=true",
|
||||||
|
"conditions": [
|
||||||
|
#{"path": "$.deployment", "value": "NULL", "operator": "exist"},
|
||||||
|
#{"path": "$.[?(@.extraResources.database || @.extraResources.docdb)]", "value": "NULL", "operator": "exist"}
|
||||||
|
#{"path": "$.metadata.language", "operator": "equal", "value": "Java"}
|
||||||
|
#{"path": "$.extraResources.dynamodb", "operator": "exist", "value": "NULL"}
|
||||||
|
#{"path": "$.flink", "value": "NULL", "operator": "exist"}
|
||||||
|
#{"path": "$.deployment.elasticSearch", "operator": "exist", "value": "NULL"}
|
||||||
|
#{"path": "$.deployment.efs", "operator": "exist", "value": "NULL"}
|
||||||
|
#{"path": "$.extraResources.elasticCache", "operator": "exist", "value": "NULL"}
|
||||||
|
{"path": "$.deployment.hpa.type", "value": "metrics", "operator": "equal"}
|
||||||
|
|
||||||
|
]
|
||||||
|
,"params" : []
|
||||||
|
})
|
||||||
|
|
||||||
|
t = s.post(url + list_manifest_path , json = {
|
||||||
|
"clusterId": 6,
|
||||||
|
"displayName": "VPA Recommendations",
|
||||||
|
"url": "https://grafana.prod.navi-gi.in/d/_BFbbSg7k/vpa-recommendations?orgId=1&refresh=5s&var-datasource=000000001&var-recommendation=target&var-namespace=${$.deployment.namespace}&var-targetName=${$.name}-navi-service&kiosk=true",
|
||||||
|
"conditions": [
|
||||||
|
#{"path": "$.deployment", "value": "NULL", "operator": "exist"},
|
||||||
|
#{"path": "$.[?(@.extraResources.database || @.extraResources.docdb)]", "value": "NULL", "operator": "exist"}
|
||||||
|
#{"path": "$.metadata.language", "operator": "equal", "value": "Java"}
|
||||||
|
#{"path": "$.extraResources.dynamodb", "operator": "exist", "value": "NULL"}
|
||||||
|
#{"path": "$.flink", "value": "NULL", "operator": "exist"}
|
||||||
|
#{"path": "$.deployment.elasticSearch", "operator": "exist", "value": "NULL"}
|
||||||
|
#{"path": "$.deployment.efs", "operator": "exist", "value": "NULL"}
|
||||||
|
#{"path": "$.extraResources.elasticCache", "operator": "exist", "value": "NULL"}
|
||||||
|
# {"path": "$.deployment.commonApiGateways[*]", "value": "NULL", "operator": "exist"}
|
||||||
|
{"path": "$.deployment[?(@.isVpaEnabled == true)]", "value": "NULL", "operator": "exist"}
|
||||||
|
|
||||||
|
]
|
||||||
|
,"params" : []
|
||||||
|
})
|
||||||
|
|
||||||
|
# r = s.post(url + list_manifest_path, json=["PODS"])
|
||||||
|
|
||||||
|
#r = s.post(url + list_manifest_path, json = {"paramName" : "TABLES"})
|
||||||
|
|
||||||
|
#r = s.delete(url + list_manifest_path)
|
||||||
|
|
||||||
|
print(r.json())
|
||||||
|
print(t.json())
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
INSERT INTO cluster (name)
|
||||||
|
VALUES
|
||||||
|
('aps1.np.navi-amc.in'),
|
||||||
|
('aps1.prod.navi-ppl.in'),
|
||||||
|
('aps1.prod.navi-amc.in');
|
||||||
Reference in New Issue
Block a user