From 30108e758ea216133cd35bc294b5218f56d393e4 Mon Sep 17 00:00:00 2001 From: Satya Muntha <110593455+cfuisat@users.noreply.github.com> Date: Mon, 28 Aug 2023 17:05:50 +0200 Subject: [PATCH] Develop to main (#94) * chore: ui v2 * chore: env vars and latest ui * chore: added summit 2023 resources * chore: summit-2023 * chore: new ui version 0.2.6-PR89 * chore: 0.2.6-PR86 * chore: updated env var name * chore: 0.2.6-PR86-preprod * chore: test CORS * chore: restored proper CORS rule * chore: 0.2.7 * chore: 0.2.7-PR92-preprod --------- Co-authored-by: Giovanni Gargiulo --- ...reprod.sh => init-cip-1694-dev-preprod.sh} | 2 +- .../init-summit-2023-dev-preprod.sh | 74 +++++++++++++++++++ .../templates/00-main-app.yaml | 2 +- ....yaml => values-cip-1694-dev-preprod.yaml} | 2 + .../values-summit-2023-dev-preprod.yaml | 7 ++ deploy/argocd-bootstrap/values.yaml | 2 + .../templates/deployment.yaml | 18 ++--- deploy/main-app/values-dev-preprod.yaml | 2 +- deploy/summit-2023-main-app/Chart.yaml | 3 + deploy/summit-2023-main-app/README.md | 1 + .../templates/001-prometheus-stack.yaml | 29 ++++++++ .../templates/002-grafana-dashboards.yaml | 26 +++++++ .../100-cf-cardano-ballot-infra.yaml | 40 ++++++++++ .../templates/101-cf-cardano-ballot-ui.yaml | 36 +++++++++ .../102-cf-cardano-ballot-voting-api.yaml | 36 +++++++++ ...03-cf-cardano-ballot-verification-api.yaml | 36 +++++++++ ...cf-cardano-ballot-ledger-follower-api.yaml | 36 +++++++++ .../values-dev-preprod.yaml | 40 ++++++++++ deploy/summit-2023-main-app/values.yaml | 43 +++++++++++ 19 files changed, 420 insertions(+), 15 deletions(-) rename deploy/argocd-bootstrap/{init-dev-preprod.sh => init-cip-1694-dev-preprod.sh} (98%) create mode 100755 deploy/argocd-bootstrap/init-summit-2023-dev-preprod.sh rename deploy/argocd-bootstrap/{values-dev-preprod.yaml => values-cip-1694-dev-preprod.yaml} (79%) create mode 100644 deploy/argocd-bootstrap/values-summit-2023-dev-preprod.yaml create mode 100644 deploy/summit-2023-main-app/Chart.yaml create mode 100644 deploy/summit-2023-main-app/README.md create mode 100644 deploy/summit-2023-main-app/templates/001-prometheus-stack.yaml create mode 100644 deploy/summit-2023-main-app/templates/002-grafana-dashboards.yaml create mode 100644 deploy/summit-2023-main-app/templates/100-cf-cardano-ballot-infra.yaml create mode 100644 deploy/summit-2023-main-app/templates/101-cf-cardano-ballot-ui.yaml create mode 100644 deploy/summit-2023-main-app/templates/102-cf-cardano-ballot-voting-api.yaml create mode 100644 deploy/summit-2023-main-app/templates/103-cf-cardano-ballot-verification-api.yaml create mode 100644 deploy/summit-2023-main-app/templates/104-cf-cardano-ballot-ledger-follower-api.yaml create mode 100644 deploy/summit-2023-main-app/values-dev-preprod.yaml create mode 100644 deploy/summit-2023-main-app/values.yaml diff --git a/deploy/argocd-bootstrap/init-dev-preprod.sh b/deploy/argocd-bootstrap/init-cip-1694-dev-preprod.sh similarity index 98% rename from deploy/argocd-bootstrap/init-dev-preprod.sh rename to deploy/argocd-bootstrap/init-cip-1694-dev-preprod.sh index 38e02c036..677f984a6 100755 --- a/deploy/argocd-bootstrap/init-dev-preprod.sh +++ b/deploy/argocd-bootstrap/init-cip-1694-dev-preprod.sh @@ -71,4 +71,4 @@ helm upgrade --install argocd -n argocd . \ --set git.targetRevision=develop \ --set valueFile=values-dev-preprod.yaml \ -f values-secrets.yaml \ - -f values-dev-preprod.yaml + -f values-cip-1694-dev-preprod.yaml diff --git a/deploy/argocd-bootstrap/init-summit-2023-dev-preprod.sh b/deploy/argocd-bootstrap/init-summit-2023-dev-preprod.sh new file mode 100755 index 000000000..5494126dc --- /dev/null +++ b/deploy/argocd-bootstrap/init-summit-2023-dev-preprod.sh @@ -0,0 +1,74 @@ +#!/usr/bin/env bash + +set +x + +echo "Checking argocd namespace existence" +kubectl get ns argocd > /dev/null 2>&1 + +if [ $? != 0 ]; then + echo "argocd namespace does not exist, creating..." + kubectl create ns argocd > /dev/null 2>&1 +fi + +echo "Checking cf-summit-2023 namespace existence" +kubectl get ns cf-summit-2023 > /dev/null 2>&1 + +if [ $? != 0 ]; then + echo "cf-summit-2023 namespace does not exist, creating..." + kubectl create ns cf-summit-2023 > /dev/null 2>&1 +fi + + +## Blockfrost secrets +kubectl create secret -n cf-summit-2023 generic blockfrost-secrets \ + --from-env-file=../../.keys/blockfrost-secrets \ + --save-config \ + --dry-run=client \ + -o yaml \ + | kubectl apply -f - + +## Submit API secrets +kubectl create secret -n cf-summit-2023 generic submit-api-secrets \ + --from-env-file=../../.keys/submit-api-secrets \ + --save-config \ + --dry-run=client \ + -o yaml \ + | kubectl apply -f - + +## Wallet Mnemonic secrets +kubectl create secret -n cf-summit-2023 generic wallet-secrets \ + --from-env-file=../../.keys/wallet-secrets \ + --save-config \ + --dry-run=client \ + -o yaml \ + | kubectl apply -f - + +## DockerHub secret +kubectl create secret -n cf-summit-2023 generic regcred \ + --from-file=.dockerconfigjson=../../.keys/docker-cred.json \ + --type=kubernetes.io/dockerconfigjson \ + --save-config \ + --dry-run=client \ + -o yaml \ + | kubectl apply -f - + +## Git Hub deploy key +kubectl create secret generic github-deploy-key \ + --save-config \ + --dry-run=client \ + -o yaml \ + -n argocd \ + --from-file=../../.keys/cf-cardano-ballot \ + | kubectl apply -f - + +#echo "Fetching helm dependencies for main app" +helm dependency build + +echo "Updating helm dependencies for main app" +helm dependency update + +helm upgrade --install argocd -n argocd . \ + --set git.targetRevision=develop \ + --set valueFile=values-dev-preprod.yaml \ + -f values-secrets.yaml \ + -f values-summit-2023-dev-preprod.yaml diff --git a/deploy/argocd-bootstrap/templates/00-main-app.yaml b/deploy/argocd-bootstrap/templates/00-main-app.yaml index 23ef26fa0..639cb0844 100644 --- a/deploy/argocd-bootstrap/templates/00-main-app.yaml +++ b/deploy/argocd-bootstrap/templates/00-main-app.yaml @@ -11,7 +11,7 @@ spec: source: repoURL: git@github.com:cardano-foundation/cf-cardano-ballot.git targetRevision: {{ .Values.git.targetRevision | default "HEAD" }} - path: deploy/main-app + path: {{ .Values.mainAppPath }} helm: parameters: - name: "git.targetRevision" diff --git a/deploy/argocd-bootstrap/values-dev-preprod.yaml b/deploy/argocd-bootstrap/values-cip-1694-dev-preprod.yaml similarity index 79% rename from deploy/argocd-bootstrap/values-dev-preprod.yaml rename to deploy/argocd-bootstrap/values-cip-1694-dev-preprod.yaml index 70ac84d90..8c8296774 100644 --- a/deploy/argocd-bootstrap/values-dev-preprod.yaml +++ b/deploy/argocd-bootstrap/values-cip-1694-dev-preprod.yaml @@ -1,3 +1,5 @@ +mainAppPath: "deploy/main-app" + argo-cd: server: ingress: diff --git a/deploy/argocd-bootstrap/values-summit-2023-dev-preprod.yaml b/deploy/argocd-bootstrap/values-summit-2023-dev-preprod.yaml new file mode 100644 index 000000000..857884571 --- /dev/null +++ b/deploy/argocd-bootstrap/values-summit-2023-dev-preprod.yaml @@ -0,0 +1,7 @@ +mainAppPath: "deploy/summit-2023-main-app" + +argo-cd: + server: + ingress: + hosts: + - argocd.dev.cf-summit-2023-preprod.eu-west-1.metadata.dev.cf-deployments.org \ No newline at end of file diff --git a/deploy/argocd-bootstrap/values.yaml b/deploy/argocd-bootstrap/values.yaml index 5b6922336..dfb54773c 100644 --- a/deploy/argocd-bootstrap/values.yaml +++ b/deploy/argocd-bootstrap/values.yaml @@ -3,6 +3,8 @@ git: # The target branch to point to. This can be set to a branch during chart development phase. Defaults to main targetRevision: null +mainAppPath: "" + # ArgoCD parameters argo-cd: enabled: true diff --git a/deploy/cf-cardano-ballot-ui/templates/deployment.yaml b/deploy/cf-cardano-ballot-ui/templates/deployment.yaml index 74560e19e..5057bf9b6 100644 --- a/deploy/cf-cardano-ballot-ui/templates/deployment.yaml +++ b/deploy/cf-cardano-ballot-ui/templates/deployment.yaml @@ -23,18 +23,12 @@ spec: image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} env: - - name: REACT_APP_VERSION - value: 0.0.1 - - name: REACT_APP_SERVER_URL - value: https://dev.cf-cip1694-preprod.eu-west-1.metadata.dev.cf-deployments.org/ - - name: REACT_APP_TARGET_NETWORK - value: PREPROD - - name: REACT_APP_EVENT_ID - value: CIP-1694_Pre_Ratification_4619 - - name: REACT_APP_CATEGORY_ID - value: CIP-1694_Pre_Ratification_4619 - - name: REACT_APP_SUPPORTED_WALLETS - value: flint,eternl,nami,typhon,yoroi,nufi,gerowallet,lace + - name: REACT_APP_VOTING_APP_SERVER_URL + value: https://api.dev.cf-cip1694-preprod.eu-west-1.metadata.dev.cf-deployments.org/ + - name: REACT_APP_VOTING_LEDGER_FOLLOWER_APP_SERVER_URL + value: https://follower-api.dev.cf-cip1694-preprod.eu-west-1.metadata.dev.cf-deployments.org/ + - name: REACT_APP_VOTING_VERIFICATION_APP_SERVER_URL + value: https://verification-api.dev.cf-cip1694-preprod.eu-west-1.metadata.dev.cf-deployments.org/ ports: - name: http containerPort: {{ .Values.service.port }} diff --git a/deploy/main-app/values-dev-preprod.yaml b/deploy/main-app/values-dev-preprod.yaml index c29e2b906..2ee1689fa 100644 --- a/deploy/main-app/values-dev-preprod.yaml +++ b/deploy/main-app/values-dev-preprod.yaml @@ -11,7 +11,7 @@ cf-cardano-ballot-ui: enabled: true values: image: - tag: 0.0.1-1 + tag: 0.2.7-PR92-preprod cf-cardano-ballot-voting-api: enabled: true diff --git a/deploy/summit-2023-main-app/Chart.yaml b/deploy/summit-2023-main-app/Chart.yaml new file mode 100644 index 000000000..6e144100b --- /dev/null +++ b/deploy/summit-2023-main-app/Chart.yaml @@ -0,0 +1,3 @@ +apiVersion: v2 +name: cf-summit-2023-main-app +version: 0.0.1 diff --git a/deploy/summit-2023-main-app/README.md b/deploy/summit-2023-main-app/README.md new file mode 100644 index 000000000..2f698474e --- /dev/null +++ b/deploy/summit-2023-main-app/README.md @@ -0,0 +1 @@ +# Voting App Main App diff --git a/deploy/summit-2023-main-app/templates/001-prometheus-stack.yaml b/deploy/summit-2023-main-app/templates/001-prometheus-stack.yaml new file mode 100644 index 000000000..45fe64948 --- /dev/null +++ b/deploy/summit-2023-main-app/templates/001-prometheus-stack.yaml @@ -0,0 +1,29 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: prometheus-stack + namespace: argocd + finalizers: + - resources-finalizer.argocd.argoproj.io +spec: + project: default + source: + repoURL: https://prometheus-community.github.io/helm-charts + targetRevision: 45.7.1 + chart: kube-prometheus-stack + helm: + parameters: + - name: "grafana.ingress.enabled" + value: "true" + - name: "grafana.ingress.hosts[0]" + value: grafana.{{ $.Values.domain }} + syncPolicy: + automated: + prune: true + syncOptions: + - CreateNamespace=true + - ServerSideApply=true + + destination: + namespace: observe + server: {{ .Values.spec.destination.server }} diff --git a/deploy/summit-2023-main-app/templates/002-grafana-dashboards.yaml b/deploy/summit-2023-main-app/templates/002-grafana-dashboards.yaml new file mode 100644 index 000000000..46241e33f --- /dev/null +++ b/deploy/summit-2023-main-app/templates/002-grafana-dashboards.yaml @@ -0,0 +1,26 @@ +#{{ if index .Values "grafana-dashboards" "enabled" }} +#--- +#apiVersion: argoproj.io/v1alpha1 +#kind: Application +#metadata: +# name: grafana-dashboards +# namespace: argocd +# finalizers: +# - resources-finalizer.argocd.argoproj.io +#spec: +# project: default +# source: +# repoURL: git@github.com:cardano-foundation/cf-explorer.git +# targetRevision: {{ .Values.git.targetRevision | default "HEAD" }} +# path: charts/grafana-dashboards +# +# syncPolicy: +# automated: +# prune: true +# syncOptions: +# - CreateNamespace=true +# +# destination: +# namespace: observe +# server: {{ .Values.spec.destination.server }} +#{{ end }} diff --git a/deploy/summit-2023-main-app/templates/100-cf-cardano-ballot-infra.yaml b/deploy/summit-2023-main-app/templates/100-cf-cardano-ballot-infra.yaml new file mode 100644 index 000000000..e44b4df00 --- /dev/null +++ b/deploy/summit-2023-main-app/templates/100-cf-cardano-ballot-infra.yaml @@ -0,0 +1,40 @@ +{{ if index .Values "cf-cardano-ballot-infra" "enabled" }} +--- +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: cf-cardano-ballot-infra + namespace: argocd + finalizers: + - resources-finalizer.argocd.argoproj.io + annotations: + argocd.argoproj.io/sync-wave: "-1" +spec: + project: default + source: + repoURL: git@github.com:cardano-foundation/cf-cardano-ballot.git + targetRevision: {{ .Values.git.targetRevision | default "HEAD" }} + path: deploy/cf-cardano-ballot-infra + helm: + {{- with index .Values "cf-cardano-ballot-infra" }} + values: | +{{ toYaml . | indent 8 }} + {{- end }} + + ignoreDifferences: + - group: "*" + kind: "Secret" + jqPathExpressions: + - '.data' + + syncPolicy: + automated: + prune: true + syncOptions: + - CreateNamespace=true + - RespectIgnoreDifferences=true + + destination: + namespace: cf-cardano-ballot + server: {{ .Values.spec.destination.server }} +{{ end }} diff --git a/deploy/summit-2023-main-app/templates/101-cf-cardano-ballot-ui.yaml b/deploy/summit-2023-main-app/templates/101-cf-cardano-ballot-ui.yaml new file mode 100644 index 000000000..aab6ced57 --- /dev/null +++ b/deploy/summit-2023-main-app/templates/101-cf-cardano-ballot-ui.yaml @@ -0,0 +1,36 @@ +{{ if index .Values "cf-cardano-ballot-ui" "enabled" }} +--- +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: cf-cardano-ballot-ui + namespace: argocd + finalizers: + - resources-finalizer.argocd.argoproj.io +spec: + project: default + source: + repoURL: git@github.com:cardano-foundation/cf-cardano-ballot.git + targetRevision: {{ .Values.git.targetRevision | default "HEAD" }} + path: deploy/cf-cardano-ballot-ui + helm: + parameters: + - name: "domain" + value: {{ .Values.domain }} + - name: "network" + value: {{ .Values.network }} + {{- with index .Values "cf-cardano-ballot-ui" "values" }} + values: | +{{ toYaml . | indent 8 }} + {{- end }} + + syncPolicy: + automated: + prune: true + syncOptions: + - CreateNamespace=true + + destination: + namespace: cf-cardano-ballot + server: {{ .Values.spec.destination.server }} +{{ end }} diff --git a/deploy/summit-2023-main-app/templates/102-cf-cardano-ballot-voting-api.yaml b/deploy/summit-2023-main-app/templates/102-cf-cardano-ballot-voting-api.yaml new file mode 100644 index 000000000..350db29ef --- /dev/null +++ b/deploy/summit-2023-main-app/templates/102-cf-cardano-ballot-voting-api.yaml @@ -0,0 +1,36 @@ +{{ if index .Values "cf-cardano-ballot-voting-api" "enabled" }} +--- +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: cf-cardano-ballot-voting-api + namespace: argocd + finalizers: + - resources-finalizer.argocd.argoproj.io +spec: + project: default + source: + repoURL: git@github.com:cardano-foundation/cf-cardano-ballot.git + targetRevision: {{ .Values.git.targetRevision | default "HEAD" }} + path: deploy/cf-cardano-ballot-voting-api + helm: + parameters: + - name: "domain" + value: {{ .Values.domain }} + - name: "network" + value: {{ .Values.network }} + {{- with index .Values "cf-cardano-ballot-voting-api" "values" }} + values: | +{{ toYaml . | indent 8 }} + {{- end }} + + syncPolicy: + automated: + prune: true + syncOptions: + - CreateNamespace=true + + destination: + namespace: cf-cardano-ballot + server: {{ .Values.spec.destination.server }} +{{ end }} diff --git a/deploy/summit-2023-main-app/templates/103-cf-cardano-ballot-verification-api.yaml b/deploy/summit-2023-main-app/templates/103-cf-cardano-ballot-verification-api.yaml new file mode 100644 index 000000000..2712e1714 --- /dev/null +++ b/deploy/summit-2023-main-app/templates/103-cf-cardano-ballot-verification-api.yaml @@ -0,0 +1,36 @@ +{{ if index .Values "cf-cardano-ballot-verification-api" "enabled" }} +--- +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: cf-cardano-ballot-verification-api + namespace: argocd + finalizers: + - resources-finalizer.argocd.argoproj.io +spec: + project: default + source: + repoURL: git@github.com:cardano-foundation/cf-cardano-ballot.git + targetRevision: {{ .Values.git.targetRevision | default "HEAD" }} + path: deploy/cf-cardano-ballot-verification-api + helm: + parameters: + - name: "domain" + value: {{ .Values.domain }} + - name: "network" + value: {{ .Values.network }} + {{- with index .Values "cf-cardano-ballot-verification-api" "values" }} + values: | +{{ toYaml . | indent 8 }} + {{- end }} + + syncPolicy: + automated: + prune: true + syncOptions: + - CreateNamespace=true + + destination: + namespace: cf-cardano-ballot + server: {{ .Values.spec.destination.server }} +{{ end }} diff --git a/deploy/summit-2023-main-app/templates/104-cf-cardano-ballot-ledger-follower-api.yaml b/deploy/summit-2023-main-app/templates/104-cf-cardano-ballot-ledger-follower-api.yaml new file mode 100644 index 000000000..92eae87fc --- /dev/null +++ b/deploy/summit-2023-main-app/templates/104-cf-cardano-ballot-ledger-follower-api.yaml @@ -0,0 +1,36 @@ +{{ if index .Values "cf-cardano-ballot-ledger-follower-api" "enabled" }} +--- +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: cf-cardano-ballot-ledger-follower-api + namespace: argocd + finalizers: + - resources-finalizer.argocd.argoproj.io +spec: + project: default + source: + repoURL: git@github.com:cardano-foundation/cf-cardano-ballot.git + targetRevision: {{ .Values.git.targetRevision | default "HEAD" }} + path: deploy/cf-cardano-ballot-ledger-follower-api + helm: + parameters: + - name: "domain" + value: {{ .Values.domain }} + - name: "network" + value: {{ .Values.network }} + {{- with index .Values "cf-cardano-ballot-ledger-follower-api" "values" }} + values: | +{{ toYaml . | indent 8 }} + {{- end }} + + syncPolicy: + automated: + prune: true + syncOptions: + - CreateNamespace=true + + destination: + namespace: cf-cardano-ballot + server: {{ .Values.spec.destination.server }} +{{ end }} diff --git a/deploy/summit-2023-main-app/values-dev-preprod.yaml b/deploy/summit-2023-main-app/values-dev-preprod.yaml new file mode 100644 index 000000000..b939bbe73 --- /dev/null +++ b/deploy/summit-2023-main-app/values-dev-preprod.yaml @@ -0,0 +1,40 @@ +stage: dev + +network: preprod + +domain: dev.cf-summit-2023-preprod.eu-west-1.metadata.dev.cf-deployments.org + +cf-cardano-ballot-infra: + enabled: true + +cf-cardano-ballot-ui: + enabled: false + values: + image: + tag: 0.0.1-2 + +cf-cardano-ballot-voting-api: + enabled: true + values: + instances: + - name: passive + active: "false" + replicas: 2 + - name: active-hour + active: "true" + voteCommitmentCronExpression: "0 0/30 * * * *" + image: + tag: 0.2.6-PR79 + +cf-cardano-ballot-verification-api: + enabled: true + values: + image: + tag: 0.2.6-PR79 + +cf-cardano-ballot-ledger-follower-api: + enabled: true + values: + image: + tag: 0.2.6-PR79 + diff --git a/deploy/summit-2023-main-app/values.yaml b/deploy/summit-2023-main-app/values.yaml new file mode 100644 index 000000000..f8079681b --- /dev/null +++ b/deploy/summit-2023-main-app/values.yaml @@ -0,0 +1,43 @@ +git: + targetRevision: null + +# stage: one of [dev, uat, prod] +stage: null + +# network: one of [mainnet, preprod, preview] +network: null + +# domain: something like "grafana.dev.ggargiulo-clusters.eu-west-1.metadata.dev.cf-deployments.org" +domain: null + +# Infra Parameters +cf-cardano-ballot-infra: + # Whether Infra resources should be deployed. + enabled: true + +# Ballot UI Parameters +cf-cardano-ballot-ui: + # Whether Resources should be deployed. + enabled: true + +# Ballot API Parameters +cf-cardano-ballot-voting-api: + # Whether Resources should be deployed. + enabled: true + +# Ballot Verification API Parameters +cf-cardano-ballot-verification-api: + # Whether Resources should be deployed. + enabled: true + +# Ballot Ledger Follower API Parameters +cf-cardano-ballot-ledger-follower-api: + # Whether Resources should be deployed. + enabled: true + +grafana-dashboards: + enabled: true + +spec: + destination: + server: https://kubernetes.default.svc