File tree Expand file tree Collapse file tree 1 file changed +6
-12
lines changed
Expand file tree Collapse file tree 1 file changed +6
-12
lines changed Original file line number Diff line number Diff line change 1818api_instance = client .CoreV1Api (client .ApiClient (incluster_config .load_incluster_config ()))
1919
2020try :
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
2327except 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-
3630if cluster_name is None :
3731 exit (1 )
3832else :
You can’t perform that action at this time.
0 commit comments