Skip to content

Commit 5d43361

Browse files
committed
k8s: fix python3 compatibility issue for multi-region setup
Previously , the setup.py file was used for the kubernetes cluster setup across the multiple regions , which worked only for the python2 versions , this fix will make it compatible for the python3 versions as well Release note : None
1 parent 5898b5d commit 5d43361

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

cloud/kubernetes/multiregion/setup.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
# included in the /LICENSE file.
77

88

9-
import distutils.spawn
109
import json
1110
import os
1211
from subprocess import check_call,check_output
@@ -116,12 +115,12 @@
116115
for zone, context in contexts.items():
117116
external_ip = ''
118117
while True:
119-
external_ip = check_output(['kubectl', 'get', 'svc', 'kube-dns-lb', '--namespace', 'kube-system', '--context', context, '--template', '{{range .status.loadBalancer.ingress}}{{.ip}}{{end}}'])
118+
external_ip = check_output(['kubectl', 'get', 'svc', 'kube-dns-lb', '--namespace', 'kube-system', '--context', context, '--template', '{{range .status.loadBalancer.ingress}}{{.ip}}{{end}}']).decode('utf-8')
120119
if external_ip:
121120
break
122-
print 'Waiting for DNS load balancer IP in %s...' % (zone)
121+
print('Waiting for DNS load balancer IP in %s...' % (zone))
123122
sleep(10)
124-
print 'DNS endpoint for zone %s: %s' % (zone, external_ip)
123+
print('DNS endpoint for zone %s: %s' % (zone, external_ip))
125124
dns_ips[zone] = external_ip
126125

127126
# Update each cluster's DNS configuration with an appropriate configmap. Note
@@ -175,7 +174,7 @@
175174
check_call(['kubectl', 'apply', '-f', yaml_file, '--namespace', zone, '--context', context])
176175

177176
# Finally, initialize the cluster.
178-
print 'Sleeping 30 seconds before attempting to initialize cluster to give time for volumes to be created and pods started.'
177+
print('Sleeping 30 seconds before attempting to initialize cluster to give time for volumes to be created and pods started.')
179178
sleep(30)
180179
for zone, context in contexts.items():
181180
check_call(['kubectl', 'create', '-f', 'cluster-init-secure.yaml', '--namespace', zone, '--context', context])

0 commit comments

Comments
 (0)