Commit eaf34a44 authored by Alexander Lercher's avatar Alexander Lercher

Changed deployment script

manually apply external ip (commented out)
parent 4f59db1d
import os import os
import sys import sys
EXTERNAL_IP = "143.205.173.225"
# apply or delete config
kube_command = 'apply' kube_command = 'apply'
if len(sys.argv) > 1: if len(sys.argv) == 2:
kube_command = sys.argv[1] kube_command = sys.argv[1]
paths = [] paths = []
for p, _, f in os.walk('./'): for p, _, f in os.walk('./'):
for file in f: for file in f:
if 'deployment.yml' == file: if 'deployment.yml' == file:
paths.append(os.path.join(p, '')) paths.append(os.path.normpath(p))
for path in paths: for path in paths:
os.system(f"kubectl {kube_command} -f {path}") os.system(f"kubectl {kube_command} -f {path}")
# if kube_command == 'apply':
# # apply external ip
# service_name = path.split(os.path.normpath('/'))[-2] # -1 is deployment folder
# if service_name.split('-')[-1] == 'microservice':
# # remove microservice suffix
# service_name = service_name[:len(service_name)-len('-microservice')]
# os.system(f"kubectl patch service {service_name} -p '{{\"spec\":{{\"externalIPs\":[\"{EXTERNAL_IP}\"]}}}}'")
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment