Skip to content

Commit fb1258b

Browse files
committed
fix
1 parent 299cb99 commit fb1258b

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

mutate.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,15 @@
1818
api_instance = client.CoreV1Api(client.ApiClient(incluster_config.load_incluster_config()))
1919

2020
try:
21-
api_response = api_instance.list_namespaced_config_map(namespace="kube-system",pretty="true")
22-
#print(api_response)
21+
api_response = api_instance.read_namespaced_config_map("cluster-info","kube-system")
22+
for key,value in api_response.data.items():
23+
if key == "cluster":
24+
cluster_name = value
25+
else:
26+
pass
2327
except ApiException as e:
2428
print("Exception when calling CoreV1Api->list_namespaced_config_map: %s\n" % e)
2529

26-
for configmap in api_response.items:
27-
if configmap.metadata.name == "cluster-info":
28-
for key,value in configmap.data.items():
29-
if key == "cluster":
30-
cluster_name = value
31-
else:
32-
pass
33-
else:
34-
pass
35-
3630
if cluster_name is None:
3731
exit(1)
3832
else:

0 commit comments

Comments
 (0)