Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CIV-5336 Dynamically set backend_url in frontend configmap based on environment #26

Open
wants to merge 1 commit into
base: test-identity-ci
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ kind: ConfigMap
metadata:
name: uni-resolver-frontend
data:
backend_url: https://did.civic.com/
backend_url: {{backendUrl}}
16 changes: 13 additions & 3 deletions ci/deploy-k8s-aws/scripts/prepare-deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,18 +202,28 @@ def generate_ingress(containers, outputdir, deploymentdomain):
fout.close()


def copy_app_deployment_specs(outputdir):
def copy_app_deployment_specs(outputdir, deploymentdomain):
print('#### Current python working path')
working_path = pathlib.Path().absolute()
print(working_path)
# Configmap has to be deployed before the applications
copy('/app-specs/configmap-uni-resolver-frontend.yaml', outputdir + '/configmap-uni-resolver-frontend.yaml')
replace_and_copy('/app-specs/configmap-uni-resolver-frontend.yaml', outputdir + '/configmap-uni-resolver-frontend.yaml', 'backendUrl', deploymentdomain)
add_deployment('configmap-uni-resolver-frontend.yaml', outputdir)
copy('/app-specs/deployment-uni-resolver-frontend.yaml', outputdir + '/deployment-uni-resolver-frontend.yaml')
add_deployment('deployment-uni-resolver-frontend.yaml', outputdir)
copy('/app-specs/deployment-uni-resolver-web.yaml', outputdir + '/deployment-uni-resolver-web.yaml')
add_deployment('deployment-uni-resolver-web.yaml', outputdir)

def replace_and_copy(infile, outfile, templateKey, value):
fin = open(infile, "r")
fout = open(outfile, "w")
for line in fin:
print('Replacing ' + '{{' + templateKey + '}}' + ' with ' + value)
fout.write(line.replace('{{' + templateKey + '}}', value))
fout.close()
fin.close()


def main(argv):
print('#### Current python script path')
absolute_path = pathlib.Path(__file__).parent.absolute()
Expand Down Expand Up @@ -258,7 +268,7 @@ def main(argv):
generate_deployment_specs(containers, outputdir)

# copy app deployment specs
copy_app_deployment_specs(outputdir)
copy_app_deployment_specs(outputdir, deploymentdomain)

# copy namespace files
copy('/namespace/namespace-setup.yaml', './deploy/namespace-setup.yaml')
Expand Down