From 1ccbaf99173eddd688a5e55b3e63ba03f8deb040 Mon Sep 17 00:00:00 2001 From: Pratap Mridha Date: Wed, 13 Mar 2024 22:41:10 +0530 Subject: [PATCH] Update/clusterconfig (#412) * update configuration and workflow * update entrypoint * update namespace * update configmap * change domain * add prod domain * update configmap * update preparedeployment * add resolver.identity.foundation --- .../kubernetes-deploy-to-cluster.yml | 2 +- .../configmap-uni-resolver-frontend.yaml | 2 +- .../deployment-uni-resolver-frontend.yaml | 26 +++++++++---------- .../deployment-uni-resolver-web.yaml | 4 +-- .../namespace/namespace-setup.sh | 2 +- .../namespace/namespace-setup.yaml | 4 +-- ci/deploy-k8s-aws/scripts/entrypoint.sh | 1 + ci/deploy-k8s-aws/scripts/k8s-template.yaml | 4 +-- .../scripts/prepare-deployment.py | 22 ++++++++++++++-- 9 files changed, 43 insertions(+), 24 deletions(-) diff --git a/.github/workflows/kubernetes-deploy-to-cluster.yml b/.github/workflows/kubernetes-deploy-to-cluster.yml index fc8de9094..eb8f51eda 100644 --- a/.github/workflows/kubernetes-deploy-to-cluster.yml +++ b/.github/workflows/kubernetes-deploy-to-cluster.yml @@ -26,7 +26,7 @@ jobs: - name: Deploy to AWS uses: ./ci/deploy-k8s-aws env: - KUBE_CONFIG_DATA: ${{env.KUBE_CONFIG_DATA}} + KUBE_CONFIG_DATA: ${{secrets.KUBE_CONFIG_DATA_BASE64_UNI_RESOLVER_PROD}} AWS_ACCESS_KEY_ID: ${{env.AWS_ACCESS_KEY_ID}} AWS_SECRET_ACCESS_KEY: ${{env.AWS_SECRET_ACCESS_KEY}} RPC_URL_TESTNET: ${{env.RPC_URL_TESTNET}} diff --git a/ci/deploy-k8s-aws/app-specs/configmap-uni-resolver-frontend.yaml b/ci/deploy-k8s-aws/app-specs/configmap-uni-resolver-frontend.yaml index 14a8e291c..23e620330 100644 --- a/ci/deploy-k8s-aws/app-specs/configmap-uni-resolver-frontend.yaml +++ b/ci/deploy-k8s-aws/app-specs/configmap-uni-resolver-frontend.yaml @@ -2,6 +2,6 @@ apiVersion: v1 kind: ConfigMap metadata: name: uni-resolver-frontend - namespace: uni-resolver-dev + namespace: uni-resolver data: backend_url: https://dev.uniresolver.io/ diff --git a/ci/deploy-k8s-aws/app-specs/deployment-uni-resolver-frontend.yaml b/ci/deploy-k8s-aws/app-specs/deployment-uni-resolver-frontend.yaml index 77f3a884f..f798fb716 100644 --- a/ci/deploy-k8s-aws/app-specs/deployment-uni-resolver-frontend.yaml +++ b/ci/deploy-k8s-aws/app-specs/deployment-uni-resolver-frontend.yaml @@ -2,7 +2,7 @@ apiVersion: apps/v1 kind: Deployment metadata: name: uni-resolver-frontend - namespace: uni-resolver-dev + namespace: uni-resolver labels: app: uni-resolver type: frontend @@ -17,23 +17,23 @@ spec: app: uni-resolver-frontend spec: containers: - - name: uni-resolver-frontend - image: universalresolver/universal-resolver-frontend - imagePullPolicy: Always - ports: - - containerPort: 7081 - env: - - name: BACKEND_URL - valueFrom: - configMapKeyRef: - name: uni-resolver-frontend - key: backend_url + - name: uni-resolver-frontend + image: universalresolver/universal-resolver-frontend + imagePullPolicy: Always + ports: + - containerPort: 7081 + env: + - name: BACKEND_URL + valueFrom: + configMapKeyRef: + name: uni-resolver-frontend + key: backend_url --- apiVersion: v1 kind: Service metadata: name: uni-resolver-frontend - namespace: uni-resolver-dev + namespace: uni-resolver spec: type: NodePort selector: diff --git a/ci/deploy-k8s-aws/app-specs/deployment-uni-resolver-web.yaml b/ci/deploy-k8s-aws/app-specs/deployment-uni-resolver-web.yaml index 8e4d3537d..563657a96 100644 --- a/ci/deploy-k8s-aws/app-specs/deployment-uni-resolver-web.yaml +++ b/ci/deploy-k8s-aws/app-specs/deployment-uni-resolver-web.yaml @@ -2,7 +2,7 @@ apiVersion: apps/v1 kind: Deployment metadata: name: uni-resolver-web - namespace: uni-resolver-dev + namespace: uni-resolver labels: app: uni-resolver type: backend @@ -34,7 +34,7 @@ apiVersion: v1 kind: Service metadata: name: uni-resolver-web - namespace: uni-resolver-dev + namespace: uni-resolver spec: type: NodePort selector: diff --git a/ci/deploy-k8s-aws/namespace/namespace-setup.sh b/ci/deploy-k8s-aws/namespace/namespace-setup.sh index 0d7b5efe1..aa3223c16 100755 --- a/ci/deploy-k8s-aws/namespace/namespace-setup.sh +++ b/ci/deploy-k8s-aws/namespace/namespace-setup.sh @@ -4,6 +4,6 @@ kubectl create -f namespace-setup.yaml CLUSTER_NAME=$(kubectl config view -o=jsonpath='{.clusters[0].name}') USER_NAME=$(kubectl config view -o=jsonpath='{.users[0].name}') -kubectl config set-context uni-resolver-dev --namespace=uni-resolver-dev \ +kubectl config set-context uni-resolver --namespace=uni-resolver \ --cluster="$CLUSTER_NAME" \ --user="$USER_NAME" diff --git a/ci/deploy-k8s-aws/namespace/namespace-setup.yaml b/ci/deploy-k8s-aws/namespace/namespace-setup.yaml index af3dd4bee..8ceb8748e 100644 --- a/ci/deploy-k8s-aws/namespace/namespace-setup.yaml +++ b/ci/deploy-k8s-aws/namespace/namespace-setup.yaml @@ -1,6 +1,6 @@ apiVersion: v1 kind: Namespace metadata: - name: uni-resolver-dev + name: uni-resolver labels: - name: uni-resolver-dev + name: uni-resolver diff --git a/ci/deploy-k8s-aws/scripts/entrypoint.sh b/ci/deploy-k8s-aws/scripts/entrypoint.sh index f38a471c4..040b41155 100755 --- a/ci/deploy-k8s-aws/scripts/entrypoint.sh +++ b/ci/deploy-k8s-aws/scripts/entrypoint.sh @@ -32,4 +32,5 @@ ls -al . echo "### Deploying following Specs ### " cat deploy.sh + ./deploy.sh diff --git a/ci/deploy-k8s-aws/scripts/k8s-template.yaml b/ci/deploy-k8s-aws/scripts/k8s-template.yaml index 34aeb774b..ba8836c61 100644 --- a/ci/deploy-k8s-aws/scripts/k8s-template.yaml +++ b/ci/deploy-k8s-aws/scripts/k8s-template.yaml @@ -2,7 +2,7 @@ apiVersion: apps/v1 kind: Deployment metadata: name: {{containerName}} - namespace: uni-resolver-dev + namespace: uni-resolver labels: app: {{containerName}} spec: @@ -37,7 +37,7 @@ apiVersion: v1 kind: Service metadata: name: {{containerName}} - namespace: uni-resolver-dev + namespace: uni-resolver spec: type: NodePort selector: diff --git a/ci/deploy-k8s-aws/scripts/prepare-deployment.py b/ci/deploy-k8s-aws/scripts/prepare-deployment.py index 83c2ebbd3..f0be4aa3d 100755 --- a/ci/deploy-k8s-aws/scripts/prepare-deployment.py +++ b/ci/deploy-k8s-aws/scripts/prepare-deployment.py @@ -10,8 +10,9 @@ # CONSTANTS you may need to change: DEV_DOMAIN_NAME = 'dev.uniresolver.io' +PROD_DOMAIN_NAME='resolver.identity.foundation' UNIVERSAL_RESOLVER_FRONTEND_TAG = "universalresolver/uni-resolver-frontend:latest;" -NAMESPACE = "uni-resolver-dev" +NAMESPACE = "uni-resolver" def init_deployment_dir(outputdir): @@ -91,7 +92,7 @@ def generate_ingress(containers, outputdir): fout.write('kind: Ingress\n') fout.write('metadata:\n') fout.write(' name: \"uni-resolver-ingress\"\n') - fout.write(' namespace: \"uni-resolver-dev\"\n') + fout.write(' namespace: \"uni-resolver\"\n') fout.write(' annotations:\n') fout.write(' alb.ingress.kubernetes.io/scheme: internet-facing\n') fout.write(' alb.ingress.kubernetes.io/certificate-arn: \"arn:aws:acm:us-east-2:332553390353:certificate/925fce37-d446-4af3-828e-f803b3746af0,arn:aws:acm:us-east-2:332553390353:certificate/59fa30ca-de05-4024-8f80-fea9ab9ab8bf\"\n') @@ -119,6 +120,23 @@ def generate_ingress(containers, outputdir): fout.write(' name: uni-resolver-frontend\n') fout.write(' port:\n') fout.write(' number: 7081\n') + fout.write(' - host: ' + PROD_DOMAIN_NAME + '\n') + fout.write(' http:\n') + fout.write(' paths:\n') + fout.write(' - path: /1.0/*\n') + fout.write(' pathType: ImplementationSpecific\n') + fout.write(' backend:\n') + fout.write(' service:\n') + fout.write(' name: uni-resolver-web\n') + fout.write(' port:\n') + fout.write(' number: 8080\n') + fout.write(' - path: /*\n') + fout.write(' pathType: ImplementationSpecific\n') + fout.write(' backend:\n') + fout.write(' service:\n') + fout.write(' name: uni-resolver-frontend\n') + fout.write(' port:\n') + fout.write(' number: 7081\n') # for container in containers: