Skip to content

Commit 279a9dd

Browse files
authored
Merge pull request #2323 from callummole/turing-redeploy
move ban call to update_networkbans()
2 parents 1a1c821 + cf29cef commit 279a9dd

File tree

1 file changed

+23
-15
lines changed

1 file changed

+23
-15
lines changed

deploy.py

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -114,29 +114,34 @@ def setup_auth_gcloud(release, cluster=None):
114114
)
115115

116116

117-
def deploy(release, name=None):
118-
"""Deploys a federation member to a k8s cluster.
119-
120-
The deployment is done in the following steps:
121-
122-
1. Run secrets/ban.py to update network bans
123-
2. Deploy cert-manager
124-
3. Deploy mybinder helm chart
125-
4. Await deployed deployment and daemonsets to become Ready
117+
def update_networkbans(cluster):
118+
"""
119+
Run secrets/ban.py to update network bans
126120
"""
127-
if not name:
128-
name = release
129121

130-
print(BOLD + GREEN + f"Updating network-bans for {release}" + NC, flush=True)
122+
print(BOLD + GREEN + f"Updating network-bans for {cluster}" + NC, flush=True)
131123

132124
# some members have special logic in ban.py,
133125
# in which case they must be specified on the command-line
134126
ban_command = [sys.executable, "secrets/ban.py"]
135-
if release in {"turing-prod", "turing-staging", "turing", "ovh"}:
136-
ban_command.append(release)
127+
if cluster in {"turing-prod", "turing-staging", "turing", "ovh"}:
128+
ban_command.append(cluster)
137129

138130
subprocess.check_call(ban_command)
139131

132+
133+
def deploy(release, name=None):
134+
"""Deploys a federation member to a k8s cluster.
135+
136+
The deployment is done in the following steps:
137+
138+
1. Deploy cert-manager
139+
2. Deploy mybinder helm chart
140+
3. Await deployed deployment and daemonsets to become Ready
141+
"""
142+
if not name:
143+
name = release
144+
140145
setup_certmanager()
141146

142147
print(BOLD + GREEN + f"Starting helm upgrade for {release}" + NC, flush=True)
@@ -266,6 +271,9 @@ def main():
266271

267272
args = argparser.parse_args()
268273

274+
# if one argument given make cluster == release
275+
cluster = args.cluster or args.release
276+
269277
# Check if the local flag is set
270278
if not args.local:
271279
# Check if the script is being run on CI
@@ -293,7 +301,6 @@ def main():
293301
raise ValueError("Unrecognised input. Expecting either yes or no.")
294302

295303
# script is running on CI, proceed with auth and helm setup
296-
cluster = args.cluster or args.release
297304

298305
if cluster == "ovh":
299306
setup_auth_ovh(args.release, cluster)
@@ -304,6 +311,7 @@ def main():
304311
else:
305312
raise Exception("Cloud cluster not recognised!")
306313

314+
update_networkbans(cluster)
307315
deploy(args.release, args.name)
308316

309317

0 commit comments

Comments
 (0)