From 1e6c0ccf8ecf1ed8fe8af99b4f53da0901a032c4 Mon Sep 17 00:00:00 2001 From: Barrett Falk Date: Tue, 16 Jul 2024 22:34:16 -0700 Subject: [PATCH] feat: Add NATS via Helm pattern (#528) --- .github/workflows/deploy-nats.yml | 62 --------------------- charts/app/Chart.yaml | 3 + charts/app/templates/{knp.yaml => knp.back} | 0 charts/app/values.yaml | 32 ++++++++++- frontend/src/index.tsx | 2 +- 5 files changed, 35 insertions(+), 64 deletions(-) delete mode 100644 .github/workflows/deploy-nats.yml rename charts/app/templates/{knp.yaml => knp.back} (100%) diff --git a/.github/workflows/deploy-nats.yml b/.github/workflows/deploy-nats.yml deleted file mode 100644 index 6f60ce0b5..000000000 --- a/.github/workflows/deploy-nats.yml +++ /dev/null @@ -1,62 +0,0 @@ -name: Deploy NATS to OpenShift - -on: - pull_request: - -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Set up OpenShift CLI - uses: redhat-actions/oc-login@v1 - with: - openshift_server_url: ${{ vars.OC_SERVER }} - openshift_token: ${{ secrets.OC_TOKEN }} - namespace: ${{ vars.OC_NAMESPACE }} - - - name: Add NATS Helm repo - run: helm repo add nats https://nats-io.github.io/k8s/helm/charts/ - - - name: Check if NATS release exists - id: check_release - run: | - RELEASE_NAME=${{ github.event.repository.name }}-${{ github.event.number }}-nats - if helm list -q | grep -q $RELEASE_NAME; then - echo "Release $RELEASE_NAME already exists. Skipping install." - echo "release_exists=true" >> $GITHUB_ENV - else - echo "Release $RELEASE_NAME does not exist. Proceeding with install." - echo "release_exists=false" >> $GITHUB_ENV - fi - - name: Deploy NATS using Helm - if: env.release_exists == 'false' - run: | - helm install ${{ github.event.repository.name }}-${{ github.event.number }}-nats nats/nats \ - --set config.jetstream.enabled=true \ - --set config.jetstream.fileStore.pvc.size=200Mi \ - --set config.jetstream.memoryStore.enabled=true \ - --set config.jetstream.memoryStore.maxSize=250Mi \ - --set cluster.enabled=true \ - --set natsBox.enabled=false \ - --set persistence.enabled=true \ - --set persistence.size=200Mi \ - --set container.merge.resources.requests.cpu=25m \ - --set container.merge.resources.limits.cpu=100m \ - --set container.merge.resources.requests.memory=50Mi \ - --set container.merge.resources.limits.memory=250Mi \ - --set reloader.enabled=false \ - --set replicaCount=1 - - - name: Label NATS Deployment - run: | - RELEASE_NAME=${{ github.event.repository.name }}-${{ github.event.number }}-nats - oc label statefulset $RELEASE_NAME app=${{ github.event.repository.name }}-${{ github.event.number }} - - name: Label NATS PVCs - run: | - RELEASE_NAME=${{ github.event.repository.name }}-${{ github.event.number }}-nats - for pvc in $(oc get pvc -l release=$RELEASE_NAME -o name); do - oc label $pvc app=${{ github.event.repository.name }}-${{ github.event.number }} - done diff --git a/charts/app/Chart.yaml b/charts/app/Chart.yaml index 8662d4109..23173d974 100644 --- a/charts/app/Chart.yaml +++ b/charts/app/Chart.yaml @@ -30,6 +30,9 @@ dependencies: version: 15.5.13 repository: https://charts.bitnami.com/bitnami alias: bitnami-pg + - name: nats + version: 1.1.12 + repository: "https://nats-io.github.io/k8s/helm/charts/" maintainers: - name: Om Mishra email: omprakash.2.mishra@gov.bc.ca diff --git a/charts/app/templates/knp.yaml b/charts/app/templates/knp.back similarity index 100% rename from charts/app/templates/knp.yaml rename to charts/app/templates/knp.back diff --git a/charts/app/values.yaml b/charts/app/values.yaml index 94ef7f62f..9d753a679 100644 --- a/charts/app/values.yaml +++ b/charts/app/values.yaml @@ -352,7 +352,37 @@ backup: cpu: 20m memory: 128Mi -#-- the components of the application, backend. +# Deploys JetStream +nats: + enabled: true + config: + replicaCount: 1 + resources: + requests: + cpu: 100m + memory: 100Mi + limits: + cpu: 200m + memory: 400Mi + jetstream: + enabled: true + fileStore: + pvc: + size: 200Mi + memoryStore: + enabled: true + maxSize: 250Mi + cluster: + enabled: true + natsBox: + enabled: false + persistence: + enabled: true + size: 200Mi + reloader: + enabled: false + +#-- WebEOC Container webeoc: #-- enable or disable backend enabled: true diff --git a/frontend/src/index.tsx b/frontend/src/index.tsx index c0299cec5..3bfd26148 100644 --- a/frontend/src/index.tsx +++ b/frontend/src/index.tsx @@ -35,5 +35,5 @@ UserService.initKeycloak(onAuthenticatedCallback); // If you want to start measuring performance in your app, pass a function // to log results (for example: reportWebVitals(console.log)) -// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals +// OR send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals reportWebVitals();