diff --git a/.env-example b/.env-example
index 4d12da16..31efb27b 100644
--- a/.env-example
+++ b/.env-example
@@ -1 +1,16 @@
-CONFIG_PASSPHRASE=
\ No newline at end of file
+BUNDLER_CONFIG_PASSPHRASE=
+BUNDLER_NODE_PATH_INDEX=0
+BUNDLER_CHAIN_ID=80001
+BUNDLER_MIN_RELAYER_COUNT=5
+BUNDLER_MAX_RELAYER_COUNT=10
+BUNDLER_FUNDING_BALANCE_THRESHOLD=0.1
+BUNDLER_FUNDING_RELAYER_AMOUNT=0.2
+BUNDLER_SIMULATION_DATA_JSON='{"tenderlyData": {}}'
+BUNDLER_TOKEN_PRICE_JSON='{"coinMarketCapApi": ""}'
+BUNDLER_SLACK_JSON='{"token": "","channel": ""}'
+BUNDLER_PROVIDER_JSON='{"137": "", "42161": "", "56": "", "10": "", "43114": "", "8453": "", "80001": ""}'
+BUNDLER_DATASOURCES_JSON= '{"mongoUrl": "", "redisUrl": ""}'
+BUNDLER_SOCKET_SERVICE_JSON='{"wssUrl": "","httpUrl": "","token": "","apiKey": ""}'
+BUNDLER_QUEUE_URL=""
+BUNDLER_IS_TRUSTWALLET_SETUP=true
+BUNDLER_FALLBACK_PROVIDER_JSON='{"137": ["", ""], "42161": ["", ""], "56": ["", ""], "10": ["", ""], "43114": ["", ""], "8453": ["", ""], "80001": ["", ""]}'
\ No newline at end of file
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index c1773ebb..233e4bf3 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -11,7 +11,7 @@ jobs:
steps:
- name: Checkout Repository
- uses: actions/checkout@v2
+ uses: actions/checkout@v4
- name: Check if Master is Ahead of Staging
run: |
diff --git a/.github/workflows/merge_on_master_tw.yaml b/.github/workflows/merge_on_master_tw.yaml
new file mode 100644
index 00000000..4c2ea8c8
--- /dev/null
+++ b/.github/workflows/merge_on_master_tw.yaml
@@ -0,0 +1,66 @@
+# This workflow will do a clean installation of node dependencies, build the
+# source code and run tests across different versions of node
+# For more information see:
+# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
+
+name: Main_or_Master
+on:
+# The trigger event is for every pull request. If we would trigger when we push
+# to any branch and on pull request we would have double workflow runs and will
+# consume more minutes. I chose to trigger the workflow run on pull requests only.
+ push:
+ branches:
+ - 'dedicated-bundler-setup_new'
+
+jobs:
+ js_build_test:
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ node-version: [21.x]
+ # node-version: [14.x, 16.x, 18.x, 20.x]
+ # See supported Node.js release schedule at
+ # https://nodejs.org/en/about/releases/
+ steps:
+ - name: checkout repo
+ uses: actions/checkout@v4
+ - name: Use Node.js ${{ matrix.node-version }}
+ uses: actions/setup-node@v4
+ with:
+ node-version: ${{ matrix.node-version }}
+ - name: Yarn install, build and test
+ run: echo "In the steps below we will build and run first set of tests for all components"
+ - run: echo yarn install
+ - run: echo yarn lint
+ - run: echo yarn build
+ - run: echo yarn test
+
+ container_img_build_push_gar:
+ needs: [js_build_test]
+ # Allow the job to fetch a GitHub ID token
+ permissions:
+ id-token: write
+ contents: read
+ # The plan is to build and push each docker image in parallel.
+ strategy:
+ matrix:
+ image:
+ - us-docker.pkg.dev/biconomy-prod/bundler/trustwallet
+ - us-docker.pkg.dev/prj-biconomy-prod-001/bundler/bundler
+ # LOCATION-docker.pkg.dev/PROJECT-ID/REPOSITORY/IMAGE
+ # {owner}/{repo}/.github/workflows/{filename}@{ref}
+ uses: bcnmy/devops/.github/workflows/container_img_build_push_gar.yaml@master
+ with:
+ image: ${{ matrix.image }}
+ dockerfile: Dockerfile.helm
+ # GCP project where the identity provider is
+ # gcloud projects describe prj-workload-identity-001
+ gcp_project_number: '766873424314'
+ gcp_pool_id: 'pool-id-github-actions'
+ # gcp_provider_id: 'ga-GITHUB_REPO_NAME'
+ gcp_provider_id: 'ga-bundler'
+ # LOCATION-docker.pkg.dev/PROJECT-ID/REPOSITORY/IMAGE
+ gcp_registry: 'us-docker.pkg.dev/biconomy-prod/bundler/trustwallet'
+ gcp_service_account: 'sa-bundler@prj-workload-identity-001.iam.gserviceaccount.com'
+
+ # TODO: Add integrations tests here
diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml
new file mode 100644
index 00000000..0b42d307
--- /dev/null
+++ b/.github/workflows/pr.yaml
@@ -0,0 +1,64 @@
+---
+# This workflow will do a clean installation of node dependencies, build the
+# source code and run tests across different versions of node
+# For more information see:
+# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
+
+# yamllint disable rule:line-length
+name: PR
+on:
+ pull_request:
+ branches:
+ - '*'
+
+jobs:
+ js_build_test:
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ node-version: [21.x]
+ # node-version: [14.x, 16.x, 18.x, 20.x]
+ # See supported Node.js release schedule at
+ # https://nodejs.org/en/about/releases/
+ steps:
+ - name: checkout repo
+ uses: actions/checkout@v4
+ - name: Use Node.js ${{ matrix.node-version }}
+ uses: actions/setup-node@v4
+ with:
+ node-version: ${{ matrix.node-version }}
+ - name: Yarn install, build and test
+ run: echo "In the steps below we will build and run first set of tests for all components"
+ - run: echo yarn install
+ - run: echo yarn lint
+ - run: echo yarn build
+ - run: echo yarn test
+
+ container_img_build_push_gar:
+ needs: [js_build_test]
+ # Allow the job to fetch a GitHub ID token
+ permissions:
+ id-token: write
+ contents: read
+ # The plan is to build and push each docker image in parallel.
+ strategy:
+ matrix:
+ image:
+ - us-docker.pkg.dev/biconomy-prod/bundler/trustwallet
+ - us-docker.pkg.dev/prj-biconomy-prod-001/bundler/bundler
+ # LOCATION-docker.pkg.dev/PROJECT-ID/REPOSITORY/IMAGE
+ # {owner}/{repo}/.github/workflows/{filename}@{ref}
+ uses: bcnmy/devops/.github/workflows/container_img_build_push_gar.yaml@master
+ with:
+ image: ${{ matrix.image }}
+ dockerfile: Dockerfile.helm
+ # GCP project where the identity provider is
+ # gcloud projects describe prj-workload-identity-001
+ gcp_project_number: '766873424314'
+ gcp_pool_id: 'pool-id-github-actions'
+ # gcp_provider_id: 'ga-GITHUB_REPO_NAME'
+ gcp_provider_id: 'ga-bundler'
+ # LOCATION-docker.pkg.dev/PROJECT-ID/REPOSITORY/IMAGE
+ gcp_registry: 'us-docker.pkg.dev/biconomy-prod/bundler/trustwallet'
+ gcp_service_account: 'sa-bundler@prj-workload-identity-001.iam.gserviceaccount.com'
+ #
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
new file mode 100644
index 00000000..a5e22216
--- /dev/null
+++ b/.github/workflows/release.yaml
@@ -0,0 +1,125 @@
+---
+# This workflow will build a docker image and deploy it to trustwallet stating \
+# and production environments
+
+# yamllint disable rule:line-length
+name: Version_Release
+on:
+ push:
+ tags:
+ - v0.**
+jobs:
+ js_build_test:
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ node-version: [21.x]
+ # node-version: [14.x, 16.x, 18.x, 20.x]
+ # See supported Node.js release schedule at
+ # https://nodejs.org/en/about/releases/
+ steps:
+ - name: checkout repo
+ uses: actions/checkout@v4
+ - name: Use Node.js ${{ matrix.node-version }}
+ uses: actions/setup-node@v4
+ with:
+ node-version: ${{ matrix.node-version }}
+ - name: Yarn install, build and test
+ run: echo "In the steps below we will build and run first set of tests for all components"
+ - run: echo yarn install
+ - run: echo yarn lint
+ - run: echo yarn build
+ - run: echo yarn test
+ - name: Dump GitHub context
+ env:
+ GITHUB_CONTEXT: ${{ toJson(github) }}
+ run: echo "$GITHUB_CONTEXT"
+ - name: Dump GITHUB_REF
+ run: echo "${GITHUB_REF}"
+
+ container_img_build_push_gar:
+ needs: [js_build_test]
+ # Allow the job to fetch a GitHub ID token
+ permissions:
+ id-token: write
+ contents: read
+ # The plan is to build and push each docker image in parallel.
+ strategy:
+ matrix:
+ image:
+ - us-docker.pkg.dev/biconomy-prod/bundler/trustwallet
+ - us-docker.pkg.dev/prj-biconomy-prod-001/bundler/bundler
+ # LOCATION-docker.pkg.dev/PROJECT-ID/REPOSITORY/IMAGE
+ # {owner}/{repo}/.github/workflows/{filename}@{ref}
+ uses: bcnmy/devops/.github/workflows/container_img_build_push_gar.yaml@master
+ with:
+ image: ${{ matrix.image }}
+ dockerfile: Dockerfile.helm
+ # GCP project where the identity provider is
+ # gcloud projects describe prj-workload-identity-001
+ gcp_project_number: '766873424314'
+ gcp_pool_id: 'pool-id-github-actions'
+ # gcp_provider_id: 'ga-GITHUB_REPO_NAME'
+ gcp_provider_id: 'ga-bundler'
+ # LOCATION-docker.pkg.dev/PROJECT-ID/REPOSITORY/IMAGE
+ gcp_registry: 'us-docker.pkg.dev/biconomy-prod/bundler/trustwallet'
+ gcp_service_account: 'sa-bundler@prj-workload-identity-001.iam.gserviceaccount.com'
+
+ deploy_tw_staging:
+ needs: [container_img_build_push_gar]
+ # Allow the job to fetch a GitHub ID token
+ # runs-on: ubuntu-latest
+ permissions:
+ id-token: write
+ contents: read
+ uses: bcnmy/devops/.github/workflows/deploy_to_gke.yaml@master
+ with:
+ # GCP project where the identity provider is
+ # gcloud projects describe prj-workload-identity-001
+ gcp_project_number: '766873424314'
+ gcp_project_id: 'biconomy-prod'
+ gcp_bastion: 'bastion02'
+ gcp_bastion_zone: 'us-east1-b'
+ gcp_pool_id: 'pool-id-github-actions'
+ # created by devops/gcp/github-actions/configure_workload_identity_federation_with_github_actions_pipelines.sh
+ # gcp_provider_id: 'ga-GITHUB_REPO_NAME'
+ gcp_provider_id: 'ga-bundler'
+ # SERVICE_ACCOUNT_EMAIL="${SERVICE_ACCOUNT}@${PROJECT}.iam.gserviceaccount.com"
+ gcp_service_account: 'sa-bundler@prj-workload-identity-001.iam.gserviceaccount.com'
+ gcp_cluster_name: 'dedicated-bundler'
+ gcp_cluster_location: 'us-east1'
+ use_internal_ip: true
+ # https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
+ # deploy_command: 'helm ls --all-namespaces'
+ # deploy_command: 'echo IMG_VERSION is ${GITHUB_REF:10}' # for example extracts v0.0.5 from "refs/tags/v0.0.5"
+ deploy_command: './install-bundler/bundler-update-release.sh bundler-tw-staging.cfg ${GITHUB_REF:10}'
+
+ deploy_tw_prod:
+ needs: [deploy_tw_staging]
+ # environment: tw-prod
+ # Allow the job to fetch a GitHub ID token
+ # runs-on: ubuntu-latest
+ permissions:
+ id-token: write
+ contents: read
+ uses: bcnmy/devops/.github/workflows/deploy_to_gke.yaml@master
+ with:
+ environment: 'tw-prod'
+ # GCP project where the identity provider is
+ # gcloud projects describe prj-workload-identity-001
+ gcp_project_number: '766873424314'
+ # GCP project ID where the workload will be deployed
+ gcp_project_id: 'prj-biconomy-prod-001'
+ gcp_bastion: 'bastion02'
+ gcp_bastion_zone: 'us-central1-a'
+ gcp_pool_id: 'pool-id-github-actions'
+ # created by devops/gcp/github-actions/configure_workload_identity_federation_with_github_actions_pipelines.sh
+ # gcp_provider_id: 'ga-GITHUB_REPO_NAME'
+ gcp_provider_id: 'ga-bundler'
+ # SERVICE_ACCOUNT_EMAIL="${SERVICE_ACCOUNT}@${PROJECT}.iam.gserviceaccount.com"
+ gcp_service_account: 'sa-bundler@prj-workload-identity-001.iam.gserviceaccount.com'
+ gcp_cluster_name: 'trustwallet'
+ gcp_cluster_location: 'us-central1'
+ use_internal_ip: true
+ deploy_command: './install-bundler/bundler-update-release.sh bundler-tw-production.cfg ${GITHUB_REF:10}'
+ # deploy_command: 'helm ls --all-namespaces'
diff --git a/.gitignore b/.gitignore
index bd1b9f75..626f99c5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,14 +1,27 @@
node_modules
.env
yarn-error.log
-centrifugo_config.json
relayer/dist
server/dist
coverage
-config.json
config.json.enc
*heapsnapshot
-.vscode
+refundAddresses.ts
+*.enc
+# Ignore all JSON files
+*.json
+*json.enc
+# But not these specific files
+!static-config.json
+!config-example.json
+!centrifugo_config.json
+
+# If index.ts is not a .json file, you don't need to explicitly exclude it.
+# However, if it's actually index.json, include it like so:
+#!index.json
+
+!example.cfg
dist/
*.code-workspace
config/development.json
+config/production.json
diff --git a/Dockerfile b/Dockerfile
index 07b49f54..5d6820a0 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,25 +1,36 @@
-FROM node:18.17.1-bookworm
+FROM node:21.6-bookworm as builder
-# install dependencies
-RUN apt update
-
-# Tini allows us to avoid several Docker edge cases, see https://github.com/krallin/tini.
-# NOTE: See https://github.com/hexops/dockerfile#is-tini-still-required-in-2020-i-thought-docker-added-it-natively
-RUN apt-get install tini
+# Install dependencies
# arguments
ARG PORT=3000
-RUN mkdir -p /relayer-node
-WORKDIR /relayer-node
+# Set up the directory
+WORKDIR /bundler
+# Copy package files
COPY package.json yarn.lock ./
# install packages
RUN yarn install
-COPY . /relayer-node
+# Copy the rest of the files
+COPY . /bundler
+
+# Build the application
RUN yarn run build
+
+# Second stage
+FROM node:21.6-bookworm
+
+# Tini allows us to avoid several Docker edge cases, see https://github.com/krallin/tini.
+# NOTE: See https://github.com/hexops/dockerfile#is-tini-still-required-in-2020-i-thought-docker-added-it-natively
+
+RUN apt-get update && apt-get install -y \
+ tini \
+ && rm -rf /var/lib/apt/lists/*
+
+# Expose the port
EXPOSE 3000
# Non-root user for security purposes.
@@ -32,11 +43,15 @@ EXPOSE 3000
# such a user does not exist.
RUN addgroup --gid 10001 --system nonroot \
&& adduser --uid 10000 --system --ingroup nonroot --home /home/nonroot nonroot
-EXPOSE 3000
+
+WORKDIR /home/nonroot/bundler
+COPY --from=builder --chown=10000:10001 /bundler /home/nonroot/bundler
+
# Use the non-root user to run our application
USER nonroot
ENTRYPOINT ["/usr/bin/tini", "--", "yarn"]
+# Default arguments for your app (remove if you have none):
CMD ["run", "start"]
diff --git a/Dockerfile.dev b/Dockerfile.dev
index 92b88796..13c07968 100644
--- a/Dockerfile.dev
+++ b/Dockerfile.dev
@@ -1,14 +1,35 @@
-FROM node:18.17.1-bookworm
+FROM node:21.6-bookworm as builder
-# update apt packages
-RUN apt-get update
+# Install dependencies
# arguments
ARG PORT=3000
+# Set up the directory
+WORKDIR /bundler
+
+# Copy package files
+COPY package.json yarn.lock ./
+
+# install packages
+RUN yarn install
+
+# Copy the rest of the files
+COPY . .
+
+# Second stage
+FROM node:21.6-bookworm
+
# Tini allows us to avoid several Docker edge cases, see https://github.com/krallin/tini.
# NOTE: See https://github.com/hexops/dockerfile#is-tini-still-required-in-2020-i-thought-docker-added-it-natively
-RUN apt-get install tini
+
+RUN apt-get update && apt-get install -y \
+ tini \
+ && rm -rf /var/lib/apt/lists/*
+
+
+# Expose the port
+EXPOSE 3000
# Non-root user for security purposes.
#
@@ -20,17 +41,14 @@ RUN apt-get install tini
# such a user does not exist.
RUN addgroup --gid 10001 --system nonroot \
&& adduser --uid 10000 --system --ingroup nonroot --home /home/nonroot nonroot
-EXPOSE 3000
WORKDIR /home/nonroot/bundler
-COPY package.json yarn.lock ./
-
-# install packages
-RUN yarn install
-COPY . .
-ENTRYPOINT ["/usr/bin/tini", "--", "yarn"]
+COPY --from=builder --chown=10000:10001 /bundler /home/nonroot/bundler
# Use the non-root user to run our application
USER nonroot
+
+ENTRYPOINT ["/usr/bin/tini", "--", "yarn"]
+
# Default arguments for your app (remove if you have none):
CMD ["run", "dev"]
diff --git a/Dockerfile.helm b/Dockerfile.helm
new file mode 100644
index 00000000..bab11c59
--- /dev/null
+++ b/Dockerfile.helm
@@ -0,0 +1,54 @@
+FROM node:21.6-bookworm as builder
+
+# Install dependencies
+
+# Arguments
+ARG PORT=3000
+
+# Set up the directory
+WORKDIR /bundler
+
+# Copy package files
+COPY package.json yarn.lock ./
+
+# Install packages
+RUN yarn install
+
+# Copy the rest of the files
+COPY . /bundler
+
+# Build the application
+RUN yarn run build
+
+# Second stage
+FROM node:21.6-bookworm
+
+# Tini allows us to avoid several Docker edge cases, see https://github.com/krallin/tini.
+# NOTE: See https://github.com/hexops/dockerfile#is-tini-still-required-in-2020-i-thought-docker-added-it-natively
+
+RUN apt-get update && apt-get install -y \
+ tini \
+ && rm -rf /var/lib/apt/lists/*
+
+# Expose the port
+EXPOSE 3000
+
+# Non-root user for security purposes.
+#
+# UIDs below 10,000 are a security risk, as a container breakout could result
+# in the container being ran as a more privileged user on the host kernel with
+# the same UID.
+#
+# Static GID/UID is also useful for chown'ing files outside the container where
+# such a user does not exist.
+RUN addgroup --gid 10001 --system nonroot \
+ && adduser --uid 10000 --system --ingroup nonroot --home /home/nonroot nonroot
+
+WORKDIR /home/nonroot/bundler
+COPY --from=builder --chown=10000:10001 /bundler /home/nonroot/bundler
+
+# Use the non-root user to run our application
+USER nonroot
+
+# Default arguments for your app (remove if you have none):
+ENTRYPOINT ["/usr/bin/tini", "--","./entrypoint.sh" ]
diff --git a/README.md b/README.md
index f28ab75b..4e7a2df3 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,11 @@
# Bundler
+
Biconomy ERC-4337 bundler-as-a-service implementation.
## Workflow best practices
-This project has two *important* branches:
+This project has two _important_ branches:
+
- `master`: Production branch. This is code that's currently in production.
- `staging`: Staging branch. This represents what will be deployed to staging and included in the next release after it's been tested.
@@ -12,6 +14,7 @@ To write quality commit messages we (try to) follow the [Conventional Commits St
## Local Development Environment
There are 2 ways to run the service and it's dependencies locally:
+
1. **Manually**: follow the instructions in the [Bundler Local Setup](https://www.notion.so/biconomy/Local-setup-858695240f3a4c19b6c96cbb3f235b0a?pvs=4) Notion page.
2. **Docker (recommended)**: follow the instructions below.
@@ -21,6 +24,7 @@ There are 2 ways to run the service and it's dependencies locally:
3. Run `docker compose up` and the server and all of it's dependencies should run in the current terminal session without throwing any errors.
Other useful commands:
+
- `docker compose down`: stop the containers without deleting their data.
- `docker compose down -v` tears down the whole environment, killing the containers and deleting any data volumes permanently. ⚠️ This will delete the local DB, do it only if you don't care about the data.
- `docker compose up -d`: runs the containers in the background without blocking the current terminal sessions.
@@ -32,4 +36,4 @@ Other useful commands:
When adding a new chain integration make sure to add the new charin id
to all relevant config deployment files, in the `supportedNetworks`
e.g. `config/staging.json` or the bunlder will not start that network
-even thouh is supported.
\ No newline at end of file
+even thouh is supported.
diff --git a/centrifugo_config.json b/centrifugo_config.json
new file mode 100644
index 00000000..37982cc7
--- /dev/null
+++ b/centrifugo_config.json
@@ -0,0 +1,30 @@
+{
+ "token_hmac_secret_key": "9edb7c38-0f55-4627-9bda-4cc050b5f6cb",
+ "admin_password": "admin_password",
+ "admin_secret": "admin_secret",
+ "api_key": "a4c3c3df-4294-4719-a6a6-0c3416d68466",
+ "allowed_origins": ["*"],
+ "debug": true,
+ "admin": true,
+ "log_level": "debug",
+ "client_anonymous": true,
+ "client_channel_limit": 512,
+ "namespaces": [
+ {
+ "name": "relayer",
+ "publish": true,
+ "history_size": 10,
+ "history_ttl": "300s",
+ "recover": true,
+ "anonymous": false
+ },
+ {
+ "name": "transaction",
+ "publish": true,
+ "history_size": 10,
+ "history_ttl": "300s",
+ "recover": true,
+ "anonymous": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/config/default.json b/config/default.json
index 93a11d14..5fd70f02 100644
--- a/config/default.json
+++ b/config/default.json
@@ -1014,6 +1014,7 @@
"networksNotSupportingEthCallStateOverrides": [
1101, 1442, 81, 592, 169, 3441005, 91715, 7116, 9980, 88882, 88888, 81457
],
+ "trustWalletSupportedNetworks": [137, 80001, 56, 204, 42161, 10, 8453],
"networksNotSupportingEthCallBytecodeStateOverrides": [
1, 59140, 59144, 84532, 421614, 168587773, 80001, 43113, 11155111, 1101,
88882, 88888, 1442, 420, 81457
@@ -1067,5 +1068,6 @@
},
"aaDashboardBackend": {
"url": "https://paymaster-dashboard-backend-v2.staging.biconomy.io/api/v2/bundlers/auth"
- }
+ },
+ "isTWSetup": false
}
diff --git a/doc/bundler-tw-staging.md b/doc/bundler-tw-staging.md
new file mode 100644
index 00000000..c3f32b80
--- /dev/null
+++ b/doc/bundler-tw-staging.md
@@ -0,0 +1,267 @@
+
+This file contains the output of running the initial setup script for
+bundler tw staging.
+```bash
+./bundler-initial-setup.sh configs/bundler-tw-staging.cfg
+```
+
+
+ ./bundler-initial-setup.sh configs/bundler-tw-staging.cfg
+
+```
+Current cluster name is: dedicated-bundler
+Current trimmed cluster name is: dedicate
+This script must be run only once for a new bundler deployment in the namespace
+Context matches. Continuing...
+Global IP with name bundler-tw-staging already exists.
+ The IP address for bundler-tw-staging is: 34.110.199.133
+ Make sure you have added an A record against bundler-tw-staging.biconomy.io with 34.110.199.133
+NAME STATUS AGE
+bundler-tw-staging Active 32h
+ SUCCESS: bundler-tw-staging exists GCP Secret dedicate-bundler-tw-config doesn't exist.
+Creating it now from /Users/radupopa/p/bico/bundler/config.json.enc
+Created version [1] of the secret [dedicate-bundler-tw-config].
+Secret dedicate-bundler-tw-config has been created.
+GCP_ENCRYPTED_CONFIG_SECRET dedicate-bundler-tw-config process completed.
+Secret dedicate-bundler-tw-passphrase does not exist.
+Enter the password:
+Created version [1] of the secret [dedicate-bundler-tw-passphrase].
+Secret dedicate-bundler-tw-passphrase created successfully.
+Creting GCP IAM role/service [dedicate-bundler-tw-bund] account
+Created service account [dedicate-bundler-tw-bund].
+Creation of GCP IAM role/service [dedicate-bundler-tw-bund] account completed
+Adding role binding of GCP IAM role/service [dedicate-bundler-tw-bund] to GCP_ENCRYPTED_CONFIG_SECRET=[dedicate-bundler-tw-config]
+Updated IAM policy for secret [dedicate-bundler-tw-config].
+bindings:
+- members:
+ - serviceAccount:dedicate-bundler-tw-bund@biconomy-prod.iam.gserviceaccount.com
+ role: roles/secretmanager.secretAccessor
+etag: BwYPY_iWdus=
+version: 1
+Role binding of GCP IAM role/service [dedicate-bundler-tw-bund] to GCP_ENCRYPTED_CONFIG_SECRET=[dedicate-bundler-tw-config] completed
+Adding role binding of GCP IAM role/service [dedicate-bundler-tw-bund] to SECRET_NAME=[dedicate-bundler-tw-passphrase]
+Updated IAM policy for secret [dedicate-bundler-tw-passphrase].
+bindings:
+- members:
+ - serviceAccount:dedicate-bundler-tw-bund@biconomy-prod.iam.gserviceaccount.com
+ role: roles/secretmanager.secretAccessor
+etag: BwYPY_i1I7k=
+version: 1
+Role binding of GCP IAM role/service [dedicate-bundler-tw-bund] to SECRET_NAME=[dedicate-bundler-tw-passphrase] completed
+Creating dedicate-bundler-tw--sa in bundler-tw-staging
+serviceaccount/dedicate-bundler-tw--sa created
+dedicate-bundler-tw--sa in bundler-tw-staging created
+Binding dedicate-bundler-tw-bund with kubernetes dedicate-bundler-tw--sa for workloadIdentityUser in bundler-tw-staging
+Updated IAM policy for serviceAccount [dedicate-bundler-tw-bund@biconomy-prod.iam.gserviceaccount.com].
+bindings:
+- members:
+ - serviceAccount:biconomy-prod.svc.id.goog[bundler-tw-staging/dedicate-bundler-tw--sa]
+ role: roles/iam.workloadIdentityUser
+etag: BwYPY_kR-wE=
+version: 1
+Binding Complete
+Annotating dedicate-bundler-tw-bund with kubernetes dedicate-bundler-tw--sa for workloadIdentityUser in bundler-tw-staging
+serviceaccount/dedicate-bundler-tw--sa annotate
+Annotation Complete
+
+------ Deploying redis to bundler-tw-staging -----
+Release "redis" does not exist. Installing it now.
+W0120 19:32:11.665549 31221 warnings.go:70] autopilot-default-resources-mutator:Autopilot updated StatefulSet bundler-tw-staging/redis-replicas: adjusted resources to meet requirements for containers [redis] (see http://g.co/gke/autopilot-resources)
+W0120 19:32:11.665557 31221 warnings.go:70] autopilot-default-resources-mutator:Autopilot updated StatefulSet bundler-tw-staging/redis-master: adjusted resources to meet requirements for containers [redis] (see http://g.co/gke/autopilot-resources)
+NAME: redis
+LAST DEPLOYED: Sat Jan 20 19:32:01 2024
+NAMESPACE: bundler-tw-staging
+STATUS: deployed
+REVISION: 1
+TEST SUITE: None
+NOTES:
+CHART NAME: redis
+CHART VERSION: 18.1.2
+APP VERSION: 7.2.1
+
+** Please be patient while the chart is being deployed **
+
+Redis® can be accessed on the following DNS names from within your cluster:
+
+ redis-master.bundler-tw-staging.svc.cluster.local for read/write operations (port 6379)
+ redis-replicas.bundler-tw-staging.svc.cluster.local for read-only operations (port 6379)
+
+
+
+To get your password run:
+
+ export REDIS_PASSWORD=$(kubectl get secret --namespace bundler-tw-staging redis -o jsonpath="{.data.redis-password}" | base64 -d)
+
+To connect to your Redis® server:
+
+1. Run a Redis® pod that you can use as a client:
+
+ kubectl run --namespace bundler-tw-staging redis-client --restart='Never' --env REDIS_PASSWORD=$REDIS_PASSWORD --image docker.io/bitnami/redis:7.2.1-debian-11-r0 --command -- sleep infinity
+
+ Use the following command to attach to the pod:
+
+ kubectl exec --tty -i redis-client \
+ --namespace bundler-tw-staging -- bash
+
+2. Connect using the Redis® CLI:
+ REDISCLI_AUTH="$REDIS_PASSWORD" redis-cli -h redis-master
+ REDISCLI_AUTH="$REDIS_PASSWORD" redis-cli -h redis-replicas
+
+To connect to your database from outside the cluster execute the following commands:
+
+ kubectl port-forward --namespace bundler-tw-staging svc/redis-master 6379:6379 &
+ REDISCLI_AUTH="$REDIS_PASSWORD" redis-cli -h 127.0.0.1 -p 6379
+Mongo deployment completed
+Redis url \033[0;32m<>\033[0m
+To debug Redis, you can use the following commands:
+#kubectl run redis-debug --rm -i --tty --image redis:latest -- bash
+If you want to benchmark your redis installation
+redis-benchmark -h 127.0.0.1 -p -c 100 -n 100000 -a
+#redis-cli -h redis-master.bundler-tw-staging.svc.cluster.local -a IAMredis985834
+
+ ####### Deploying rabbitmq to bundler-tw-staging #######
+Release "rabbitmq" does not exist. Installing it now.
+W0120 19:34:02.986382 31666 warnings.go:70] autopilot-default-resources-mutator:Autopilot updated StatefulSet bundler-tw-staging/rabbitmq: adjusted resources to meet requirements for containers [rabbitmq] (see http://g.co/gke/autopilot-resources)
+NAME: rabbitmq
+LAST DEPLOYED: Sat Jan 20 19:33:50 2024
+NAMESPACE: bundler-tw-staging
+STATUS: deployed
+REVISION: 1
+TEST SUITE: None
+NOTES:
+CHART NAME: rabbitmq
+CHART VERSION: 12.3.0
+APP VERSION: 3.12.7** Please be patient while the chart is being deployed **
+
+Credentials:
+ echo "Username : RMQUsername"
+ echo "Password : $(kubectl get secret --namespace bundler-tw-staging rabbitmq -o jsonpath="{.data.rabbitmq-password}" | base64 -d)"
+ echo "ErLang Cookie : $(kubectl get secret --namespace bundler-tw-staging rabbitmq -o jsonpath="{.data.rabbitmq-erlang-cookie}" | base64 -d)"
+
+Note that the credentials are saved in persistent volume claims and will not be changed upon upgrade or reinstallation unless the persistent volume claim has been deleted. If this is not the first installation of this chart, the credentials may not be valid.
+This is applicable when no passwords are set and therefore the random password is autogenerated. In case of using a fixed password, you should specify it when upgrading.
+More information about the credentials may be found at https://docs.bitnami.com/general/how-to/troubleshoot-helm-chart-issues/#credential-errors-while-upgrading-chart-releases.
+
+RabbitMQ can be accessed within the cluster on port 5672 at rabbitmq.bundler-tw-staging.svc.cluster.local
+
+To access for outside the cluster, perform the following steps:
+
+To Access the RabbitMQ AMQP port:
+
+ echo "URL : amqp://127.0.0.1:5672/"
+ kubectl port-forward --namespace bundler-tw-staging svc/rabbitmq 5672:5672
+
+To Access the RabbitMQ Management interface:
+
+ echo "URL : http://127.0.0.1:15672/"
+ kubectl port-forward --namespace bundler-tw-staging svc/rabbitmq 15672:15672
+
+To access the RabbitMQ Prometheus metrics, get the RabbitMQ Prometheus URL by running:
+
+ kubectl port-forward --namespace bundler-tw-staging svc/rabbitmq 9419:9419 &
+ echo "Prometheus Metrics URL: http://127.0.0.1:9419/metrics"
+
+Then, open the obtained URL in a browser.
+[RABBITMQ] deployement completedTo connect to the rabitMQ
+To test connections
+kubectl run curl-test --namespace bundler-tw-staging --image=busybox --rm -it -- /bin/sh
+curl -i -u RMQUsername:RMQpassword http://rabbitmq.testing.svc.cluster.local:15672/api/overview
+
+------ Deploying mongo to bundler-tw-staging -----
+Release "mongo" does not exist. Installing it now.
+W0120 19:39:08.696250 31721 warnings.go:70] autopilot-default-resources-mutator:Autopilot updated Deployment bundler-tw-staging/mongo: defaulted unspecified resources for containers [metrics] (see http://g.co/gke/autopilot-defaults), and adjusted resources to meet requirements for containers [mongodb] (see http://g.co/gke/autopilot-resources)
+NAME: mongo
+LAST DEPLOYED: Sat Jan 20 19:38:58 2024
+NAMESPACE: bundler-tw-staging
+STATUS: deployed
+REVISION: 1
+TEST SUITE: None
+NOTES:
+CHART NAME: mongodb
+CHART VERSION: 13.18.4
+APP VERSION: 6.0.10
+
+** Please be patient while the chart is being deployed **
+
+MongoDB® can be accessed on the following DNS name(s) and ports from within your cluster:
+
+ mongo.bundler-tw-staging.svc.cluster.local
+
+To get the root password run:
+
+ export MONGODB_ROOT_PASSWORD=$(kubectl get secret --namespace bundler-tw-staging mongo -o jsonpath="{.data.mongodb-root-password}" | base64 -d)
+
+To get the password for "userone" run:
+
+ export MONGODB_PASSWORD=$(kubectl get secret --namespace bundler-tw-staging mongo -o jsonpath="{.data.mongodb-passwords}" | base64 -d | awk -F',' '{print $1}')
+
+To get the password for "usertwo" run:
+
+ export MONGODB_PASSWORD=$(kubectl get secret --namespace bundler-tw-staging mongo -o jsonpath="{.data.mongodb-passwords}" | base64 -d | awk -F',' '{print $2}')
+
+To connect to your database, create a MongoDB® client container:
+
+ kubectl run --namespace bundler-tw-staging mongo-client --rm --tty -i --restart='Never' --env="MONGODB_ROOT_PASSWORD=$MONGODB_ROOT_PASSWORD" --image docker.io/zcube/bitnami-compat-mongodb:latest --command -- bash
+
+Then, run the following command:
+ mongosh admin --host "mongo" --authenticationDatabase admin -u $MONGODB_ROOT_USER -p $MONGODB_ROOT_PASSWORD
+
+To connect to your database from outside the cluster execute the following commands:
+
+ kubectl port-forward --namespace bundler-tw-staging svc/mongo 27017:27017 &
+ mongosh --host 127.0.0.1 --authenticationDatabase admin -p $MONGODB_ROOT_PASSWORD
+
+To access the MongoDB® Prometheus metrics, get the MongoDB® Prometheus URL by running:
+
+ kubectl port-forward --namespace bundler-tw-staging svc/mongo-metrics 9216:9216 &
+ echo "Prometheus Metrics URL: http://127.0.0.1:9216/metrics"
+
+Then, open the obtained URL in a browser.
+Mongo deployment completed
+To connect to the databases, use the following URLs:
+Paymaster dashboard DB URL:
+mongodb://usertwo:usertwopassword@mongo.bundler-tw-staging.svc.cluster.local:27017/paymaster-dashboard
+
+RelayerNode DB URL:
+mongodb://userone:useronepassword@mongo.bundler-tw-staging.svc.cluster.local:27017/relayer-node-service
+
+To test connections
+kubectl run -i --tty --rm debugmongo --image=mongo --restart=Never --namespace=bundler-tw-staging -- bash
+mongosh mongodb://mongo.bundler-tw-staging.svc.cluster.local:27017/relayer-node-service -u userone -p useronepassword
+
+####### Deploying centrifugo to bundler-tw-staging #######
+Release "centrifugo" does not exist. Installing it now.
+W0120 19:41:09.094580 31734 warnings.go:70] autopilot-default-resources-mutator:Autopilot updated Deployment bundler-tw-staging/centrifugo: adjusted resources to meet requirements for containers [centrifugo] (see http://g.co/gke/autopilot-resources)
+NAME: centrifugo
+LAST DEPLOYED: Sat Jan 20 19:41:02 2024
+NAMESPACE: bundler-tw-staging
+STATUS: deployed
+REVISION: 1
+TEST SUITE: None
+NOTES:
+1. Get the application URL by running these commands:
+ export POD_NAME=$(kubectl get pods --namespace bundler-tw-staging -l "app.kubernetes.io/name=centrifugo,app.kubernetes.io/instance=centrifugo" -o jsonpath="{.items[0].metadata.name}")
+ kubectl --namespace bundler-tw-staging port-forward $POD_NAME 8000:8000
+
+
+ ####### Deployed centrifugo to bundler-tw-staging #######
+
+staging-trust-wallet-chains.sh
+bundler-tw-staging.biconomy.io
+staging-trust-wallet-chains.sh
+/Users/radupopa/p/bico/bundler/install-bundler
+/Users/radupopa/p/bico/bundler/install-bundler/configs/chains/staging-trust-wallet-chains.sh
+Chains that are being added to Ingress 80001
+{80001}
+IP_NAME that will be attached to Ingress is bundler-tw-staging
+Release "network" does not exist. Installing it now.
+W0120 19:41:30.901571 31746 warnings.go:70] annotation "kubernetes.io/ingress.class" is deprecated, please use 'spec.ingressClassName' instead
+NAME: network
+LAST DEPLOYED: Sat Jan 20 19:41:25 2024
+NAMESPACE: bundler-tw-staging
+STATUS: deployed
+REVISION: 1
+TEST SUITE: None
+####### Deployed network to bundler-tw-staging #######
+```
+
\ No newline at end of file
diff --git a/entrypoint.sh b/entrypoint.sh
new file mode 100755
index 00000000..053cc7a6
--- /dev/null
+++ b/entrypoint.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# Set ORDINAL_INDEX from file
+
+## this is being mounted from the kubernetes statefulset
+## the nodepathindex will be extracetd from the statefulset
+#ordinal index and will be written to this path.
+export NODE_CONFIG=$(cat /etc/podinfo/ordinal_index)
+
+
+## this is being mounted from the kubernetes statefulset
+## the secret will be read from the relevant secret
+# and will be written at this path
+export BUNDLER_CONFIG_PASSPHRASE=$(cat /gcpsecrets/config-passphrase)
+
+# Start Node.js application
+
+# Command to run the application
+# sleep 3600
+yarn run start
\ No newline at end of file
diff --git a/install-bundler/.DS_Store b/install-bundler/.DS_Store
new file mode 100644
index 00000000..c56d942e
Binary files /dev/null and b/install-bundler/.DS_Store differ
diff --git a/install-bundler/ParseLogs.md b/install-bundler/ParseLogs.md
new file mode 100644
index 00000000..acc4042a
--- /dev/null
+++ b/install-bundler/ParseLogs.md
@@ -0,0 +1,301 @@
+
+# Progression of logs
+
+## Phase 1: When a useOps is submitted, this is the log entry you will see in the the console.
+```
+{
+ "insertId": "wipvkdza8k5odu2i",
+ "jsonPayload": {
+ "level": "info",
+ "message": "userOp received: {\"sender\":\"0xf275fa2560ceb8badc313a2a29fb166f7ca5de5e\",\"nonce\":\"0x0e\",\"initCode\":\"0x\",\"callData\":\"0x912ccaa3000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000020000000000000000000000001758f42af7026fbbb559dc60ece0de3ef81f665e0000000000000000000000001758f42af7026fbbb559dc60ece0de3ef81f665e0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002440d097c3000000000000000000000000f73501e5f730d1236a7921ff5a3e965b1e49795300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002440d097c3000000000000000000000000f73501e5f730d1236a7921ff5a3e965b1e49795300000000000000000000000000000000000000000000000000000000\",\"maxFeePerGas\":\"0x861c4698\",\"maxPriorityFeePerGas\":\"0x59682f10\",\"verificationGasLimit\":\"0xead4\",\"callGasLimit\":\"0x01b5f7\",\"preVerificationGas\":\"0x0122a4\",\"paymasterAndData\":\"0x000031dd6d9d3a133e663660b959162870d755d4000000000000000000000000d39222801871b185ca8db59a62153ee6f07c038800000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000041c3f1dc30d135ec799c9a691883d1e3cbb5db41dc7ff55ee6c935ac395a6d12e21d2b04c296e1deeda3d6ca728a5b48c6206e5955ae5e16c04afb25526ab496841b00000000000000000000000000000000000000000000000000000000000000\",\"signature\":\"0x661c06494b1d0d0844130b59db399b763b5d9df0a36cbe80a38b41d4dbbe27b7016821f14349e96307533a72a95550dd83909853e3b9a6bfa8a274849b8423451b\"} on chainId: 80001",
+ "path": "dist/common/simulation/BundlerSimulationService.js",
+ "hostname": "bundlers-statefulset-1",
+ "request-id": "3e063180-61cc-11ee-b6a7-ab6d82b174d2",
+ "timestamp": "2023-10-03 09:07:13 690"
+ },
+ "resource": {
+ "type": "k8s_container",
+ "labels": {
+ "location": "us-east1-b",
+ "container_name": "bundlers-pod",
+ "namespace_name": "qabundler",
+ "project_id": "biconomy-test-397415",
+ "pod_name": "bundlers-statefulset-1",
+ "cluster_name": "with-gcplb"
+ }
+ },
+ "timestamp": "2023-10-03T09:07:13.690197056Z",
+ "severity": "INFO",
+ "labels": {
+ "k8s-pod/app_kubernetes_io/name": "bundlers",
+ "compute.googleapis.com/resource_name": "gke-with-gcplb-default-pool-71afda7e-fbdt",
+ "k8s-pod/app": "bundlers",
+ "k8s-pod/statefulset_kubernetes_io/pod-name": "bundlers-statefulset-1",
+ "k8s-pod/namespace": "qabundler",
+ "k8s-pod/controller-revision-hash": "bundlers-statefulset-566644c5b4",
+ "k8s-pod/app_kubernetes_io/instance": "qabundler-test-bundler"
+ },
+ "logName": "projects/biconomy-test-397415/logs/stdout",
+ "receiveTimestamp": "2023-10-03T09:07:15.612152409Z"
+}
+```
+
+#### Python code to get UserOps submitted with the timestamp and nonce
+
+```
+def userop_submitted_noce(data):
+ userop_nonces = []
+ for e in data:
+ if e.get("jsonPayload") and e["jsonPayload"].get("message"):
+ if "userOp received" in e["jsonPayload"]["message"]:
+ content = e["jsonPayload"]["message"]
+ match = re.search(r'"nonce":"(.*?)"', content)
+ nonce = match.group(1) if match else None
+ userop_nonces.append({
+ "timestamp": e["jsonPayload"]["timestamp"],
+ "pod_name":e["resource"]["labels"]["pod_name"],
+ "nonce": nonce,
+ "message": "UserOp received"})
+ return userop_nonces
+```
+
+```
+ userop_nonces = userop_submitted_noce(data)
+```
+
+
+## Phase 2: When active relayer is selected to submit the tx
+```
+{
+ "insertId": "vd548aq0m3y9a94e",
+ "jsonPayload": {
+ "path": "src/services/consumer/BundlerConsumer.js",
+ "message": "Setting active relayer: 0x75c033055cd4f144d51b59b35dae02d91be03e74 as beneficiary for userOp: {\"sender\":\"0x23da80269487c6033827360fac4e283dbb150e58\",\"nonce\":\"0x0a\",\"initCode\":\"0x\",\"callData\":\"0x912ccaa3000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000020000000000000000000000001758f42af7026fbbb559dc60ece0de3ef81f665e0000000000000000000000001758f42af7026fbbb559dc60ece0de3ef81f665e0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002440d097c3000000000000000000000000f73501e5f730d1236a7921ff5a3e965b1e49795300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002440d097c3000000000000000000000000f73501e5f730d1236a7921ff5a3e965b1e49795300000000000000000000000000000000000000000000000000000000\",\"maxFeePerGas\":\"0x861c4698\",\"maxPriorityFeePerGas\":\"0x59682f10\",\"verificationGasLimit\":\"0xead4\",\"callGasLimit\":\"0x01b5f7\",\"preVerificationGas\":\"0x0122a4\",\"paymasterAndData\":\"0x000031dd6d9d3a133e663660b959162870d755d4000000000000000000000000d39222801871b185ca8db59a62153ee6f07c038800000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000041c9d8457ec4e8ff42e5881686170def54e01c9bc67a75b69ee1dd394f467669884ff438a03790d30ec184184129f71873d9c59ee63c770d26689319b53d4d7fd11c00000000000000000000000000000000000000000000000000000000000000\",\"signature\":\"0x2ef30e3df238b635742e27e3da89f987005907f1babd6f80cb21437646513c0557b4df6b234b3fce62cf84dc5cb001ce55de3460db78822e98395dd8fef3caa91c\"} for transactionId: 0x18a9c030ba977a4e3360be492b1867e34728397a1ef121cf686844288150cfb4 on chainId: 80001",
+ "hostname": "bundlers-statefulset-1",
+ "level": "info",
+ "timestamp": "2023-10-03 09:07:13 509"
+ },
+ "resource": {
+ "type": "k8s_container",
+ "labels": {
+ "location": "us-east1-b",
+ "container_name": "bundlers-pod",
+ "cluster_name": "with-gcplb",
+ "pod_name": "bundlers-statefulset-1",
+ "project_id": "biconomy-test-397415",
+ "namespace_name": "qabundler"
+ }
+ },
+ "timestamp": "2023-10-03T09:07:13.509152500Z",
+ "severity": "INFO",
+ "labels": {
+ "k8s-pod/namespace": "qabundler",
+ "k8s-pod/controller-revision-hash": "bundlers-statefulset-566644c5b4",
+ "compute.googleapis.com/resource_name": "gke-with-gcplb-default-pool-71afda7e-fbdt",
+ "k8s-pod/app_kubernetes_io/instance": "qabundler-test-bundler",
+ "k8s-pod/statefulset_kubernetes_io/pod-name": "bundlers-statefulset-1",
+ "k8s-pod/app_kubernetes_io/name": "bundlers",
+ "k8s-pod/app": "bundlers"
+ },
+ "logName": "projects/biconomy-test-397415/logs/stdout",
+ "receiveTimestamp": "2023-10-03T09:07:15.612152409Z"
+}
+```
+#### python code
+```
+
+def nonce_to_txids(data):
+ array = []
+ txid_nonce = {}
+ for e in data:
+ if e.get("jsonPayload") and e["jsonPayload"].get("message"):
+ if "Setting active relayer" in e["jsonPayload"]["message"]:
+ s = e["jsonPayload"]["message"]
+ active_relayer_match = re.search(r'Setting active relayer: (\w+)', s)
+ activeRelayer = active_relayer_match.group(1) if active_relayer_match else None
+ transaction_id_match = re.search(r'transactionId: (\w+)', s)
+ transactionId = transaction_id_match.group(1) if transaction_id_match else None
+ # Extract nonce from the JSON
+ nonce_match = re.search(r'"nonce":"(\w+)"', s)
+ nonce = nonce_match.group(1) if nonce_match else None
+ array.append({
+ "timestamp": e["jsonPayload"]["timestamp"],
+ "nonce": nonce,
+ "transactionId": transactionId,
+ "pod_name": e["resource"]["labels"]["pod_name"],
+ "relayer": activeRelayer,
+ "message": "Active relayer assigned"})
+ txid_nonce[transactionId] = nonce
+ return array, txid_nonce
+
+```
+
+```
+nonceTxIds, txid_nonce = nonce_to_txids(data)
+```
+
+
+## 3rd phase: Submitted to the blockchain
+
+```
+{
+ "insertId": "sz6qqeiwmg490c1r",
+ "jsonPayload": {
+ "level": "info",
+ "timestamp": "2023-10-03 09:07:13 529",
+ "hostname": "bundlers-statefulset-1",
+ "message": "Sending transaction to network: {\"from\":\"0x75c033055cd4f144d51b59b35dae02d91be03e74\",\"to\":\"0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789\",\"value\":\"0x0\",\"gasLimit\":\"0x22a6ae\",\"data\":\"0x1fad948c000000000000000000000000000000000000000000000000000000000000004000000000000000000000000075c033055cd4f144d51b59b35dae02d91be03e740000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000023da80269487c6033827360fac4e283dbb150e58000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000180000000000000000000000000000000000000000000000000000000000001b5f7000000000000000000000000000000000000000000000000000000000000ead400000000000000000000000000000000000000000000000000000000000122a400000000000000000000000000000000000000000000000000000000861c46980000000000000000000000000000000000000000000000000000000059682f100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000244912ccaa3000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000020000000000000000000000001758f42af7026fbbb559dc60ece0de3ef81f665e0000000000000000000000001758f42af7026fbbb559dc60ece0de3ef81f665e0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002440d097c3000000000000000000000000f73501e5f730d1236a7921ff5a3e965b1e49795300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002440d097c3000000000000000000000000f73501e5f730d1236a7921ff5a3e965b1e497953000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d4000031dd6d9d3a133e663660b959162870d755d4000000000000000000000000d39222801871b185ca8db59a62153ee6f07c038800000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000041c9d8457ec4e8ff42e5881686170def54e01c9bc67a75b69ee1dd394f467669884ff438a03790d30ec184184129f71873d9c59ee63c770d26689319b53d4d7fd11c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000412ef30e3df238b635742e27e3da89f987005907f1babd6f80cb21437646513c0557b4df6b234b3fce62cf84dc5cb001ce55de3460db78822e98395dd8fef3caa91c00000000000000000000000000000000000000000000000000000000000000\",\"chainId\":80001,\"nonce\":16,\"type\":2,\"maxFeePerGas\":\"0x861c4698\",\"maxPriorityFeePerGas\":\"0x59682f10\"} for bundler address: 0x75c033055cd4f144d51b59b35dae02d91be03e74 for transactionId: 0x18a9c030ba977a4e3360be492b1867e34728397a1ef121cf686844288150cfb4 on chainId: 80001",
+ "path": "src/services/transaction-service/EVMTransactionService.js"
+ },
+ "resource": {
+ "type": "k8s_container",
+ "labels": {
+ "project_id": "biconomy-test-397415",
+ "namespace_name": "qabundler",
+ "cluster_name": "with-gcplb",
+ "container_name": "bundlers-pod",
+ "location": "us-east1-b",
+ "pod_name": "bundlers-statefulset-1"
+ }
+ },
+ "timestamp": "2023-10-03T09:07:13.529237399Z",
+ "severity": "INFO",
+ "labels": {
+ "k8s-pod/namespace": "qabundler",
+ "k8s-pod/statefulset_kubernetes_io/pod-name": "bundlers-statefulset-1",
+ "k8s-pod/app_kubernetes_io/name": "bundlers",
+ "k8s-pod/app": "bundlers",
+ "compute.googleapis.com/resource_name": "gke-with-gcplb-default-pool-71afda7e-fbdt",
+ "k8s-pod/controller-revision-hash": "bundlers-statefulset-566644c5b4",
+ "k8s-pod/app_kubernetes_io/instance": "qabundler-test-bundler"
+ },
+ "logName": "projects/biconomy-test-397415/logs/stdout",
+ "receiveTimestamp": "2023-10-03T09:07:15.612152409Z"
+}
+```
+
+#### python code
+```
+
+
+def submitted_to_blockchain(data, txid_nonce):
+ result = []
+ for e in data:
+ if e.get("jsonPayload") and e["jsonPayload"].get("message"):
+ if "Sending transaction to network" in e["jsonPayload"]["message"]:
+ s = e["jsonPayload"]["message"]
+ transaction_id_match = re.search(r'transactionId: (\w+)', s)
+ transactionId = transaction_id_match.group(1) if transaction_id_match else None
+
+ # Extract nonce from the JSON
+ _result = {
+ "timestamp": e["jsonPayload"]["timestamp"],
+ "transactionId": transactionId,
+ "pod_name": e["resource"]["labels"]["pod_name"],
+ "message": "Tx submitted on blockchain"
+ }
+ try:
+ _result.update({"nonce": txid_nonce[transactionId]})
+ except Exception:
+ _result.update({"nonce": None})
+
+ result.append(_result)
+
+ return result
+```
+
+```
+submitted = submitted_to_blockchain(data, txid_nonce)
+```
+
+## Phase 4: Transaction Execution
+
+```
+{
+ "insertId": "akmjpt3hh4udkj42",
+ "jsonPayload": {
+ "message": "Transaction execution response for transactionId 0x1e80dc26bc1307e1119d657dd5ca7147d7cdeac8b0560e035228021204da62a7: {\"success\":true,\"transactionResponse\":{\"type\":2,\"chainId\":80001,\"nonce\":19,\"maxPriorityFeePerGas\":{\"type\":\"BigNumber\",\"hex\":\"0x59682f10\"},\"maxFeePerGas\":{\"type\":\"BigNumber\",\"hex\":\"0x861c4698\"},\"gasPrice\":null,\"gasLimit\":{\"type\":\"BigNumber\",\"hex\":\"0x22a6ae\"},\"to\":\"0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789\",\"value\":{\"type\":\"BigNumber\",\"hex\":\"0x00\"},\"data\":\"0x1fad948c0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000896aacdb5e0e280c39f61da7004f5f30993678c400000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000d94de4af1ffef0a257e2895318c01e8de49ceab1000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000180000000000000000000000000000000000000000000000000000000000001b5f7000000000000000000000000000000000000000000000000000000000000ead400000000000000000000000000000000000000000000000000000000000122a400000000000000000000000000000000000000000000000000000000861c46980000000000000000000000000000000000000000000000000000000059682f100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000244912ccaa3000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000020000000000000000000000001758f42af7026fbbb559dc60ece0de3ef81f665e0000000000000000000000001758f42af7026fbbb559dc60ece0de3ef81f665e0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002440d097c3000000000000000000000000f73501e5f730d1236a7921ff5a3e965b1e49795300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002440d097c3000000000000000000000000f73501e5f730d1236a7921ff5a3e965b1e497953000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d4000031dd6d9d3a133e663660b959162870d755d4000000000000000000000000d39222801871b185ca8db59a62153ee6f07c03880000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000004136ac64424a4b3a75ce12e9057f9d5e43c881ba364e2ad7a9e16612ff10a1eed02c656478c1304ccd54742074b44641e7281ff46dd22fc36c88f041fbab5c62211c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041cd2e2a88d0ff63b8690bc6bcadd4e9802500fce7d294eb9d42becad975ec6b1f13235db7e058aaafcca1585085d7aeba46fcafff3c7ce1059ac960b4767c793f1b00000000000000000000000000000000000000000000000000000000000000\",\"accessList\":[],\"hash\":\"0x87440f4a4b7938a362892089fbd51fa8a95aea238d77b9f3b4f518d13748199e\",\"v\":1,\"r\":\"0x1e66db39a7c6181b8e04872ce4099d4c41231cf42fb5d0049e833a0438e46a1b\",\"s\":\"0x062174f47f2dbd7f830f0c581574f563761fa1fc4395709a789bb67d6943df02\",\"from\":\"0x896Aacdb5E0E280c39f61DA7004f5F30993678c4\",\"confirmations\":0}} on chainId 80001",
+ "path": "src/services/transaction-service/EVMTransactionService.js",
+ "hostname": "bundlers-statefulset-0",
+ "level": "info",
+ "timestamp": "2023-10-03 09:07:13 882"
+ },
+ "resource": {
+ "type": "k8s_container",
+ "labels": {
+ "pod_name": "bundlers-statefulset-0",
+ "container_name": "bundlers-pod",
+ "namespace_name": "qabundler",
+ "cluster_name": "with-gcplb",
+ "project_id": "biconomy-test-397415",
+ "location": "us-east1-b"
+ }
+ },
+ "timestamp": "2023-10-03T09:07:13.882490751Z",
+ "severity": "INFO",
+ "labels": {
+ "k8s-pod/app": "bundlers",
+ "k8s-pod/app_kubernetes_io/instance": "qabundler-test-bundler",
+ "compute.googleapis.com/resource_name": "gke-with-gcplb-default-pool-71afda7e-fbdt",
+ "k8s-pod/statefulset_kubernetes_io/pod-name": "bundlers-statefulset-0",
+ "k8s-pod/app_kubernetes_io/name": "bundlers",
+ "k8s-pod/namespace": "qabundler",
+ "k8s-pod/controller-revision-hash": "bundlers-statefulset-566644c5b4"
+ },
+ "logName": "projects/biconomy-test-397415/logs/stdout",
+ "receiveTimestamp": "2023-10-03T09:07:15.520648899Z"
+}
+```
+
+#### python code
+```
+def execution_txids(data, txid_nonce):
+ result = []
+ for e in data:
+ if e.get("jsonPayload") and e["jsonPayload"].get("message"):
+ if "Transaction execution response for transactionId" in e["jsonPayload"]["message"]:
+ json_string = e["jsonPayload"]["message"]
+
+
+ transaction_id_match = re.search(r'transactionId (0x[a-fA-F0-9]{64})', json_string)
+ transactionId = transaction_id_match.group(1) if transaction_id_match else None
+
+
+ transaction_hash_match = re.search(r'\"hash\":\"(0x[a-fA-F0-9]{64})\"', json_string)
+ transactionHash = transaction_hash_match.group(1) if transaction_id_match else None
+ _result = {
+ "timestamp": e["jsonPayload"]["timestamp"],
+ "transactionId": transactionId,
+ "pod_name": e["resource"]["labels"]["pod_name"],
+ "transactionHash": transactionHash,
+ "message": "Execution completed"
+ }
+
+ try:
+ _result.update({"nonce": txid_nonce[transactionId]})
+ except:
+ _result.update({"nonce": None})
+ result.append(_result)
+ return result
+
+```
+
+```
+execution = execution_txids(data, txid_nonce)
+```
+
+## Result:
+Concatanate all the arrays and print, It will show the the execution of all the userop submitted
+
+```
+userop_nonces = userop_submitted_noce(data)
+nonceTxIds, txid_nonce = nonce_to_txids(data)
+submitted = submitted_to_blockchain(data, txid_nonce)
+execution = execution_txids(data, txid_nonce)
+
+result = userop_nonces + nonceTxIds + submitted + execution
+sorted_data = sorted(result, key=lambda x: x['timestamp'])
+for entry in sorted_data:
+ print(f"{entry['timestamp']}\t{entry['pod_name']}\t{entry['nonce']}\t{entry['message']}")
+
+```
\ No newline at end of file
diff --git a/install-bundler/TODO.md b/install-bundler/TODO.md
new file mode 100644
index 00000000..6611f171
--- /dev/null
+++ b/install-bundler/TODO.md
@@ -0,0 +1,7 @@
+
+- [ ] If new namespaces are working correctly and arent polluting other namespaces .
+- [ ] Get rid of exeternalComponents directory and install redis cluster .
+- [ ] Replicas of RabbitMQ .
+- [ ] Replicas of MongoDB .
+- [ ] Integrate datadog for production.
+- [ ] Integrate secrets for production.
\ No newline at end of file
diff --git a/install-bundler/bundler-initial-setup.sh b/install-bundler/bundler-initial-setup.sh
new file mode 100755
index 00000000..be434a48
--- /dev/null
+++ b/install-bundler/bundler-initial-setup.sh
@@ -0,0 +1,163 @@
+#!/usr/bin/env bash
+
+set -e
+RED='\033[0;31m'
+NC='\033[0m'
+GREEN='\033[0;32m'
+CONFIG_FILE=$1
+CURRENT_CONTEXT=$(kubectl config current-context)
+CURRENT_PROJECT_ID=$(gcloud config get-value project 2>/dev/null)
+CLUSTER_NAME=$(echo "$CURRENT_CONTEXT" | awk -F '_' '{print $NF}')
+TRIMMED_CLUSTER_NAME=$(echo "$CLUSTER_NAME" | cut -c 1-8)
+
+
+echo "Current cluster name is: $CLUSTER_NAME"
+echo "Current trimmed cluster name is: $TRIMMED_CLUSTER_NAME"
+
+echo "This script must be run only once for a new bundler deployment in the namespace"
+
+# Check if the required arguments are passed
+# Example: sh install-release-cloud.sh configs/testing.cfg
+if [ "$#" -ne 1 ]; then
+ echo " ${RED} Usage: $0 for deployment ${NC}"
+ exit 1
+fi
+
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
+if [ ! -f "$DIR/$CONFIG_FILE" ]; then
+ echo "Error: Configuration file $DIR/$CONFIG_FILE not found. Choose from configs present in configs"
+ exit 1
+fi
+
+if [ ! -r "$DIR/$CONFIG_FILE" ]; then
+ echo "${RED} Error: Configuration file ${DIR}/${CONFIG_FILE} not readable. ${NC}"
+ exit 1
+fi
+
+# Load the configuration variables
+# shellcheck disable=SC1090
+source "$DIR/$CONFIG_FILE"
+# Sourced varaibles
+# NAMESPACE
+# PROJECT_ID
+# IMAGE
+# IMAGE_TAG
+# DNS_NAME
+# IP_NAME
+# CHAINS_CFG_FILENAME
+# CONTEXT
+# SIMULATION_DATA_JSON
+# TOKEN_PRICE_JSON
+# SLACK_JSON
+# PROVIDER_JSON
+# DATASOURCES_JSON
+# SOCKET_SERVICE_JSON
+# QUEUE_URL
+
+# Check if the current context matches the one you're looking for
+if [[ "$CURRENT_CONTEXT" == "$CONTEXT" ]]; then
+ echo "Context matches. Continuing..."
+ # Add your script logic here that should run when contexts match
+else
+ echo "Context does not match. Exiting..."
+ exit 1
+fi
+
+# Fetch the current project ID from gcloud
+
+# Check if the project IDs match
+if [[ "$CURRENT_PROJECT_ID" != "$PROJECT_ID" ]]; then
+ echo "${RED} Setting GCP PROJECT_ID to ${PROJECT_ID} ${NC}"
+ gcloud config set project "${PROJECT_ID}"
+fi
+
+# Check if IP exists
+IP_EXISTS=$(gcloud compute addresses list --filter="name=$IP_NAME" --global --format="get(name)")
+
+# If IP doesn't exist, create a new one
+if [ -z "$IP_EXISTS" ]; then
+ echo "Global IP with name $IP_NAME doesn't exist creating it now"
+ gcloud compute addresses create "$IP_NAME" \
+ --network-tier=PREMIUM \
+ --ip-version=IPV4 \
+ --global
+else
+ echo "Global IP with name $IP_NAME already exists."
+fi
+
+# Fetch and print the actual IP address
+ACTUAL_IP=$(gcloud compute addresses describe "$IP_NAME" --global --format="get(address)")
+# shellcheck disable=SC2059
+printf "${GREEN} The IP address for $IP_NAME is: $ACTUAL_IP ${NC}\n"
+
+# shellcheck disable=SC2059
+printf "${GREEN} Make sure you have added an A record against ${DNS_NAME} with ${ACTUAL_IP} ${NC}\n"
+
+
+if ! kubectl get namespace "$NAMESPACE"; then
+ # shellcheck disable=SC2059
+ printf "NAMESPACE ${NAMESPACE} doesnt exists, creating it now."
+ kubectl create ns "${NAMESPACE}"
+else
+ # shellcheck disable=SC2059
+ printf "${GREEN} SUCCESS: NAMESPACE $NAMESPACE exists ${NC}"
+fi
+
+
+# shellcheck disable=SC1091
+source "setup-scripts/create-variables.sh" "$DIR/$CONFIG_FILE"
+echo ""
+echo "Created variables:"
+echo "CURRENT_CONTEXT=${CURRENT_CONTEXT}"
+echo "CLUSTER_NAME=${CLUSTER_NAME}"
+echo "TRIMMED_CLUSTER_NAME=${TRIMMED_CLUSTER_NAME}"
+echo "TRIMMED_NAMESPACE=${TRIMMED_NAMESPACE}"
+echo "GCP_IAM_ROLE=${GCP_IAM_ROLE}"
+echo "GCP_ENCRYPTED_CONFIG_SECRET=${GCP_ENCRYPTED_CONFIG_SECRET}"
+echo "GCP_PLAINTEXT_CONFIG_SECRET=${GCP_PLAINTEXT_CONFIG_SECRET}"
+echo "SECRET_NAME=${SECRET_NAME}"
+echo "KUBE_SERVICE_ACCOUNT=${KUBE_SERVICE_ACCOUNT}"
+
+
+if gcloud secrets describe "${GCP_PLAINTEXT_CONFIG_SECRET}" &> /dev/null; then
+ echo "Secret ${GCP_PLAINTEXT_CONFIG_SECRET} already exists."
+else
+ echo "GCP Secret ${GCP_PLAINTEXT_CONFIG_SECRET} does not exist."
+ if gcloud secrets create "${GCP_PLAINTEXT_CONFIG_SECRET}" \
+ --replication-policy="automatic" ; then
+ echo "Secret ${GCP_PLAINTEXT_CONFIG_SECRET} created successfully."
+ else
+ echo "Failed to create secret ${GCP_PLAINTEXT_CONFIG_SECRET}."
+ fi
+fi
+
+##This will create a configMap from the config.json.enc and that will be mounted on
+## all the pods in a namespace. The assumption is that a single namespace will only
+## have two deployments paymaster and bundler thats why
+# for bundler the configMap name will be bundler-common-configMap
+
+bash setup-scripts/create-encrypted-config-secret.sh "$GCP_ENCRYPTED_CONFIG_SECRET"
+bash setup-scripts/create-secret.sh "$SECRET_NAME"
+bash setup-scripts/create-gcp-role.sh "$PROJECT_ID" "$GCP_IAM_ROLE" "$GCP_ENCRYPTED_CONFIG_SECRET" "$SECRET_NAME"
+bash setup-scripts/gcp-role-binding.sh "$NAMESPACE" "$PROJECT_ID" "$GCP_IAM_ROLE" "$KUBE_SERVICE_ACCOUNT"
+exit
+REDIS_MASTER_REPLICA=1
+REDIS_READ_REPLICA=2
+sh install-redis/install.sh "${NAMESPACE}" "${REDIS_MASTER_REPLICA}" "${REDIS_READ_REPLICA}"
+
+RABBITMQ_REPLICA_COUNT=3
+sh install-rabbitmq/install.sh "${NAMESPACE}" "${RABBITMQ_REPLICA_COUNT}"
+
+sh install-mongo/install.sh "${NAMESPACE}"
+
+CENTRIFUGO_REPLICA_COUNT=3
+sh install-centrifugo/install.sh "${NAMESPACE}" "${CENTRIFUGO_REPLICA_COUNT}"
+
+# sh install-prometheus/install.sh
+# bash install-prometheus-adapter/install.sh $ENV $NAMESPACE "$CHAINS_CFG_FILENAME"
+echo "$CHAINS_CFG_FILENAME"
+bash network/install.sh "${NAMESPACE}" "${DNS_NAME}" "${IP_NAME}" "${CHAINS_CFG_FILENAME}"
+
+# sh install-grafana/install.sh $ENV $NAMESPACE
diff --git a/install-bundler/bundler-update-release.sh b/install-bundler/bundler-update-release.sh
new file mode 100755
index 00000000..008c8988
--- /dev/null
+++ b/install-bundler/bundler-update-release.sh
@@ -0,0 +1,46 @@
+#!/usr/bin/env bash
+set -e
+
+RED='\033[0;31m'
+NC='\033[0m'
+
+CONFIG_FILE=$1
+CONTAINER_IMAGE_TAG=$2
+
+echo "Running script $0"
+
+GIT_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
+echo "GIT_ROOT is ${GIT_ROOT}"
+CONFIG_FILE_PATH="${GIT_ROOT}/install-bundler/configs/${CONFIG_FILE}"
+echo "CONFIG_FILE_PATH is ${CONFIG_FILE_PATH}"
+echo ls -l "${GIT_ROOT}"/install-bundler/configs/
+ls -l "${GIT_ROOT}"/install-bundler/configs/
+git branch
+
+# Check if the required arguments are passed
+# Example: sh install-release-cloud.sh configs/testing.cfg
+if [ "$#" -gt 2 ]; then
+ # shellcheck disable=SC2059
+ printf "${RED} Usage: $0 for deployment ${NC}\n"
+ echo "$#"
+ exit 1
+fi
+
+
+if [ ! -f "${CONFIG_FILE_PATH}" ]; then
+ echo "Error: Configuration file ${CONFIG_FILE_PATH} not found. Choose from configs present in configs"
+ exit 1
+fi
+
+if [ ! -r "${CONFIG_FILE_PATH}" ]; then
+ echo "Error: Configuration file ${CONFIG_FILE_PATH} not readable."
+ exit 1
+fi
+
+if [[ -n "${CONTAINER_IMAGE_TAG}" ]] ; then
+ echo "Setting IMAGE_TAG to ${CONTAINER_IMAGE_TAG}"
+ sed -in -E "s/(^IMAGE_TAG=)(.*)/\1${CONTAINER_IMAGE_TAG}/g" "${CONFIG_FILE_PATH}"
+fi
+
+echo "$0 calling ${GIT_ROOT}/install-bundler/bundler/install.sh ${CONFIG_FILE}"
+bash "${GIT_ROOT}"/install-bundler/bundler/install.sh "${CONFIG_FILE}"
diff --git a/install-bundler/bundler/Chart.yaml b/install-bundler/bundler/Chart.yaml
new file mode 100644
index 00000000..6e72f6cc
--- /dev/null
+++ b/install-bundler/bundler/Chart.yaml
@@ -0,0 +1,24 @@
+apiVersion: v2
+name: bundler
+description: A Helm chart for Kubernetes
+
+# A chart can be either an 'application' or a 'library' chart.
+#
+# Application charts are a collection of templates that can be packaged into versioned archives
+# to be deployed.
+#
+# Library charts provide useful utilities or functions for the chart developer. They're included as
+# a dependency of application charts to inject those utilities and functions into the rendering
+# pipeline. Library charts do not define any templates and therefore cannot be deployed.
+type: application
+
+# This is the chart version. This version number should be incremented each time you make changes
+# to the chart and its templates, including the app version.
+# Versions are expected to follow Semantic Versioning (https://semver.org/)
+version: 0.0.1
+
+# This is the version number of the application being deployed. This version number should be
+# incremented each time you make changes to the application. Versions are not expected to
+# follow Semantic Versioning. They should reflect the version the application is using.
+# It is recommended to use it with quotes.
+appVersion: "v0.0.1"
diff --git a/install-bundler/bundler/install.sh b/install-bundler/bundler/install.sh
new file mode 100755
index 00000000..e09cadaf
--- /dev/null
+++ b/install-bundler/bundler/install.sh
@@ -0,0 +1,197 @@
+#!/usr/bin/env bash
+
+CONFIG_FILE=$1
+GIT_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../.." && pwd )"
+CONFIG_FILE_PATH="${GIT_ROOT}/install-bundler/configs/${CONFIG_FILE}"
+
+echo "$0 Working with CONFIG_FILE_PATH ${CONFIG_FILE_PATH}"
+# Function to print in green
+print_green() {
+ echo -e "\033[0;32m$1\033[0m"
+}
+
+if [ ! -f "${CONFIG_FILE_PATH}" ]; then
+ echo "Error: Configuration file ${CONFIG_FILE_PATH} not found. Choose from configs present in configs"
+ exit 1
+fi
+
+# shellcheck disable=SC1091
+print_green "Loading ${CONFIG_FILE_PATH}"
+# shellcheck disable=SC1090
+source "${CONFIG_FILE_PATH}"
+echo "Sourced variables from config file:"
+echo "NAMESPACE=${NAMESPACE}"
+echo "PROJECT_ID=${PROJECT_ID}"
+echo "IMAGE=${IMAGE}"
+echo "IMAGE_TAG=${IMAGE_TAG}"
+echo "DNS_NAME=${DNS_NAME}"
+echo "IP_NAME=${IP_NAME}"
+echo "CHAINS_CFG_FILENAME=${CHAINS_CFG_FILENAME}"
+echo "CONTEXT=${CONTEXT}"
+echo ""
+
+if [[ -z "${NAMESPACE}" ]] ; then
+ echo "Required configuration variable NAMESPACE was not specified"
+ exit 1
+elif [[ -z "${PROJECT_ID}" ]] ; then
+ echo "Required configuration variable PROJECT_ID was not specified"
+ exit 1
+elif [[ -z "${IMAGE}" ]] ; then
+ echo "Required configuration variable IMAGE was not specified"
+ exit 1
+elif [[ -z "${IMAGE_TAG}" ]] ; then
+ echo "Required configuration variable IMAGE_TAG was not specified"
+ exit 1
+elif [[ -z "${DNS_NAME}" ]] ; then
+ echo "Required configuration variable DNS_NAME was not specified"
+ exit 1
+elif [[ -z "${IP_NAME}" ]] ; then
+ echo "Required configuration variable IP_NAME was not specified"
+ exit 1
+elif [[ -z "${CHAINS_CFG_FILENAME}" ]] ; then
+ echo "Required configuration variable CHAINS_CFG_FILENAME was not specified"
+ exit 1
+elif [[ -z "${CONTEXT}" ]] ; then
+ echo "Required configuration variable CONTEXT was not specified"
+ exit 1
+else
+ echo "All required config variables were specified"
+ echo ""
+fi
+
+echo ""
+echo "Setting default project to ${PROJECT_ID}"
+gcloud config set project "${PROJECT_ID}"
+
+CURRENT_CONTEXT=$(kubectl config current-context)
+if [[ "${CURRENT_CONTEXT}" != "${CONTEXT}" ]] ; then
+ echo "Setting kubectl context to ${CONTEXT}"
+ kubectl config use-context "${CONTEXT}"
+else
+ echo "Kubectl context is ${CONTEXT}"
+fi
+
+print_green "Loading ${GIT_ROOT}/install-bundler/setup-scripts/create-variables.sh"
+# shellcheck disable=SC1091
+source "${GIT_ROOT}/install-bundler/setup-scripts/create-variables.sh" "${CONFIG_FILE_PATH}"
+echo "Created variables:"
+echo "CURRENT_CONTEXT=${CURRENT_CONTEXT}"
+echo "CLUSTER_NAME=${CLUSTER_NAME}"
+echo "TRIMMED_CLUSTER_NAME=${TRIMMED_CLUSTER_NAME}"
+echo "TRIMMED_NAMESPACE=${TRIMMED_NAMESPACE}"
+echo "GCP_IAM_ROLE=${GCP_IAM_ROLE}"
+echo "GCP_ENCRYPTED_CONFIG_SECRET=${GCP_ENCRYPTED_CONFIG_SECRET}"
+echo "GCP_PLAINTEXT_CONFIG_SECRET=${GCP_PLAINTEXT_CONFIG_SECRET}"
+echo "SECRET_NAME=${SECRET_NAME}"
+echo "KUBE_SERVICE_ACCOUNT=${KUBE_SERVICE_ACCOUNT}"
+echo ""
+
+
+echo ""
+echo "Getting config values from GCP secret ${GCP_PLAINTEXT_CONFIG_SECRET}"
+# when gcloud commands are run in githubaction always specify --project because
+# it has the highest level of precedence
+GCP_SECRET_CONFIG_VALUE=$(gcloud secrets versions access latest \
+ --secret="${GCP_PLAINTEXT_CONFIG_SECRET}"\
+ --project="${PROJECT_ID}")
+
+if [[ -z "${GCP_SECRET_CONFIG_VALUE}" ]] ; then
+ msj=""
+ msj="GCP_SECRET_CONFIG_VALUE can't be empty string."
+ msj="${msj} Please make sure that secret named ${GCP_PLAINTEXT_CONFIG_SECRET} has data"
+ echo "${msj}"
+ exit 1
+fi
+
+if ! kubectl get namespace "${NAMESPACE}"; then
+ echo "Error: ${NAMESPACE} doesnt exists, creating it now"
+ kubectl create ns "${NAMESPACE}"
+else
+ # shellcheck disable=SC2059
+ printf "${GREEN} SUCCESS: ${NAMESPACE} exists ${NC}\n"
+fi
+
+# TODO: Add 2 more variables in chains.sh: memory and CPU, and pass those to helm
+# TODO: rm printing of passwords to stdout
+
+HELM_RELEASE="bundler";
+SECONDS=0 # reset the SECONDS counter
+
+echo "Starting helm deployment"
+
+##Reading the relevant*-chains.sh under thechains folder in which all the chians are defined.
+print_green "Loading ${GIT_ROOT}/install-bundler/configs/chains/$CHAINS_CFG_FILENAME"
+# old source "./configs/chains/$CHAINS_CFG_FILENAME"
+# shellcheck disable=SC1090
+source "${GIT_ROOT}/install-bundler/configs/chains/$CHAINS_CFG_FILENAME"
+# example of sourced variables
+# declare -A chain_mumbai=(
+# [name]='chain-80001'
+# [chainId]="80001"
+# [autoScalingThreshholdHTTPRequestsPerMinute]=10000
+# [autoScalingThreshholdCPU]=2500m
+# [minReplica]=8
+# [maxReplica]=8
+# )
+
+array_names=$(declare -p | grep -Eo 'chain_[a-zA-Z0-9_]+')
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
+for array_name in $array_names; do
+ # shellcheck disable=SC1087
+ eval "NAME=\${$array_name[name]}"
+ # Using indirect referencing to get the "network" value of the current array
+ # shellcheck disable=SC1087
+ eval "CHAIN_ID=\${$array_name[chainId]}"
+ # shellcheck disable=SC1087
+ eval "AUTOSCALING_THRESHHOLD_HTTP_REQUESTS_PER_MINUTE=\${$array_name[autoScalingThreshholdHTTPRequestsPerMinute]}"
+ # shellcheck disable=SC1087
+ eval "AUTOSCALING_THRESHHOLD_CPU=\${$array_name[autoScalingThreshholdCPU]}"
+ # shellcheck disable=SC1087
+ eval "MIN_REPLICA=\${$array_name[minReplica]}"
+ # shellcheck disable=SC1087
+ eval "MAX_REPLICA=\${$array_name[maxReplica]}"
+
+ ADJ_AUTOSCALING_THRESHHOLD_HTTP_REQUESTS=$(bc -l <<< "$AUTOSCALING_THRESHHOLD_HTTP_REQUESTS_PER_MINUTE/60*1000" | cut -d'.' -f1)m
+
+ echo ""
+ print_green "Name=$NAME"
+ print_green "CHAIN_ID=$CHAIN_ID"
+ print_green "AUTOSCALING_THRESHHOLD_CPU=$AUTOSCALING_THRESHHOLD_CPU"
+ print_green "MIN_REPLICA=$MIN_REPLICA"
+ print_green "MAX_REPLICA=$MAX_REPLICA"
+ print_green "ADJ_AUTOSCALING_THRESHHOLD_HTTP_REQUESTS=${ADJ_AUTOSCALING_THRESHHOLD_HTTP_REQUESTS}"
+
+ echo ""
+ echo "Deploying HELM chart for $NAME $CHAIN_ID"
+
+ # helm template "${HELM_RELEASE}-${CHAIN_ID}" "$DIR/." \
+ helm upgrade --install "${HELM_RELEASE}-${CHAIN_ID}" "$DIR/." \
+ --wait \
+ --timeout 600s \
+ --values "$DIR/values.yaml" \
+ --namespace "$NAMESPACE" \
+ --set nameOverride="$NAME" \
+ --set env="$ENV" \
+ --set environment="$environment" \
+ --set-string namespace="$NAMESPACE" \
+ --set secret.passphrase.value="$CONFIG_PASSPHRASE" \
+ --set CHAIN_ID="$CHAIN_ID" \
+ --set provider="$PROVIDER" \
+ --set prometheus.enabled=true \
+ --set hpa.average_http_requests_hpa="${ADJ_AUTOSCALING_THRESHHOLD_HTTP_REQUESTS}" \
+ --set hpa.average_cpu_hpa="$AUTOSCALING_THRESHHOLD_CPU" \
+ --set-string image.name="$IMAGE" \
+ --set-string image.tag="$IMAGE_TAG" \
+ --set-string gcpSecretManagerName="$GCP_SECRETS_MANAGER_NAME" \
+ --set-string hpa.minReplicas="$MIN_REPLICA" \
+ --set-string hpa.maxReplicas="$MAX_REPLICA" \
+ --set-string projectId="$PROJECT_ID" \
+ --set-string secretName="$SECRET_NAME" \
+ --set-string configSecretName="$GCP_ENCRYPTED_CONFIG_SECRET" \
+ --set-string plainConfigSecretName="$GCP_PLAINTEXT_CONFIG_SECRET" \
+ --set-string serviceAccount="$KUBE_SERVICE_ACCOUNT" \
+ --set datadog.enable=true \
+ --set-string datadog.env="bundler-$NAMESPACE" \
+ --set-string datadog.service="bundler-$NAMESPACE-$CHAIN_ID"
+done
diff --git a/install-bundler/bundler/pre-install.sh b/install-bundler/bundler/pre-install.sh
new file mode 100644
index 00000000..3cb82d71
--- /dev/null
+++ b/install-bundler/bundler/pre-install.sh
@@ -0,0 +1,15 @@
+
+
+NAMESPACE=$1
+PROJECT_ID=$2
+SECRET_NAME=$3
+GCP_SERVICE_ACCOUNT=$4
+PASSPHRASE=$5
+
+
+gcloud iam service-accounts create $GCP_SERVICE_ACCOUNT --display-name="Read secrets service account in $NAMESPACE for bundler"
+
+echo "CONFIG_PASSPHRASE=$PASSPHRASE" | gcloud secrets create $SECRET_NAME --data-file=-
+gcloud secrets add-iam-policy-binding $SECRET_NAME \
+ --member=serviceAccount:$GCP_SERVICE_ACCOUNT@$PROJECT_ID.iam.gserviceaccount.com \
+ --role='roles/secretmanager.secretAccessor'
\ No newline at end of file
diff --git a/install-bundler/bundler/templates/_helpers.tpl b/install-bundler/bundler/templates/_helpers.tpl
new file mode 100644
index 00000000..0f703d98
--- /dev/null
+++ b/install-bundler/bundler/templates/_helpers.tpl
@@ -0,0 +1,271 @@
+{{/*
+Expand the name of the chart.
+*/}}
+{{ define "chart.name" }}
+{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
+{{- end }}
+
+
+{{- define "selectServer" -}}
+{{- if eq .Values.env "production" -}}
+https://acme-v02.api.letsencrypt.org/directory
+{{- else -}}
+https://acme-staging-v02.api.letsencrypt.org/directory
+{{- end -}}
+{{- end -}}
+
+
+
+
+{{/*
+DD-Trace lables and annotations
+*/}}
+{{- define "datadog.datatrace" }}
+tags.datadoghq.com/env: {{ .Values.datadog.env }}
+tags.datadoghq.com/service: {{ .Values.datadog.service }}
+tags.datadoghq.com/version: {{ .Values.datadog.version }}
+{{- end }}
+
+{{- define "datadog.datatrace-admission" }}
+# Enable Admission Controller to mutate new pods part of this deployment
+admission.datadoghq.com/enabled: "true"
+{{ if and .Values.datadog.enable (eq .Values.datadog.gke_cluster_type "standard") }}
+admission.datadoghq.com/config.mode: socket
+# https://docs.datadoghq.com/containers/cluster_agent/admission_controller/?tab=helm#configure-apm-and-dogstatsd-communication-mode
+{{- else if and .Values.datadog.enable (eq .Values.datadog.gke_cluster_type "autopilot") -}}
+# gke autopilot cluster
+{{- end }}
+{{- end }}
+
+{{/*
+Create a default fully qualified app name.
+We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
+If release name contains chart name it will be used as a full name.
+*/}}
+{{- define "chart.fullname" -}}
+{{- if .Values.fullnameOverride }}
+{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
+{{- else }}
+{{- $name := default .Chart.Name .Values.nameOverride }}
+{{- if contains $name .Release.Name }}
+{{- .Release.Name | trunc 63 | trimSuffix "-" }}
+{{- else }}
+{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
+{{- end }}
+{{- end }}
+{{- end }}
+
+
+{{- define "chart.namespace" -}}
+ {{- if .Values.namespace -}}
+ {{- .Values.namespace -}}
+ {{- else -}}
+ {{- .Release.Namespace -}}
+ {{- end -}}
+{{- end -}}
+
+
+{{/*
+Common labels
+*/}}
+{{- define "chart.labels" }}
+helm.sh/chart: {{ include "chart.name" . }}
+{{ include "chart.selectorLabels" . }}
+{{- if .Chart.AppVersion }}
+app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
+{{- end }}
+app.kubernetes.io/managed-by: {{ .Release.Service }}
+{{ end }}
+
+
+{{/*
+Create the name of the service account to use
+*/}}
+{{- define "chart.serviceAccountName" -}}
+{{- if .Values.serviceAccount.create }}
+{{- default (include "chart.fullname" .) .Values.serviceAccount.name }}
+{{- else }}
+{{- default "default" .Values.serviceAccount.name }}
+{{- end }}
+{{- end }}
+
+{{/*
+Selector labels
+*/}}
+{{- define "chart.selectorLabels" }}
+app.kubernetes.io/name: {{ include "chart.name" . }}
+app.kubernetes.io/instance: {{ .Release.Name }}
+app: {{ include "chart.name" . }}
+{{- end }}
+
+{{/*
+Define metadata for configmap.
+*/}}
+{{- define "chart.staticconfigmap.metadata" -}}
+name: {{ include "chart.name" . }}-env-configmap
+namespace: {{ include "chart.namespace" . }}
+labels:
+{{ include "chart.labels" . | nindent 2 }}
+{{- end }}
+
+{{- define "chart.serviceaccount.name" -}}
+
+ {{ include "chart.namespace" .}}-service-account
+{{- end }}
+
+{{- define "chart.serviceaccount.metadata" -}}
+name: {{ include "chart.serviceaccount.name" . }}
+namespace: {{ include "chart.namespace" . }}
+labels:
+{{ include "chart.labels" . | nindent 2 }}
+
+{{- end }}
+
+{{- define "chart.secret.name" -}}
+{{ include "chart.name" . }}-passphrase
+{{- end }}
+
+{{/*
+Define metadata for chart secret.
+*/}}
+{{- define "chart.secret.metadata" -}}
+name: {{ include "chart.secret.name" . }}
+namespace: {{ include "chart.namespace" . }}
+labels:
+{{ include "chart.labels" . | nindent 2 }}
+{{- end }}
+
+
+
+
+{{/*
+Define metadata for chart pod.
+*/}}
+{{- define "chart.pod.metadata" -}}
+name: {{ include "chart.name" . }}-r
+namespace: {{ include "chart.namespace" . }}
+labels:
+{{ include "chart.labels" . | nindent 2 }}
+{{- end }}
+
+{{/*****************************************************************************/}}
+
+
+{{/************************* Stateful set *******************************/}}
+{{/*
+Define metadata for statefulset.
+*/}}
+
+{{- define "chart.statefulset.name" -}}
+{{ include "chart.name" . }}-statefulset
+{{- end }}
+
+
+{{- define "chart.statefulset.metadata" -}}
+name: {{ include "chart.statefulset.name" . }}
+namespace: {{ include "chart.namespace" . }}
+
+labels:
+{{- include "chart.labels" . | nindent 2 -}}
+{{- if .Values.datadog.enable }}
+{{ include "datadog.datatrace" . }}
+{{- end }}
+{{- end }}
+
+{{- define "chart.template.metadata.labels" -}}
+app.kubernetes.io/name: {{ include "chart.name" . }}
+app.kubernetes.io/instance: {{ .Release.Name }}
+app: {{ include "chart.name" . }}
+namespace: {{ include "chart.namespace" . }}
+{{- if .Values.datadog.enable -}}
+{{ include "datadog.datatrace" . }}
+{{ include "datadog.datatrace-admission" . }}
+{{- end }}
+{{- end }}
+
+
+
+{{/*
+Define annotations for statefulset's template.metadata
+*/}}
+{{- define "chart.template.metadata.annotations" -}}
+{{- if .Values.datadog.enable }}
+# https://github.com/DataDog/dd-trace-js/releases
+admission.datadoghq.com/js-lib.version: {{ .Values.datadog.dd_js_lib_version }}
+ad.datadoghq.com/nginx.logs: '[{"source": {{ include "chart.name" . }}-pod, "service":"webapp"}]'
+
+{{- end }}
+releaseTime: {{ dateInZone "2006-01-02 15:04:05Z" (now) "UTC"| quote }}
+{{- if .Values.prometheus.enabled }}
+prometheus.io/scrape: "true"
+prometheus.io/path: /metrics
+prometheus.io/port: "3000"
+{{- end }}
+{{- end }}
+
+
+
+{{/*********************************************************************/}}
+{{/************************ Ingress *************************/}}
+
+
+
+{{/*
+Define metadata for datadog configmap.
+*/}}
+{{- define "chart.datadogconfigmap.metadata" -}}
+name: {{ include "chart.name" . }}-datadogconfigmap
+namespace: {{ include "chart.namespace" . }}
+{{- end }}
+
+{{- define "chart.ingress.metadata" -}}
+name: {{ include "chart.name" . }}-ingress
+namespace: {{ include "chart.namespace" . }}
+labels:
+{{ include "chart.labels" . | nindent 2 }}
+{{- end }}
+{{/************************* Done *******************************/}}
+
+{{/************************* Prometheus *******************************/}}
+
+{{- define "chart.adapter.metadata" -}}
+name: {{ include "chart.name" . }}-adapter-configmap
+namespace: {{ include "chart.namespace" . }}
+labels:
+{{ include "chart.labels" . | nindent 2 }}
+{{- end }}
+
+{{/************************* Done *******************************/}}
+
+{{/************************* HPA *******************************/}}
+{{- define "chart.hpa.name" -}}
+{{ include "chart.name" . }}-hpa
+{{- end }}
+
+{{- define "chart.hpa.metadata" -}}
+name: {{ include "chart.hpa.name" . }}
+namespace: {{ include "chart.namespace" . }}
+chainId: {{.Values.CHAIN_ID}}
+labels:
+{{ include "chart.labels" . | nindent 2 }}
+{{- end }}
+
+
+{{/************************* Service *******************************/}}
+
+{{/*
+Define metadata for service.
+*/}}
+{{- define "chart.service.name" -}}
+{{ include "chart.name" . }}-service
+{{- end }}
+
+
+{{- define "chart.service.metadata" -}}
+name: {{ include "chart.service.name" . }}
+namespace: {{ include "chart.namespace" . }}
+labels:
+{{ include "chart.labels" . | nindent 2 }}
+annotations:
+ cloud.google.com/neg: '{"ingress": true}'
+{{- end }}
diff --git a/install-bundler/bundler/templates/configmap-dd.yaml b/install-bundler/bundler/templates/configmap-dd.yaml
new file mode 100644
index 00000000..e92d4c67
--- /dev/null
+++ b/install-bundler/bundler/templates/configmap-dd.yaml
@@ -0,0 +1,18 @@
+{{- if .Values.datadog.enable }}
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ {{ include "chart.datadogconfigmap.metadata" . | nindent 2 }}
+
+data:
+ DD_TRACE_AGENT_URL: "unix:///var/run/datadog/apm.socket"
+ DD_ENV: {{ .Values.datadog.env }}
+ DD_SERVICE: {{ .Values.datadog.service }}
+ DD_VERSION: {{ .Values.datadog.version }}
+ DD_TRACE_DEBUG: {{ .Values.datadog.configs.DD_TRACE_DEBUG | quote }}
+ DD_TRACE_STARTUP_LOGS: {{ .Values.datadog.configs.DD_TRACE_STARTUP_LOGS | quote }}
+ DD_PROFILING_ENABLED: {{ .Values.datadog.configs.DD_PROFILING_ENABLED | quote }}
+ DD_LOGS_INJECTION: {{ .Values.datadog.configs.DD_LOGS_INJECTION | quote }}
+ DD_RUNTIME_METRICS_ENABLED: {{ .Values.datadog.configs.DD_RUNTIME_METRICS_ENABLED | quote }}
+
+{{- end }}
\ No newline at end of file
diff --git a/install-bundler/bundler/templates/envConfigMap.yaml b/install-bundler/bundler/templates/envConfigMap.yaml
new file mode 100644
index 00000000..a284ca64
--- /dev/null
+++ b/install-bundler/bundler/templates/envConfigMap.yaml
@@ -0,0 +1,9 @@
+apiVersion: v1
+kind: ConfigMap
+metadata: {{ include "chart.staticconfigmap.metadata" . | nindent 2 }}
+data:
+ BUNDLER_CHAIN_ID: "{{ .Values.CHAIN_ID }}"
+ DD_PROFILING_ENABLED: "false"
+ DD_ENV: "bundler-tw-staging"
+ DD_SERVICE: {{ .Values.datadog.service }}
+ DD_VERSION: "1.0.3"
diff --git a/install-bundler/bundler/templates/hpa.yaml b/install-bundler/bundler/templates/hpa.yaml
new file mode 100644
index 00000000..0032a760
--- /dev/null
+++ b/install-bundler/bundler/templates/hpa.yaml
@@ -0,0 +1,42 @@
+apiVersion: autoscaling/v2
+kind: HorizontalPodAutoscaler
+metadata:
+ # name: sample-app
+{{ include "chart.hpa.metadata" . | nindent 2 }}
+
+spec:
+ scaleTargetRef:
+ # point the HPA at the sample application
+ # you created above
+ apiVersion: apps/v1
+ kind: StatefulSet
+ name: {{ include "chart.statefulset.name" .}}
+
+ # autoscale between 1 and 10 replicas
+ minReplicas: {{.Values.hpa.minReplicas}}
+ maxReplicas: {{.Values.hpa.maxReplicas}}
+ metrics:
+ # use a "Pods" metric, which takes the average of the
+ # given metric across all pods controlled by the autoscaling target
+ - type: Pods
+ pods:
+ # use the metric that you used above: pods/http_requests
+ metric:
+ name: {{.Values.CHAIN_ID}}-http-requests
+ # target 500 milli-requests per second,
+ # which is 1 request every two seconds
+ # http_requests_per_two_minute metric goes beyond 100,
+ # then you should set the averageValue for that metric
+ # to 100 (or 100000m, as 1 = 1000m).
+ target:
+ type: AverageValue
+ averageValue: {{.Values.hpa.average_http_requests_hpa}}
+
+
+ - type: Pods
+ pods:
+ metric:
+ name: {{.Values.CHAIN_ID}}-cpu-usage
+ target:
+ type: AverageValue
+ averageValue: {{.Values.hpa.average_cpu_hpa}} # Adjust the averageValue as per your requirements.
\ No newline at end of file
diff --git a/install-bundler/bundler/templates/secret.yaml b/install-bundler/bundler/templates/secret.yaml
new file mode 100644
index 00000000..06251924
--- /dev/null
+++ b/install-bundler/bundler/templates/secret.yaml
@@ -0,0 +1,13 @@
+{{- if eq .Values.env "test" }}
+
+apiVersion: v1
+kind: Secret
+metadata:
+ {{ include "chart.secret.metadata" . | nindent 2 }}
+
+type: Opaque
+data:
+ # Assuming you want to use a base64 encoded secret for local test
+ {{ .Values.secret.passphrase.name }}: {{ .Values.secret.passphrase.value | b64enc | quote }}
+
+{{- end }}
\ No newline at end of file
diff --git a/install-bundler/bundler/templates/service.yaml b/install-bundler/bundler/templates/service.yaml
new file mode 100644
index 00000000..14c0fafd
--- /dev/null
+++ b/install-bundler/bundler/templates/service.yaml
@@ -0,0 +1,11 @@
+apiVersion: v1
+kind: Service
+metadata:
+{{ include "chart.service.metadata" . | nindent 2 }}
+spec:
+ selector:
+ {{ include "chart.selectorLabels" . | nindent 4 }}
+ ports:
+ - protocol: TCP
+ port: {{ .Values.port }}
+ targetPort: {{ .Values.targetPort }}
\ No newline at end of file
diff --git a/install-bundler/bundler/templates/statefulset.yaml b/install-bundler/bundler/templates/statefulset.yaml
new file mode 100644
index 00000000..f10eb891
--- /dev/null
+++ b/install-bundler/bundler/templates/statefulset.yaml
@@ -0,0 +1,186 @@
+apiVersion: apps/v1
+kind: StatefulSet
+metadata:
+ {{- include "chart.statefulset.metadata" . | nindent 2 }}
+spec:
+ serviceName: {{ include "chart.name" . }}-service
+ # updateStrategy:
+ # type: RollingUpdate
+ # rollingUpdate:
+ # partition: 0
+
+ replicas: {{.Values.hpa.minReplicas}}
+ selector:
+ matchLabels:
+ {{ include "chart.selectorLabels" . | nindent 6 }}
+ template:
+ metadata:
+ labels:
+ {{ include "chart.template.metadata.labels" . | nindent 8 }}
+ annotations:
+ {{ include "chart.template.metadata.annotations" . | nindent 8 }}
+ name: {{ include "chart.name" . }}-pod
+ spec:
+ serviceAccountName: {{ .Values.serviceAccount}}
+ initContainers:
+ - name: fetch-gcp-secrets
+ image: google/cloud-sdk:latest
+ command:
+ - /bin/sh
+ - -c
+ - |
+ gcloud secrets versions access latest --secret="{{.Values.secretName}}" > /gcpsecrets/config-passphrase
+ gcloud secrets versions access latest --secret="{{.Values.configSecretName}}" > /gcpsecrets/config.json.enc
+ gcloud secrets versions access latest --secret="{{.Values.plainConfigSecretName}}" > /gcpsecrets/{{.Values.environment}}.json
+ volumeMounts:
+ - name: gcpsecrets
+ mountPath: /gcpsecrets
+
+ - name: init-ordinal
+ image: busybox:1.28
+ command:
+ - "sh"
+ - "-c"
+ - >
+ echo $(echo $POD_NAME | awk -F '-' '{print $NF}') > /etc/podinfo/ordinal_index;
+ export POD_INDEX=$(cat /etc/podinfo/ordinal_index);
+ export NODE_CONFIG='{"relayer": {"nodePathIndex": '$POD_INDEX'}}';
+ echo $NODE_CONFIG > /etc/podinfo/ordinal_index ;
+ env:
+ - name: POD_NAME
+ valueFrom:
+ fieldRef:
+ fieldPath: metadata.name
+ volumeMounts:
+ - name: podinfo
+ mountPath: /etc/podinfo
+
+ {{- if .Values.affinity_tolerations.enable }}
+ affinity:
+ nodeAffinity:
+ requiredDuringSchedulingIgnoredDuringExecution:
+ nodeSelectorTerms:
+ - matchExpressions:
+ - key: {{ .Values.affinity_tolerations.key }}
+ operator: In
+ values:
+ - {{ .Values.affinity_tolerations.values }}
+ tolerations:
+ - effect: NoSchedule
+ key: {{ .Values.affinity_tolerations.key }}
+ operator: Equal
+ value: {{ .Values.affinity_tolerations.values }}
+ {{- end }}
+ containers:
+ - name: {{ include "chart.name" . }}-pod
+ imagePullPolicy: {{ if eq .Values.provider "local" }} "Never" {{ else }} "IfNotPresent" {{ end }}
+ image: {{ .Values.image.name }}:{{.Values.image.tag}}
+
+ ports:
+ - containerPort: {{ .Values.targetPort }}
+
+ env:
+ - name: CHAIN_ID
+ value: {{ .Values.CHAIN_ID | quote }}
+
+ - name: NODE_ENV
+ value: {{ .Values.environment }}
+
+ envFrom:
+ {{- if and (.Values.datadog.enable) ( eq .Values.datadog.gke_cluste_type "standard") -}}
+ - configMapRef:
+ name: {{ include "chart.name" . }}-datadogconfigmap
+ {{- end }}
+
+ - configMapRef:
+ name: {{ include "chart.name" . }}-env-configmap
+
+ {{- if eq .Values.env "test" }}
+ - secretRef:
+ name: {{ include "chart.name" . }}-passphrase
+ {{- end }}
+
+ volumeMounts:
+ - mountPath: "/home/nonroot/bundler/config.json.enc"
+ name: gcpsecrets
+ subPath: "config.json.enc"
+
+ - name: gcpsecrets
+ mountPath: "/home/nonroot/bundler/config/{{.Values.environment}}.json"
+ subPath: "{{.Values.environment}}.json"
+
+ - name: gcpsecrets
+ mountPath: /gcpsecrets
+
+ - name: podinfo
+ mountPath: /etc/podinfo
+
+ {{- if and (.Values.datadog.enable) ( eq .Values.datadog.gke_cluste_type "standard") }}
+ - mountPath: /var/run/datadog
+ name: apmsocketpath
+ {{- end }}
+ resources:
+ requests:
+ memory: {{ .Values.resources.requests.memory }}
+ cpu: {{ .Values.resources.requests.cpu }}
+ limits:
+ memory: {{ .Values.resources.limits.memory }}
+ cpu: {{ .Values.resources.limits.cpu }}
+
+ startupProbe:
+ httpGet:
+ path: /health
+ port: {{ .Values.port }}
+ failureThreshold: 40
+ periodSeconds: 10
+
+ livenessProbe:
+ httpGet:
+ path: /health
+ port: {{ .Values.targetPort }}
+ initialDelaySeconds: 30
+ periodSeconds: 60
+ successThreshold: 1
+ timeoutSeconds: 30
+ failureThreshold: 5
+
+ readinessProbe:
+ httpGet:
+ path: /health
+ port: {{ .Values.targetPort }}
+ initialDelaySeconds: 10
+ periodSeconds: 15
+ successThreshold: 1
+ timeoutSeconds: 10
+ failureThreshold: 3
+
+ lifecycle:
+ # https://learnk8s.io/graceful-shutdown
+ # still server traffic for 15 seconds after k8s issued the SIG term
+ preStop:
+ exec:
+ command: ["sleep", "15"]
+
+ volumes:
+ {{- if eq .Values.env "test" }}
+
+ - name: config-volume
+ configMap:
+ name: bundler-common-configmap
+ {{- end}}
+
+ - name: env-config-volume
+ configMap:
+ name: {{ include "chart.name" . }}-env-configmap
+
+ - name: podinfo
+ emptyDir: {}
+
+ - name: gcpsecrets
+ emptyDir: { }
+
+ {{- if and (.Values.datadog.enable) ( eq .Values.datadog.gke_cluste_type "standard") }}
+ - hostPath:
+ path: /var/run/datadog/
+ name: apmsocketpath
+ {{- end }}
\ No newline at end of file
diff --git a/install-bundler/bundler/test-secret-access-on-gcp.yaml b/install-bundler/bundler/test-secret-access-on-gcp.yaml
new file mode 100644
index 00000000..3e81b629
--- /dev/null
+++ b/install-bundler/bundler/test-secret-access-on-gcp.yaml
@@ -0,0 +1,11 @@
+apiVersion: v1
+kind: Pod
+metadata:
+ name: test-gcp-access
+ namespace: trustwallet
+spec:
+ serviceAccountName: trustwal-trustwalle-prod-sa
+ containers:
+ - name: test-container
+ image: google/cloud-sdk:latest
+ command: ["/bin/sleep", "3600"]
\ No newline at end of file
diff --git a/install-bundler/bundler/values.yaml b/install-bundler/bundler/values.yaml
new file mode 100644
index 00000000..974afd4e
--- /dev/null
+++ b/install-bundler/bundler/values.yaml
@@ -0,0 +1,53 @@
+namespace: ""
+env: "test"
+hpa:
+ minReplicas: 2
+ maxReplicas: 3
+ average_http_requests_hpa: 20
+ average_cpu_hpa: 80
+
+port: "3000"
+targetPort: "3000"
+replicaCount: 2
+resources:
+ requests:
+ memory: "2500Mi"
+ cpu: "2500m"
+ limits:
+ memory: "2500Mi"
+ cpu: "2500m"
+
+# secret:
+# projectID: biconomy-test
+# key: bundlers
+# config:
+# name: config.json.enc
+
+# passphrase:
+# key: passphrase
+# name: CONFIG_PASSPHRASE
+# version: latest
+
+# datadog configs
+affinity_tolerations:
+ enable: false
+
+datadog:
+ enable: true
+ # gke_cluster_type: standard OR autopilot
+ gke_cluster_type: autopilot
+ # https://github.com/DataDog/dd-trace-js/releases
+ dd_js_lib_version: v4.18.0
+ env: "testing2"
+ service: "sdk-relayer-service"
+ version: "v3.15.0"
+ configs:
+ DD_TRACE_DEBUG: "true"
+ DD_TRACE_STARTUP_LOGS: "false"
+ DD_PROFILING_ENABLED: "true"
+ DD_LOGS_INJECTION: "false"
+ DD_RUNTIME_METRICS_ENABLED: "true"
+
+ logs:
+ enabled: false
+ containerCollectAll: false
diff --git a/install-bundler/configs/bundler-tw-production.cfg b/install-bundler/configs/bundler-tw-production.cfg
new file mode 100644
index 00000000..3a583dec
--- /dev/null
+++ b/install-bundler/configs/bundler-tw-production.cfg
@@ -0,0 +1,10 @@
+ENV=prod
+environment=production
+NAMESPACE="trustwallet"
+PROJECT_ID="prj-biconomy-prod-001"
+IMAGE="us-docker.pkg.dev/prj-biconomy-prod-001/bundler/bundler"
+IMAGE_TAG=1.5
+DNS_NAME="tw-bundler.biconomy.io"
+IP_NAME="trustwallet"
+CHAINS_CFG_FILENAME="prod-trust-wallet-chains.sh"
+CONTEXT="gke_prj-biconomy-prod-001_us-central1_trustwallet"
\ No newline at end of file
diff --git a/install-bundler/configs/bundler-tw-staging.cfg b/install-bundler/configs/bundler-tw-staging.cfg
new file mode 100644
index 00000000..459b5d10
--- /dev/null
+++ b/install-bundler/configs/bundler-tw-staging.cfg
@@ -0,0 +1,10 @@
+ENV=staging
+environment=staging
+NAMESPACE="bundler-tw-staging"
+PROJECT_ID="biconomy-prod"
+IMAGE="us-docker.pkg.dev/biconomy-prod/bundler/trustwallet"
+IMAGE_TAG=8d544d0
+DNS_NAME="bundler-tw-staging.biconomy.io"
+IP_NAME="bundler-tw-staging"
+CHAINS_CFG_FILENAME="staging-trust-wallet-chains.sh"
+CONTEXT="gke_biconomy-prod_us-east1_dedicated-bundler"
\ No newline at end of file
diff --git a/install-bundler/configs/chains/prod-trust-wallet-chains.sh b/install-bundler/configs/chains/prod-trust-wallet-chains.sh
new file mode 100644
index 00000000..9f2c7c77
--- /dev/null
+++ b/install-bundler/configs/chains/prod-trust-wallet-chains.sh
@@ -0,0 +1,73 @@
+
+# declare -A chain_mumbai=(
+# [name]='chain-80001'
+# [chainId]="80001"
+# [autoScalingThreshholdHTTPRequestsPerMinute]=1000
+# [autoScalingThreshholdCPU]=800m
+# [minReplica]=1
+# [maxReplica]=20
+# )
+
+# declare -A chain_bnb=(
+# [name]='chain-56'
+# [chainId]="56"
+# [autoScalingThreshholdHTTPRequestsPerMinute]=1000
+# [autoScalingThreshholdCPU]=800m
+# [minReplica]=6
+# [maxReplica]=6
+# )
+
+declare -A chain_polygon=(
+ [name]='chain-137'
+ [chainId]="137"
+ [autoScalingThreshholdHTTPRequestsPerMingute]=1000
+ [autoScalingThreshholdCPU]=800m
+ [minReplica]=6
+ [maxReplica]=6)
+
+
+# declare -A chain_arbitrum=(
+# [name]='chain-42161'
+# [chainId]="42161"
+# [autoScalingThreshholdHTTPRequestsPerMinute]=1000
+# [autoScalingThreshholdCPU]=800m
+# [minReplica]=3
+# [maxReplica]=3
+# )
+
+
+# declare -A chain_avalanche=(
+# [name]='chain-43114'
+# [chainId]="43114"
+# [autoScalingThreshholdHTTPRequestsPerMinute]=1000
+# [autoScalingThreshholdCPU]=800m
+# [minReplica]=3
+# [maxReplica]=3
+# )
+
+# declare -A chain_opBNB=(
+# [name]='chain-204'
+# [chainId]="204"
+# [autoScalingThreshholdHTTPRequestsPerMinute]=1000
+# [autoScalingThreshholdCPU]=900m
+# [minReplica]=3
+# [maxReplica]=3
+# )
+
+# declare -A chain_base=(
+# [name]='chain-8453'
+# [chainId]="8453"
+# [autoScalingThreshholdHTTPRequestsPerMinute]=1000
+# [autoScalingThreshholdCPU]=800m
+# [minReplica]=3
+# [maxReplica]=3
+# )
+
+# declare -A chain_optimism=(
+# [name]='chain-10'
+# [chainId]="10"
+# [autoScalingThreshholdHTTPRequestsPerMinute]=1000
+# [autoScalingThreshholdCPU]=800m
+# [minReplica]=3
+# [maxReplica]=3
+# )
\ No newline at end of file
diff --git a/install-bundler/configs/chains/staging-trust-wallet-chains.sh b/install-bundler/configs/chains/staging-trust-wallet-chains.sh
new file mode 100644
index 00000000..a7087db4
--- /dev/null
+++ b/install-bundler/configs/chains/staging-trust-wallet-chains.sh
@@ -0,0 +1,9 @@
+
+# declare -A chain_mumbai=(
+# [name]='chain-80001'
+# [chainId]="80001"
+# [autoScalingThreshholdHTTPRequestsPerMinute]=10000
+# [autoScalingThreshholdCPU]=2500m
+# [minReplica]=2
+# [maxReplica]=2
+# )
\ No newline at end of file
diff --git a/install-bundler/configs/chains/test-chains.sh b/install-bundler/configs/chains/test-chains.sh
new file mode 100644
index 00000000..aeae34de
--- /dev/null
+++ b/install-bundler/configs/chains/test-chains.sh
@@ -0,0 +1,13 @@
+
+declare -A chain_mumbai=(
+ [name]='chain-80001'
+ [chainId]="80001"
+ [autoScalingThreshholdHTTPRequestsPerMinute]=10000
+ [autoScalingThreshholdCPU]=2500m
+ [minRelayerCount]="200"
+ [maxRelayerCount]="220"
+ [fundingBalanceThreshold]="1"
+ [fundingRelayerAmount]="2"
+ [minReplica]=6
+ [maxReplica]=9
+)
\ No newline at end of file
diff --git a/install-bundler/configs/example.cfg b/install-bundler/configs/example.cfg
new file mode 100644
index 00000000..2ae56bb7
--- /dev/null
+++ b/install-bundler/configs/example.cfg
@@ -0,0 +1,17 @@
+ENV="prod"
+NAMESPACE="bundlerprod"
+PROJECT_ID="prj-biconomy-prod-001"
+IMAGE="us-docker.pkg.dev/$PROJECT_ID/bundler/bundler"
+IMAGE_TAG="0.1-testOnly"
+DNS_NAME="bundler.bico-test.uk"
+IP_NAME="bundlerprod"
+CHAINS_CFG_FILENAME="test-chains.sh"
+CONTEXT="gke_prj-biconomy-prod-001_us-central1_bundlerprod"
+SIMULATION_DATA_JSON='{"tenderlyData": {}}'
+TOKEN_PRICE_JSON='{"coinMarketCapApi": "a305bb95-7c48-4fb6-bc65-4de8c9193f2f"}'
+SLACK_JSON='{"token": "xoxb-8708217855M7XEOBb4HD","channel": "4A9077TC5"}'
+PROVIDER_JSON='{"137": "", "42161": "https://arb-ma", "56": "", "10": "", "43114": "", "8453": "", "80001": "", "204": ""}'
+DATASOURCES_JSON='{"mongoUrl": "mongodb+srv://:@/relayer-node-service", "redisUrl": "redis://:@redis-master.bundlerprod.svc.cluster.local:6379"}'
+SOCKET_SERVICE_JSON='{"wssUrl": "ws://centrifugo.bundlerprod.svc.cluster.local:9000/connection/websocket","httpUrl": "http://centrifugo.bundlerprod.svc.cluster.local:9000/api","token": "","apiKey": ""}'
+QUEUE_URL="amqp://:@rabbitmq.bundlerprod.svc.cluster.local:5672"
+
diff --git a/install-bundler/grafana.md b/install-bundler/grafana.md
new file mode 100644
index 00000000..0bca1da5
--- /dev/null
+++ b/install-bundler/grafana.md
@@ -0,0 +1,32 @@
+
+#
+Let’s assume you have two pods with names "statefulset-pod-1" and "statefulset-pod-2".
+
+If "statefulset-pod-1" has received 10 requests in the last 5 minutes, and "statefulset-pod-2"
+has received 20 requests in the last 5 minutes, then the rate function will calculate the per-second
+average rate for these two pods separately.
+
+After that, the sum by(pod) part will sum up these rates separately for each "pod" label, so you will
+ get separate sum results for "statefulset-pod-1" and "statefulset-pod-2".
+
+```
+sum by(pod) (rate(http_request_duration_seconds_bucket{pod=~".*statefulset.*"}[2m]))
+```
+
+# cpu
+```
+sum by(pod) (rate(container_cpu_usage_seconds_total{pod=~".*statefulset.*"}[2m]))
+```
+
+# http requests per pod
+
+```
+sum(rate(http_requests_total{pod=~".*statefulset.*"}[2m])) by (pod)
+```
+
+## average http requests over all pods
+ http_requests_per_two_minute metric goes beyond 100, then you should set the averageValue for that metric to 100 (or 100000m, as 1 = 1000m).
+```
+avg(rate(http_requests_total{pod=~".*statefulset.*"}[2m]))
+
+```
\ No newline at end of file
diff --git a/install-bundler/install-bundler-common/bundler-common/.helmignore b/install-bundler/install-bundler-common/bundler-common/.helmignore
new file mode 100644
index 00000000..0e8a0eb3
--- /dev/null
+++ b/install-bundler/install-bundler-common/bundler-common/.helmignore
@@ -0,0 +1,23 @@
+# Patterns to ignore when building packages.
+# This supports shell glob matching, relative path matching, and
+# negation (prefixed with !). Only one pattern per line.
+.DS_Store
+# Common VCS dirs
+.git/
+.gitignore
+.bzr/
+.bzrignore
+.hg/
+.hgignore
+.svn/
+# Common backup files
+*.swp
+*.bak
+*.tmp
+*.orig
+*~
+# Various IDEs
+.project
+.idea/
+*.tmproj
+.vscode/
diff --git a/install-bundler/install-bundler-common/bundler-common/Chart.yaml b/install-bundler/install-bundler-common/bundler-common/Chart.yaml
new file mode 100644
index 00000000..0e9fd00a
--- /dev/null
+++ b/install-bundler/install-bundler-common/bundler-common/Chart.yaml
@@ -0,0 +1,24 @@
+apiVersion: v2
+name: bundler-common
+description: A Helm chart for Kubernetes
+
+# A chart can be either an 'application' or a 'library' chart.
+#
+# Application charts are a collection of templates that can be packaged into versioned archives
+# to be deployed.
+#
+# Library charts provide useful utilities or functions for the chart developer. They're included as
+# a dependency of application charts to inject those utilities and functions into the rendering
+# pipeline. Library charts do not define any templates and therefore cannot be deployed.
+type: application
+
+# This is the chart version. This version number should be incremented each time you make changes
+# to the chart and its templates, including the app version.
+# Versions are expected to follow Semantic Versioning (https://semver.org/)
+version: 0.1.0
+
+# This is the version number of the application being deployed. This version number should be
+# incremented each time you make changes to the application. Versions are not expected to
+# follow Semantic Versioning. They should reflect the version the application is using.
+# It is recommended to use it with quotes.
+appVersion: "1.16.0"
diff --git a/install-bundler/install-bundler-common/bundler-common/templates/_helpers.tpl b/install-bundler/install-bundler-common/bundler-common/templates/_helpers.tpl
new file mode 100644
index 00000000..3f411025
--- /dev/null
+++ b/install-bundler/install-bundler-common/bundler-common/templates/_helpers.tpl
@@ -0,0 +1,56 @@
+{{/*
+Expand the name of the chart.
+*/}}
+{{- define "chart.name" -}}
+{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
+{{- end }}
+
+{{/*
+Create a default fully qualified app name.
+We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
+If release name contains chart name it will be used as a full name.
+*/}}
+{{- define "chart.fullname" -}}
+{{- if .Values.fullnameOverride }}
+{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
+{{- else }}
+{{- $name := default .Chart.Name .Values.nameOverride }}
+{{- if contains $name .Release.Name }}
+{{- .Release.Name | trunc 63 | trimSuffix "-" }}
+{{- else }}
+{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
+{{- end }}
+{{- end }}
+{{- end }}
+
+{{- define "chart.namespace" -}}
+ {{- if .Values.namespace -}}
+ {{- .Values.namespace -}}
+ {{- else -}}
+ {{- .Release.Namespace -}}
+ {{- end -}}
+{{- end -}}
+
+
+{{/*
+Common labels
+*/}}
+{{- define "chart.labels" -}}
+helm.sh/chart: {{ include "chart.name" . }}
+{{- if .Chart.AppVersion }}
+app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
+{{- end }}
+app.kubernetes.io/managed-by: {{ .Release.Service }}
+{{- end }}
+
+
+{{/*
+Define metadata for configmap.
+*/}}
+{{- define "chart.configmap.metadata" -}}
+name: {{ include "chart.name" . }}-configmap
+namespace: {{ include "chart.namespace" . }}
+labels:
+{{ include "chart.labels" . | nindent 2 }}
+{{- end }}
+
diff --git a/install-bundler/install-bundler-common/bundler-common/templates/encrptedConfigConfigmap.yaml b/install-bundler/install-bundler-common/bundler-common/templates/encrptedConfigConfigmap.yaml
new file mode 100644
index 00000000..b43fadfc
--- /dev/null
+++ b/install-bundler/install-bundler-common/bundler-common/templates/encrptedConfigConfigmap.yaml
@@ -0,0 +1,8 @@
+
+apiVersion: v1
+kind: ConfigMap
+metadata:
+{{- include "chart.configmap.metadata" . | nindent 2 }}
+
+data:
+ config.json.enc : {{ .Files.Get "files/config.json.enc" }}
diff --git a/install-bundler/install-bundler-common/install.sh b/install-bundler/install-bundler-common/install.sh
new file mode 100644
index 00000000..6aa9b152
--- /dev/null
+++ b/install-bundler/install-bundler-common/install.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+set -e
+NC='\033[0m'
+YELLOW='\033[0;33m'
+
+ENV=$1
+NAMESPACE=$2
+HELM_RELEASE="bundler-common"
+
+# Check if the required arguments are passed
+if [ "$#" -ne 2 ]; then
+ echo "Usage: $0 for Bundler common"
+ exit 1
+fi
+
+
+printf "\n${YELLOW}------ Deploying %s to %s -----${NC}\n" "$HELM_RELEASE" "$NAMESPACE"
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+helm upgrade --install --wait --timeout 720s $HELM_RELEASE "$DIR/bundler-common/" \
+ -n "$NAMESPACE" \
+ --set nameOverride=bundler-common
+
+printf "bundler-common deployment completed\n";
\ No newline at end of file
diff --git a/install-bundler/install-centrifugo/centrifugo/.helmignore b/install-bundler/install-centrifugo/centrifugo/.helmignore
new file mode 100644
index 00000000..0e8a0eb3
--- /dev/null
+++ b/install-bundler/install-centrifugo/centrifugo/.helmignore
@@ -0,0 +1,23 @@
+# Patterns to ignore when building packages.
+# This supports shell glob matching, relative path matching, and
+# negation (prefixed with !). Only one pattern per line.
+.DS_Store
+# Common VCS dirs
+.git/
+.gitignore
+.bzr/
+.bzrignore
+.hg/
+.hgignore
+.svn/
+# Common backup files
+*.swp
+*.bak
+*.tmp
+*.orig
+*~
+# Various IDEs
+.project
+.idea/
+*.tmproj
+.vscode/
diff --git a/install-bundler/install-centrifugo/centrifugo/Chart.yaml b/install-bundler/install-centrifugo/centrifugo/Chart.yaml
new file mode 100644
index 00000000..d8f9a6bb
--- /dev/null
+++ b/install-bundler/install-centrifugo/centrifugo/Chart.yaml
@@ -0,0 +1,11 @@
+apiVersion: v1
+appVersion: 5.0.4
+description: Centrifugo is a scalable real-time messaging server in language-agnostic
+ way
+home: https://centrifugal.dev
+icon: https://centrifugal.dev/img/favicon.png
+maintainers:
+- email: frvzmb@gmail.com
+ name: FZambia
+name: centrifugo
+version: 11.0.7
diff --git a/install-bundler/install-centrifugo/centrifugo/README.md b/install-bundler/install-centrifugo/centrifugo/README.md
new file mode 100644
index 00000000..bb0c990a
--- /dev/null
+++ b/install-bundler/install-centrifugo/centrifugo/README.md
@@ -0,0 +1,305 @@
+# Centrifugo
+
+This chart bootstraps a [Centrifugo](https://centrifugal.github.io/centrifugo/) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.
+
+## Prerequisites
+
+- Kubernetes 1.9+
+
+## Get Repo Info
+
+```console
+helm repo add centrifugal https://centrifugal.github.io/helm-charts
+helm repo update
+```
+
+_See [helm repo](https://helm.sh/docs/helm/helm_repo/) for command documentation._
+
+## Install Chart
+
+```console
+# Helm 3
+$ helm install [RELEASE_NAME] centrifugal/centrifugo
+
+# Helm 2
+$ helm install --name [RELEASE_NAME] centrifugal/centrifugo
+```
+
+_See [configuration](#configuration) below._
+
+_See [helm install](https://helm.sh/docs/helm/helm_install/) for command documentation._
+
+## Uninstall Chart
+
+```console
+# Helm 3
+$ helm uninstall [RELEASE_NAME]
+
+# Helm 2
+# helm delete --purge [RELEASE_NAME]
+```
+
+This removes all the Kubernetes components associated with the chart and deletes the release.
+
+_See [helm uninstall](https://helm.sh/docs/helm/helm_uninstall/) for command documentation._
+
+## Upgrading Chart
+
+```console
+# Helm 3 or 2
+$ helm upgrade [RELEASE_NAME] [CHART] --install
+```
+
+The command removes all the Kubernetes components associated with the chart and deletes the release.
+
+## Parameters
+
+The following table lists the configurable parameters of the Centrifugo chart and their default values.
+
+| Parameter | Description | Default |
+|---------------------------------------------|----------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------|
+| `global.imageRegistry` | Global Docker Image registry | `nil` |
+| `global.imagePullSecrets` | Global Docker registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) |
+### Common parameters
+
+| Parameter | Description | Default |
+|---------------------------------------------|----------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------|
+| `nameOverride` | String to partially override centrifugo.fullname | `nil` |
+| `fullnameOverride` | String to fully override centrifugo.fullname | `nil` |
+
+### Centrifugo common parameters
+
+| Parameter | Description | Default |
+|---------------------------------------------|-------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------|
+| `image.registry` | Centrifugo image registry | `docker.io` |
+| `image.repository` | Centrifugo image name | `centrifugo/centrifugo` |
+| `image.tag` | Centrifugo image tag | Taken from chart `appVersion` |
+| `image.pullPolicy` | Centrifugo image pull policy | `IfNotPresent` |
+| `image.pullSecrets` | Specify docker-registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) |
+| `service.type` | service type | `ClusterIP` |
+| `service.clusterIP` | service clusterIP IP | `nil` |
+| `service.port` | service port | `8000` |
+| `service.nodePort` | K8s service node port | `nil` |
+| `service.appProtocol` | Set appProtocol field for port - it could be useful for manually setting protocols for Istio | `nil` |
+| `service.useSeparateInternalService` | Use separate service for internal endpoints. It could be useful for configuring same port number for all services. | `false` |
+| `service.useSeparateGrpcService` | Use separate service for GRPC endpoints. It could be useful for configuring same port number for all services. | `false` |
+| `service.useSeparateUniGrpcService` | Use separate service for GRPC uni stream. It could be useful for configuring same port number for all services. | `false` |
+| `internalService.type` | internal (for API, Prometheus metrics, admin web interface, health checks) port service type | `ClusterIP` |
+| `internalService.clusterIP` | internal (for API, Prometheus metrics, admin web interface, health checks) service clusterIP IP | `nil` |
+| `internalService.port` | internal (for API, Prometheus metrics, admin web interface, health checks) service port | `9000` |
+| `internalService.nodePort` | internal (for API, Prometheus metrics, admin web interface, health checks) K8s service node port | `nil` |
+| `internalService.appProtocol` | Set appProtocol field for port | `nil` |
+| `grpcService.type` | GRPC API port service type | `ClusterIP` |
+| `grpcService.clusterIP` | GRPC API service clusterIP IP | `nil` |
+| `grpcService.port` | GRPC API service port | `10000` |
+| `grpcService.nodePort` | GRPC API K8s service node port | `nil` |
+| `grpcService.appProtocol` | Set appProtocol field for port | `nil` |
+| `env` | Additional environment variables to be passed to Centrifugo container. | `nil` |
+| `envSecret` | Additional secret environment variables to be passed to Centrifugo container. | `nil` |
+| `config` | Centrifugo configuration, will be transformed into config.json file | `{"admin":true,"engine":"memory","namespaces":[],"v3_use_offset":true}` |
+| `existingSecret` | Name of existing secret to use for secret's parameters. The secret has to contain the keys below | `nil` |
+| `initContainers` | Set initContainers, e.g. wait for other resources | `nil` |
+| `secrets.tokenHmacSecretKey` | Secret key for HMAC tokens. | `nil` |
+| `secrets.adminPassword` | Admin password used to protect access to web interface. | `nil` |
+| `secrets.adminSecret` | Admin secret used to create auth tokens on user login into admin web interface. | `nil` |
+| `secrets.apiKey` | Centrifugo api_key for Centrifugo API endpoint authorization. | `nil` |
+| `secrets.grpcApiKey` | Centrifugo grpc_api_key for Centrifugo GRPC API authorization. | `nil` |
+| `secrets.redisAddress` | Connection string to Redis. | `nil` |
+| `secrets.redisPassword` | Password for Redis. | `nil` |
+| `secrets.redisSentinelPassword` | Password for Redis Sentinel. | `nil` |
+| `secrets.natsUrl` | Connection string to Nats. | `nil` |
+| `secrets.license` | Centrifugo PRO license | `nil` |
+
+### Metrics parameters
+
+| Parameter | Description | Default |
+|---------------------------------------------|----------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------|
+| `metrics.enabled` | Start a side-car prometheus exporter | `false` |
+| `metrics.serviceMonitor.enabled` | Create ServiceMonitor Resource for scraping metrics using PrometheusOperator | `false` |
+| `metrics.serviceMonitor.namespace` | Namespace which Prometheus is running in | `nil` |
+| `metrics.serviceMonitor.interval` | Interval at which metrics should be scraped | `30s` |
+| `metrics.serviceMonitor.scrapeTimeout` | Specify the timeout after which the scrape is ended | `nil` |
+| `metrics.serviceMonitor.relabellings` | Specify Metric Relabellings to add to the scrape endpoint | `nil` |
+| `metrics.serviceMonitor.honorLabels` | honorLabels chooses the metric's labels on collisions with target labels. | `false` |
+| `metrics.serviceMonitor.additionalLabels` | Used to pass Labels that are required by the Installed Prometheus Operator | `{}` |
+
+_See [helm upgrade](https://helm.sh/docs/helm/helm_upgrade/) for command documentation._
+
+## Concepts
+
+This chart by default starts Centrifugo with Memory engine. This means that you can only run one Centrifugo instance pod in default setup. If you need to run more pods to scale and load-balance connections between them – run Centrifugo with Redis engine or with Nats broker (for at most once PUB/SUB only). See examples below.
+
+Centrifugo service exposes 3 ports:
+
+* for client connections from the outside of your cluster. This is called external port: 8000 by default.
+* internal port for API, Prometheus metrics, admin web interface, health checks. So these endpoints not available from the outside when enabling ingress. This is called internal port: 9000 by default.
+* GRPC API port: 10000 by default.
+
+Ingress proxies on external port.
+
+## Configuration
+
+Chart follows usual practices when working with Helm. All Centrifugo configuration options can be set. You can set them using custom `values.yaml`:
+
+```yaml
+config:
+ admin: false
+ namespaces:
+ - name: "chat"
+ - presence: true
+```
+
+And deploy with:
+
+```console
+helm install [RELEASE_NAME] -f values.yaml centrifugal/centrifugo
+```
+
+Or you can override options using `--set` flag, for example:
+
+```console
+helm install [RELEASE_NAME] centrifugal/centrifugo --set config.namespaces[0].name=chat --set config.namespaces[0].presence=true
+```
+
+This chart also defines several secrets. For example here is an example that configures HTTP API key and token HMAC secret key.
+
+```console
+helm install [RELEASE_NAME] centrifugal/centrifugo --set secrets.apiKey= --set secrets.tokenHmacSecretKey=
+```
+
+See full list of supported secrets inside chart [values.yaml](https://github.com/centrifugal/helm-charts/blob/master/charts/centrifugo/values.yaml).
+
+## Scale with Redis engine
+
+Run Redis (here we are using Redis chart from bitnami, but you can use any other Redis deployment):
+
+```console
+helm repo add bitnami https://charts.bitnami.com/bitnami
+helm install redis bitnami/redis --set auth.enabled=false
+```
+
+Then start Centrifugo with `redis` engine and pointing it to Redis:
+
+```console
+helm install centrifugo -f values.yaml ./centrifugo --set config.engine=redis --set config.redis_address=redis://redis-master:6379 --set replicaCount=3
+```
+
+Now example with Redis Sentinel (again using chart from bitnami):
+
+```console
+helm install redis bitnami/redis --set auth.enabled=false --set cluster.enabled=true --set sentinel.enabled=true
+```
+
+Then point Centrifugo to Sentinel:
+
+```console
+helm install centrifugo -f values.yaml ./centrifugo --set config.engine=redis --set config.redis_sentinel_master_name=mymaster --set config.redis_sentinel_address=redis:26379 --set replicaCount=3
+```
+
+Example with Redis Cluster (using `bitnami/redis-cluster` chart, but again the way you run Redis is up to you actually):
+
+```console
+helm install redis bitnami/redis-cluster --set usePassword=false
+```
+
+Then point Centrifugo to Redis Cluster:
+
+```console
+helm install centrifugo -f values.yaml ./centrifugo --set config.engine=redis --set config.redis_cluster_address=redis-redis-cluster-0:6379 --set replicaCount=3
+```
+
+Note: it's possible to set Redis URL and Redis/Sentinel passwords over secrets if needed.
+
+## With Nats broker
+
+```console
+helm repo add nats https://nats-io.github.io/k8s/helm/charts/
+helm install nats nats/nats --set cluster.enabled=true
+```
+
+Then start Centrifugo pointing to Nats broker:
+
+```console
+helm install centrifugo -f values.yaml ./centrifugo --set config.broker=nats --set config.nats_url=nats://nats:4222 --set replicaCount=3
+```
+
+Note: it's possible to set Nats URL over secrets if needed.
+
+## Using initContainers
+
+You can define `initContainers` in your values.yaml to wait for other resources or to do some init jobs. `initContainers` might be useful to wait for your engine to be ready before starting centrifugo.
+
+### Redis
+
+```yaml
+initContainers:
+ - name: wait-for-redis
+ image: ghcr.io/patrickdappollonio/wait-for:latest
+ env:
+ - name: REDIS_ADDRESS
+ value: "redis:6379"
+ command:
+ - /wait-for
+ args:
+ - --host="$(REDIS_ADDRESS)"
+ - --timeout=240s
+ - --verbose
+```
+
+### Example Nats
+
+```yaml
+initContainers:
+ - name: wait-for-nats
+ image: ghcr.io/patrickdappollonio/wait-for:latest
+ env:
+ - name: NATS_ADDRESS
+ value: "nats:4222"
+ command:
+ - /wait-for
+ args:
+ - --host="$(NATS_ADDRESS)"
+ - --timeout=240s
+ - --verbose
+```
+
+## Upgrading
+
+### v10 -> v11
+
+Major bump to 11.0.0 caused by breaking change in horizontal pod autoscaling configuration. See changes in https://github.com/centrifugal/helm-charts/pull/64 for more details. TLDR: cpu scaling should be explicitly enabled now, cpu and memory configuration moved to nested object, both now have `enabled` flags for granular configuraion.
+
+### v9 -> v10
+
+In v10 we are using Centrifugo v5 as base appVersion. See [Centrifugo v5.0.0 release notes](https://github.com/centrifugal/centrifugo/releases/tag/v5.0.0).
+
+### v8 -> v9
+
+In v9 we are using Centrifugo v4 as base appVersion. See [Centrifugo v4.0.0 release notes](https://github.com/centrifugal/centrifugo/releases/tag/v4.0.0).
+
+### v7 -> v8
+
+In v8 version we are fixing an inconsistency in `existingSecret` option names reported in [#33](https://github.com/centrifugal/helm-charts/issues/33).
+
+So, in `existingSecret`:
+
+* admin_password -> adminPassword
+* admin_secret -> adminSecret
+* token_hmac_secret_key -> tokenHmacSecretKey
+* api_key -> apiKey
+* grpc_api_key -> grpcApiKey
+* redis_address -> redisAddress
+* redis_password -> redisPassword
+* redis_sentinel_password -> redisSentinelPassword
+* nats_url -> natsUrl
+
+### v5 -> v6
+
+v6 aims to simplify chart configuration and make it a bit more idiomatic. See pull request [#6](https://github.com/centrifugal/helm-charts/pull/6) for all the changes.
+
+- Several parameters were renamed or disappeared in favor of new ones on this major version:
+ - Three type of services were moved to their own block.
+ - To enable separate services use `useSeparateInternalService` and `useSeparateGrpcService` and `useSeparateUniGrpcService` flags.
+ - `ServiceMonitor` move to block `metrics` with additional parameters, `labels` renamed to `additionalLabels` - removed configuration block `centrifugo`, all configuration under that block moved to top level.
+
+[On November 13, 2020, Helm v2 support was formally finished](https://github.com/helm/charts#status-of-the-project), this major version is the result of the required changes applied to the Helm Chart to be able to incorporate the different features added in Helm v3 and to be consistent with the Helm project itself regarding the Helm v2 EOL.
diff --git a/install-bundler/install-centrifugo/centrifugo/templates/NOTES.txt b/install-bundler/install-centrifugo/centrifugo/templates/NOTES.txt
new file mode 100644
index 00000000..69902f60
--- /dev/null
+++ b/install-bundler/install-centrifugo/centrifugo/templates/NOTES.txt
@@ -0,0 +1,20 @@
+1. Get the application URL by running these commands:
+{{- if .Values.ingress.enabled }}
+{{- range $host := .Values.ingress.hosts }}
+ {{- range .paths }}
+ http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }}
+ {{- end }}
+{{- end }}
+{{- else if contains "NodePort" .Values.service.type }}
+ export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "centrifugo.fullname" . }})
+ export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
+ echo http://$NODE_IP:$NODE_PORT
+{{- else if contains "LoadBalancer" .Values.service.type }}
+ NOTE: It may take a few minutes for the LoadBalancer IP to be available.
+ You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "centrifugo.fullname" . }}'
+ export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "centrifugo.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
+ echo http://$SERVICE_IP:{{ .Values.service.port }}
+{{- else if contains "ClusterIP" .Values.service.type }}
+ export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "centrifugo.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
+ kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8000:8000
+{{- end }}
diff --git a/install-bundler/install-centrifugo/centrifugo/templates/_helpers.tpl b/install-bundler/install-centrifugo/centrifugo/templates/_helpers.tpl
new file mode 100644
index 00000000..702df465
--- /dev/null
+++ b/install-bundler/install-centrifugo/centrifugo/templates/_helpers.tpl
@@ -0,0 +1,121 @@
+{{/* vim: set filetype=mustache: */}}
+{{/*
+Expand the name of the chart.
+*/}}
+{{- define "centrifugo.name" -}}
+{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+{{/*
+Create a default fully qualified app name.
+We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
+If release name contains chart name it will be used as a full name.
+*/}}
+{{- define "centrifugo.fullname" -}}
+{{- if .Values.fullnameOverride -}}
+{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
+{{- else -}}
+{{- $name := default .Chart.Name .Values.nameOverride -}}
+{{- if contains $name .Release.Name -}}
+{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
+{{- else -}}
+{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+{{- end -}}
+{{- end -}}
+
+{{/*
+Create chart name and version as used by the chart label.
+*/}}
+{{- define "centrifugo.chart" -}}
+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+{{/*
+Common labels
+*/}}
+{{- define "centrifugo.labels" -}}
+helm.sh/chart: {{ include "centrifugo.chart" . }}
+{{ include "centrifugo.selectorLabels" . }}
+{{- if .Chart.AppVersion }}
+app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
+{{- end }}
+app.kubernetes.io/managed-by: {{ .Release.Service }}
+{{- end }}
+
+{{/*
+Selector labels
+*/}}
+{{- define "centrifugo.selectorLabels" -}}
+app.kubernetes.io/name: {{ include "centrifugo.name" . }}
+app.kubernetes.io/instance: {{ .Release.Name }}
+{{- end }}
+
+{{/*
+Create the name of the service account to use
+*/}}
+{{- define "centrifugo.serviceAccountName" -}}
+{{- if .Values.serviceAccount.create }}
+{{- default (include "centrifugo.fullname" .) .Values.serviceAccount.name }}
+{{- else }}
+{{- default "default" .Values.serviceAccount.name }}
+{{- end }}
+{{- end }}
+
+{{/*
+Allow the release namespace to be overridden for multi-namespace deployments in combined charts
+*/}}
+{{- define "centrifugo.namespace" -}}
+ {{- if .Values.namespaceOverride -}}
+ {{- .Values.namespaceOverride -}}
+ {{- else -}}
+ {{- .Release.Namespace -}}
+ {{- end -}}
+{{- end -}}
+
+{{- define "centrifugo.image" -}}
+{{- $registryName := .Values.image.registry -}}
+{{- $repositoryName := .Values.image.repository -}}
+{{- $tag := coalesce .Values.image.tag (printf "v%s" .Chart.AppVersion ) | toString -}}
+{{- if .Values.global -}}
+ {{- if .Values.global.imageRegistry }}
+ {{- printf "%s/%s:%s" .Values.global.imageRegistry $repositoryName $tag -}}
+ {{- else -}}
+ {{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
+ {{- end -}}
+{{- else -}}
+ {{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
+{{- end -}}
+{{- end -}}
+
+{{/*
+Return the proper Docker Image Registry Secret Names
+*/}}
+{{- define "centrifugo.imagePullSecrets" -}}
+{{- if .Values.global }}
+{{- if .Values.global.imagePullSecrets }}
+imagePullSecrets:
+{{- range .Values.global.imagePullSecrets }}
+ - name: {{ . }}
+{{- end }}
+{{- else if .Values.image.pullSecrets}}
+imagePullSecrets:
+{{- range .Values.image.pullSecrets }}
+ - name: {{ . }}
+{{- end }}
+{{- end -}}
+{{- else if .Values.image.pullSecrets }}
+imagePullSecrets:
+{{- range .Values.image.pullSecrets }}
+ - name: {{ . }}
+{{- end }}
+{{- end -}}
+{{- end -}}
+
+{{- define "centrifugo.secretName" -}}
+{{- if .Values.existingSecret -}}
+ {{- printf "%s" (tpl .Values.existingSecret $) -}}
+{{- else -}}
+ {{- printf "%s" (include "centrifugo.fullname" .) -}}
+{{- end -}}
+{{- end -}}
diff --git a/install-bundler/install-centrifugo/centrifugo/templates/configmap.yaml b/install-bundler/install-centrifugo/centrifugo/templates/configmap.yaml
new file mode 100644
index 00000000..4942c023
--- /dev/null
+++ b/install-bundler/install-centrifugo/centrifugo/templates/configmap.yaml
@@ -0,0 +1,10 @@
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: {{ include "centrifugo.fullname" . }}-config
+ namespace: {{ include "centrifugo.namespace" . }}
+ labels:
+ {{- include "centrifugo.labels" . | nindent 4 }}
+data:
+ config.json: |-
+{{ toJson .Values.config| indent 4 }}
diff --git a/install-bundler/install-centrifugo/centrifugo/templates/deployment.yaml b/install-bundler/install-centrifugo/centrifugo/templates/deployment.yaml
new file mode 100644
index 00000000..b4c7a64c
--- /dev/null
+++ b/install-bundler/install-centrifugo/centrifugo/templates/deployment.yaml
@@ -0,0 +1,191 @@
+
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: {{ include "centrifugo.fullname" . }}
+ namespace: {{ include "centrifugo.namespace" . }}
+ labels:
+ {{- include "centrifugo.labels" . | nindent 4 }}
+spec:
+ {{- if not .Values.autoscaling.enabled }}
+ replicas: {{ .Values.replicaCount }}
+ {{- end }}
+ selector:
+ matchLabels:
+ {{- include "centrifugo.selectorLabels" . | nindent 6 }}
+ {{- if .Values.deploymentStrategy }}
+ strategy:
+ {{- toYaml .Values.deploymentStrategy | nindent 4 }}
+ {{- end }}
+ template:
+ metadata:
+ annotations:
+ checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
+ checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
+ {{- with .Values.podAnnotations }}
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
+ labels:
+ {{- include "centrifugo.selectorLabels" . | nindent 8 }}
+ {{- with .Values.podLabels }}
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
+ spec:
+ {{- if .Values.topologySpreadConstraints }}
+ topologySpreadConstraints:
+ {{- with .Values.topologySpreadConstraints }}
+ {{- tpl (toYaml .) $ | nindent 8 }}
+ {{- end }}
+ {{- end }}
+ {{- if .Values.priorityClassName }}
+ priorityClassName: {{ .Values.priorityClassName | quote }}
+ {{- end }}
+ {{- include "centrifugo.imagePullSecrets" . | indent 6 }}
+ serviceAccountName: {{ include "centrifugo.serviceAccountName" . }}
+ securityContext:
+ {{- toYaml .Values.podSecurityContext | nindent 8 }}
+ terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
+ volumes:
+ - name: {{ include "centrifugo.fullname" . }}-config
+ configMap:
+ name: {{ include "centrifugo.fullname" . }}-config
+ {{- with .Values.volumes }}
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
+ {{- if .Values.initContainers}}
+ initContainers:
+ {{- with .Values.initContainers }}
+ {{- tpl (toYaml .) $ | nindent 8 }}
+ {{- end }}
+ {{- end }}
+ containers:
+ - name: {{ .Chart.Name }}
+ securityContext:
+ {{- toYaml .Values.securityContext | nindent 12 }}
+ image: {{ include "centrifugo.image" .}}
+ imagePullPolicy: {{ .Values.image.pullPolicy }}
+ command:
+ - centrifugo
+ args:
+ - --health
+ - --prometheus
+ - --port
+ - "{{ .Values.service.port }}"
+ - --internal_port
+ - "{{ .Values.internalService.port }}"
+ - --grpc_api
+ - --grpc_api_port
+ - "{{ .Values.grpcService.port }}"
+ - --uni_grpc_port
+ - "{{ .Values.uniGrpcService.port }}"
+ env:
+ - name: CENTRIFUGO_ADMIN_PASSWORD
+ valueFrom:
+ secretKeyRef:
+ name: {{ include "centrifugo.secretName" . }}
+ key: adminPassword
+ - name: CENTRIFUGO_ADMIN_SECRET
+ valueFrom:
+ secretKeyRef:
+ name: {{ include "centrifugo.secretName" . }}
+ key: adminSecret
+ - name: CENTRIFUGO_TOKEN_HMAC_SECRET_KEY
+ valueFrom:
+ secretKeyRef:
+ name: {{ include "centrifugo.secretName" . }}
+ key: tokenHmacSecretKey
+ optional: true
+ - name: CENTRIFUGO_API_KEY
+ valueFrom:
+ secretKeyRef:
+ name: {{ include "centrifugo.secretName" . }}
+ key: apiKey
+ optional: true
+ - name: CENTRIFUGO_GRPC_API_KEY
+ valueFrom:
+ secretKeyRef:
+ name: {{ include "centrifugo.secretName" . }}
+ key: grpcApiKey
+ optional: true
+ - name: CENTRIFUGO_REDIS_ADDRESS
+ valueFrom:
+ secretKeyRef:
+ name: {{ include "centrifugo.secretName" . }}
+ key: redisAddress
+ optional: true
+ - name: CENTRIFUGO_REDIS_PASSWORD
+ valueFrom:
+ secretKeyRef:
+ name: {{ include "centrifugo.secretName" . }}
+ key: redisPassword
+ optional: true
+ - name: CENTRIFUGO_REDIS_SENTINEL_PASSWORD
+ valueFrom:
+ secretKeyRef:
+ name: {{ include "centrifugo.secretName" . }}
+ key: redisSentinelPassword
+ optional: true
+ - name: CENTRIFUGO_NATS_URL
+ valueFrom:
+ secretKeyRef:
+ name: {{ include "centrifugo.secretName" . }}
+ key: natsUrl
+ optional: true
+ - name: CENTRIFUGO_LICENSE
+ valueFrom:
+ secretKeyRef:
+ name: {{ include "centrifugo.secretName" . }}
+ key: license
+ optional: true
+ {{- range .Values.envSecret }}
+ - name: {{ .name }}
+ valueFrom:
+ secretKeyRef:
+ {{- toYaml .secretKeyRef | nindent 18 }}
+ {{- end }}
+ {{- range $key, $value := .Values.env }}
+ - name: {{ $key }}
+ value: {{ $value | quote }}
+ {{- end }}
+ volumeMounts:
+ - name: "{{ include "centrifugo.fullname" . }}-config"
+ mountPath: "/centrifugo"
+ readOnly: true
+ {{- with .Values.volumeMounts }}
+ {{- toYaml . | nindent 12 }}
+ {{- end }}
+ ports:
+ - name: external
+ containerPort: {{ .Values.service.port }}
+ - name: internal
+ containerPort: {{ .Values.internalService.port }}
+ - name: grpc
+ containerPort: {{ .Values.grpcService.port }}
+ - name: uni-grpc
+ containerPort: {{ .Values.uniGrpcService.port }}
+ livenessProbe:
+ httpGet:
+ path: /health
+ port: {{ .Values.internalService.port }}
+ initialDelaySeconds: 30
+ periodSeconds: 10
+ readinessProbe:
+ httpGet:
+ path: /health
+ port: {{ .Values.internalService.port }}
+ initialDelaySeconds: 3
+ periodSeconds: 10
+ resources:
+ {{- toYaml .Values.resources | nindent 12 }}
+ {{- with .Values.nodeSelector }}
+ nodeSelector:
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
+ {{- with .Values.affinity }}
+ affinity:
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
+ {{- with .Values.tolerations }}
+ tolerations:
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
diff --git a/install-bundler/install-centrifugo/centrifugo/templates/hpa.yaml b/install-bundler/install-centrifugo/centrifugo/templates/hpa.yaml
new file mode 100644
index 00000000..878d6319
--- /dev/null
+++ b/install-bundler/install-centrifugo/centrifugo/templates/hpa.yaml
@@ -0,0 +1,52 @@
+{{- if .Values.autoscaling.enabled }}
+{{- if .Capabilities.APIVersions.Has "autoscaling/v2" }}
+apiVersion: "autoscaling/v2"
+{{- else }}
+apiVersion: "autoscaling/v2beta1"
+{{- end }}
+kind: HorizontalPodAutoscaler
+metadata:
+ name: {{ include "centrifugo.fullname" . }}
+ namespace: {{ include "centrifugo.namespace" . }}
+ labels:
+ {{- include "centrifugo.labels" . | nindent 4 }}
+spec:
+ scaleTargetRef:
+ apiVersion: apps/v1
+ kind: Deployment
+ name: {{ include "centrifugo.fullname" . }}
+ minReplicas: {{ .Values.autoscaling.minReplicas }}
+ maxReplicas: {{ .Values.autoscaling.maxReplicas }}
+ metrics:
+ {{- with .Values.autoscalingTemplate }}
+ {{- toYaml . | nindent 2 }}
+ {{- end }}
+ {{- if .Values.autoscaling.cpu.enabled }}
+ - type: Resource
+ resource:
+ name: cpu
+ {{- if .Capabilities.APIVersions.Has "autoscaling/v2" }}
+ target:
+ type: Utilization
+ averageUtilization: {{ .Values.autoscaling.cpu.targetCPUUtilizationPercentage }}
+ {{- else }}
+ targetAverageUtilization: {{ .Values.autoscaling.cpu.targetCPUUtilizationPercentage }}
+ {{- end }}
+ {{- end }}
+ {{- if .Values.autoscaling.memory.enabled }}
+ - type: Resource
+ resource:
+ name: memory
+ {{- if .Capabilities.APIVersions.Has "autoscaling/v2" }}
+ target:
+ type: Utilization
+ averageUtilization: {{ .Values.autoscaling.memory.targetMemoryUtilizationPercentage }}
+ {{- else }}
+ targetAverageUtilization: {{ .Values.autoscaling.memory.targetMemoryUtilizationPercentage }}
+ {{- end }}
+ {{- end }}
+ {{- with .Values.autoscaling.behavior }}
+ behavior:
+ {{- toYaml . | nindent 4 }}
+ {{- end }}
+{{- end }}
diff --git a/install-bundler/install-centrifugo/centrifugo/templates/ingress-internal.yaml b/install-bundler/install-centrifugo/centrifugo/templates/ingress-internal.yaml
new file mode 100644
index 00000000..f39749c7
--- /dev/null
+++ b/install-bundler/install-centrifugo/centrifugo/templates/ingress-internal.yaml
@@ -0,0 +1,64 @@
+{{- if .Values.ingressInternal.enabled }}
+{{- $fullName := include "centrifugo.fullname" . }}
+{{- $namespace := include "centrifugo.namespace" . }}
+{{- $svcPort := .Values.internalService.port }}
+{{- if or ( gt .Capabilities.KubeVersion.Major "1" ) ( ge .Capabilities.KubeVersion.Minor "19" ) }}
+apiVersion: networking.k8s.io/v1
+{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion }}
+apiVersion: networking.k8s.io/v1beta1
+{{- end }}
+kind: Ingress
+metadata:
+ name: {{ $fullName }}-internal
+ namespace: {{ $namespace }}
+ labels:
+ {{- include "centrifugo.labels" . | nindent 4 }}
+ {{- with .Values.ingressInternal.annotations }}
+ annotations:
+ {{- toYaml . | nindent 4 }}
+ {{- end }}
+spec:
+ {{- if .Values.ingressInternal.ingressClassName }}
+ ingressClassName: {{ .Values.ingressInternal.ingressClassName }}
+ {{- end }}
+ {{- if .Values.ingressInternal.tls }}
+ tls:
+ {{- range .Values.ingressInternal.tls }}
+ - hosts:
+ {{- range .hosts }}
+ - {{ . | quote }}
+ {{- end }}
+ secretName: {{ .secretName }}
+ {{- end }}
+ {{- end }}
+ rules:
+ {{- range .Values.ingressInternal.hosts }}
+ - host: {{ .host | quote }}
+ http:
+ paths:
+ {{- range .paths }}
+ - path: {{ . }}
+ {{- if or ( gt $.Capabilities.KubeVersion.Major "1" ) ( ge $.Capabilities.KubeVersion.Minor "19" ) }}
+ pathType: {{ $.Values.ingressInternal.pathType }}
+ {{- end }}
+ backend:
+ {{- if or ( gt $.Capabilities.KubeVersion.Major "1" ) ( ge $.Capabilities.KubeVersion.Minor "19" ) }}
+ service:
+ {{- if $.Values.service.useSeparateInternalService }}
+ name: {{ $fullName }}-internal
+ {{- else }}
+ name: {{ $fullName }}
+ {{- end }}
+ port:
+ number: {{ $svcPort }}
+ {{- else }}
+ {{- if $.Values.service.useSeparateInternalService }}
+ serviceName: {{ $fullName }}-internal
+ {{- else }}
+ serviceName: {{ $fullName }}
+ {{- end }}
+ servicePort: {{ $svcPort }}
+ {{- end }}
+ {{- end }}
+ {{- end }}
+{{- end }}
diff --git a/install-bundler/install-centrifugo/centrifugo/templates/ingress.yaml b/install-bundler/install-centrifugo/centrifugo/templates/ingress.yaml
new file mode 100644
index 00000000..64773ffd
--- /dev/null
+++ b/install-bundler/install-centrifugo/centrifugo/templates/ingress.yaml
@@ -0,0 +1,56 @@
+{{- if .Values.ingress.enabled -}}
+{{- $fullName := include "centrifugo.fullname" . -}}
+{{- $namespace := include "centrifugo.namespace" . -}}
+{{- $svcPort := .Values.service.port -}}
+{{- if or ( gt .Capabilities.KubeVersion.Major "1" ) ( ge .Capabilities.KubeVersion.Minor "19" ) }}
+apiVersion: networking.k8s.io/v1
+{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion }}
+apiVersion: networking.k8s.io/v1beta1
+{{- end }}
+kind: Ingress
+metadata:
+ name: {{ $fullName }}
+ namespace: {{ $namespace }}
+ labels:
+ {{- include "centrifugo.labels" . | nindent 4 }}
+ {{- with .Values.ingress.annotations }}
+ annotations:
+ {{- toYaml . | nindent 4 }}
+ {{- end }}
+spec:
+ {{- if .Values.ingress.ingressClassName }}
+ ingressClassName: {{ .Values.ingress.ingressClassName }}
+ {{- end }}
+ {{- if .Values.ingress.tls }}
+ tls:
+ {{- range .Values.ingress.tls }}
+ - hosts:
+ {{- range .hosts }}
+ - {{ . | quote }}
+ {{- end }}
+ secretName: {{ .secretName }}
+ {{- end }}
+ {{- end }}
+ rules:
+ {{- range .Values.ingress.hosts }}
+ - host: {{ .host | quote }}
+ http:
+ paths:
+ {{- range .paths }}
+ - path: {{ . }}
+ {{- if or ( gt $.Capabilities.KubeVersion.Major "1" ) ( ge $.Capabilities.KubeVersion.Minor "19" ) }}
+ pathType: {{ $.Values.ingress.pathType }}
+ {{- end }}
+ backend:
+ {{- if or ( gt $.Capabilities.KubeVersion.Major "1" ) ( ge $.Capabilities.KubeVersion.Minor "19" ) }}
+ service:
+ name: {{ $fullName }}
+ port:
+ number: {{ $svcPort }}
+ {{- else }}
+ serviceName: {{ $fullName }}
+ servicePort: {{ $svcPort }}
+ {{- end }}
+ {{- end }}
+ {{- end }}
+{{- end }}
diff --git a/install-bundler/install-centrifugo/centrifugo/templates/poddisruptionbudget.yaml b/install-bundler/install-centrifugo/centrifugo/templates/poddisruptionbudget.yaml
new file mode 100644
index 00000000..24abe26c
--- /dev/null
+++ b/install-bundler/install-centrifugo/centrifugo/templates/poddisruptionbudget.yaml
@@ -0,0 +1,18 @@
+{{- if .Values.podDisruptionBudget.enabled }}
+apiVersion: policy/v1
+kind: PodDisruptionBudget
+metadata:
+ labels:
+ {{- include "centrifugo.labels" . | nindent 4 }}
+ app.kubernetes.io/component: controller
+ {{- with .Values.labels }}
+ {{- toYaml . | nindent 4 }}
+ {{- end }}
+ name: {{ include "centrifugo.fullname" . }}
+ namespace: {{ .Release.Namespace }}
+spec:
+ selector:
+ matchLabels:
+ {{- include "centrifugo.selectorLabels" . | nindent 6 }}
+ minAvailable: {{ .Values.podDisruptionBudget.minAvailable }}
+{{- end }}
diff --git a/install-bundler/install-centrifugo/centrifugo/templates/secret.yaml b/install-bundler/install-centrifugo/centrifugo/templates/secret.yaml
new file mode 100644
index 00000000..149cc47b
--- /dev/null
+++ b/install-bundler/install-centrifugo/centrifugo/templates/secret.yaml
@@ -0,0 +1,45 @@
+{{- if not .Values.existingSecret }}
+apiVersion: v1
+kind: Secret
+metadata:
+ name: {{ include "centrifugo.fullname" . }}
+ namespace: {{ include "centrifugo.namespace" . }}
+ labels:
+ {{- include "centrifugo.labels" . | nindent 4 }}
+type: Opaque
+data:
+ {{- if .Values.secrets.tokenHmacSecretKey }}
+ tokenHmacSecretKey: {{ .Values.secrets.tokenHmacSecretKey | b64enc | quote }}
+ {{- end }}
+ {{- if .Values.secrets.apiKey }}
+ apiKey: {{ .Values.secrets.apiKey | b64enc | quote }}
+ {{- end }}
+ {{- if .Values.secrets.grpcApiKey }}
+ grpcApiKey: {{ .Values.secrets.grpcApiKey | b64enc | quote }}
+ {{- end }}
+ {{- if .Values.secrets.adminPassword }}
+ adminPassword: {{ .Values.secrets.adminPassword | b64enc | quote }}
+ {{- else }}
+ adminPassword: {{ randAlphaNum 12 | b64enc | quote }}
+ {{- end }}
+ {{- if .Values.secrets.adminSecret }}
+ adminSecret: {{ .Values.secrets.adminSecret | b64enc | quote }}
+ {{- else }}
+ adminSecret: {{ randAlphaNum 24 | b64enc | quote }}
+ {{- end }}
+ {{- if .Values.secrets.redisAddress }}
+ redisAddress: {{ .Values.secrets.redisAddress | b64enc | quote }}
+ {{- end }}
+ {{- if .Values.secrets.redisPassword }}
+ redisPassword: {{ .Values.secrets.redisPassword | b64enc | quote }}
+ {{- end }}
+ {{- if .Values.secrets.redisSentinelPassword }}
+ redisSentinelPassword: {{ .Values.secrets.redisSentinelPassword | b64enc | quote }}
+ {{- end }}
+ {{- if .Values.secrets.natsUrl }}
+ natsUrl: {{ .Values.secrets.natsUrl | b64enc | quote }}
+ {{- end }}
+ {{- if .Values.secrets.license }}
+ license: {{ .Values.secrets.license | b64enc | quote }}
+ {{- end }}
+{{- end }}
diff --git a/install-bundler/install-centrifugo/centrifugo/templates/service-grpc-api.yaml b/install-bundler/install-centrifugo/centrifugo/templates/service-grpc-api.yaml
new file mode 100644
index 00000000..df2ccb2e
--- /dev/null
+++ b/install-bundler/install-centrifugo/centrifugo/templates/service-grpc-api.yaml
@@ -0,0 +1,31 @@
+{{- if .Values.service.useSeparateGrpcService -}}
+apiVersion: v1
+kind: Service
+metadata:
+ name: {{ include "centrifugo.fullname" . }}-grpc-api
+ namespace: {{ include "centrifugo.namespace" . }}
+ labels:
+ {{- include "centrifugo.labels" . | nindent 4 }}
+ {{- with .Values.grpcService.labels }}
+ {{- toYaml . | nindent 4 }}
+ {{- end }}
+ {{- with .Values.grpcService.annotations }}
+ annotations:
+ {{- toYaml . | nindent 4 }}
+ {{- end }}
+spec:
+ type: {{ .Values.grpcService.type }}
+ ports:
+ - port: {{ .Values.grpcService.port }}
+ targetPort: grpc
+ protocol: TCP
+ {{- if .Values.grpcService.appProtocol }}
+ appProtocol: {{ .Values.grpcService.appProtocol }}
+ {{- end }}
+ name: grpc
+ {{- if (and (eq .Values.grpcService.type "NodePort") (not (empty .Values.grpcService.nodePort))) }}
+ nodePort: {{ .Values.grpcService.nodePort }}
+ {{- end }}
+ selector:
+ {{- include "centrifugo.selectorLabels" . | nindent 4 }}
+{{- end }}
diff --git a/install-bundler/install-centrifugo/centrifugo/templates/service-internal.yaml b/install-bundler/install-centrifugo/centrifugo/templates/service-internal.yaml
new file mode 100644
index 00000000..062f085c
--- /dev/null
+++ b/install-bundler/install-centrifugo/centrifugo/templates/service-internal.yaml
@@ -0,0 +1,31 @@
+{{- if .Values.service.useSeparateInternalService -}}
+apiVersion: v1
+kind: Service
+metadata:
+ name: {{ include "centrifugo.fullname" . }}-internal
+ namespace: {{ include "centrifugo.namespace" . }}
+ labels:
+ {{- include "centrifugo.labels" . | nindent 4 }}
+ {{- with .Values.internalService.labels }}
+ {{- toYaml . | nindent 4 }}
+ {{- end }}
+ {{- with .Values.internalService.annotations }}
+ annotations:
+ {{- toYaml . | nindent 4 }}
+ {{- end }}
+spec:
+ type: {{ .Values.internalService.type }}
+ ports:
+ - port: {{ .Values.internalService.port }}
+ targetPort: internal
+ protocol: TCP
+ {{- if .Values.internalService.appProtocol }}
+ appProtocol: {{ .Values.internalService.appProtocol }}
+ {{- end }}
+ name: internal
+ {{- if (and (eq .Values.internalService.type "NodePort") (not (empty .Values.internalService.nodePort))) }}
+ nodePort: {{ .Values.internalService.nodePort }}
+ {{- end }}
+ selector:
+ {{- include "centrifugo.selectorLabels" . | nindent 4 }}
+{{- end }}
diff --git a/install-bundler/install-centrifugo/centrifugo/templates/service-uni-grpc.yaml b/install-bundler/install-centrifugo/centrifugo/templates/service-uni-grpc.yaml
new file mode 100644
index 00000000..5a1b50a0
--- /dev/null
+++ b/install-bundler/install-centrifugo/centrifugo/templates/service-uni-grpc.yaml
@@ -0,0 +1,31 @@
+{{- if .Values.service.useSeparateUniGrpcService -}}
+apiVersion: v1
+kind: Service
+metadata:
+ name: {{ include "centrifugo.fullname" . }}-uni-grpc
+ namespace: {{ include "centrifugo.namespace" . }}
+ labels:
+ {{- include "centrifugo.labels" . | nindent 4 }}
+ {{- with .Values.uniGrpcService.labels }}
+ {{- toYaml . | nindent 4 }}
+ {{- end }}
+ {{- with .Values.uniGrpcService.annotations }}
+ annotations:
+ {{- toYaml . | nindent 4 }}
+ {{- end }}
+spec:
+ type: {{ .Values.uniGrpcService.type }}
+ ports:
+ - port: {{ .Values.uniGrpcService.port }}
+ targetPort: uni-grpc
+ protocol: TCP
+ {{- if .Values.uniGrpcService.appProtocol }}
+ appProtocol: {{ .Values.uniGrpcService.appProtocol }}
+ {{- end }}
+ name: uni-grpc
+ {{- if (and (eq .Values.uniGrpcService.type "NodePort") (not (empty .Values.uniGrpcService.nodePort))) }}
+ nodePort: {{ .Values.uniGrpcService.nodePort }}
+ {{- end }}
+ selector:
+ {{- include "centrifugo.selectorLabels" . | nindent 4 }}
+{{- end }}
diff --git a/install-bundler/install-centrifugo/centrifugo/templates/service.yaml b/install-bundler/install-centrifugo/centrifugo/templates/service.yaml
new file mode 100644
index 00000000..39f5b0d1
--- /dev/null
+++ b/install-bundler/install-centrifugo/centrifugo/templates/service.yaml
@@ -0,0 +1,65 @@
+apiVersion: v1
+kind: Service
+metadata:
+ name: {{ include "centrifugo.fullname" . }}
+ namespace: {{ include "centrifugo.namespace" . }}
+ labels:
+ {{- include "centrifugo.labels" . | nindent 4 }}
+ {{- with .Values.service.labels }}
+ {{- toYaml . | nindent 4 }}
+ {{- end }}
+ {{- with .Values.service.annotations }}
+ annotations:
+ {{- toYaml . | nindent 4 }}
+ {{- end }}
+spec:
+ type: {{ .Values.service.type }}
+ ports:
+ - port: {{ .Values.service.port }}
+ targetPort: external
+ protocol: TCP
+ {{- if .Values.service.appProtocol }}
+ appProtocol: {{ .Values.service.appProtocol }}
+ {{- end }}
+ name: external
+ {{- if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.nodePort))) }}
+ nodePort: {{ .Values.service.nodePort }}
+ {{- end }}
+{{- if not .Values.service.useSeparateInternalService }}
+ - port: {{ .Values.internalService.port }}
+ targetPort: internal
+ protocol: TCP
+ {{- if .Values.internalService.appProtocol }}
+ appProtocol: {{ .Values.internalService.appProtocol }}
+ {{- end }}
+ name: internal
+ {{- if (and (eq .Values.internalService.type "NodePort") (not (empty .Values.internalService.nodePort))) }}
+ nodePort: {{ .Values.internalService.nodePort }}
+ {{- end }}
+{{- end }}
+{{- if not .Values.service.useSeparateGrpcService }}
+ - port: {{ .Values.grpcService.port }}
+ targetPort: grpc
+ protocol: TCP
+ {{- if .Values.grpcService.appProtocol }}
+ appProtocol: {{ .Values.grpcService.appProtocol }}
+ {{- end }}
+ name: grpc
+ {{- if (and (eq .Values.grpcService.type "NodePort") (not (empty .Values.grpcService.nodePort))) }}
+ nodePort: {{ .Values.grpcService.nodePort }}
+ {{- end }}
+{{- end }}
+{{- if not .Values.service.useSeparateUniGrpcService }}
+ - port: {{ .Values.uniGrpcService.port }}
+ targetPort: uni-grpc
+ protocol: TCP
+ {{- if .Values.uniGrpcService.appProtocol }}
+ appProtocol: {{ .Values.uniGrpcService.appProtocol }}
+ {{- end }}
+ name: uni-grpc
+ {{- if (and (eq .Values.uniGrpcService.type "NodePort") (not (empty .Values.uniGrpcService.nodePort))) }}
+ nodePort: {{ .Values.uniGrpcService.nodePort }}
+ {{- end }}
+{{- end }}
+ selector:
+ {{- include "centrifugo.selectorLabels" . | nindent 4 }}
diff --git a/install-bundler/install-centrifugo/centrifugo/templates/serviceaccount.yaml b/install-bundler/install-centrifugo/centrifugo/templates/serviceaccount.yaml
new file mode 100644
index 00000000..4bde8aeb
--- /dev/null
+++ b/install-bundler/install-centrifugo/centrifugo/templates/serviceaccount.yaml
@@ -0,0 +1,13 @@
+{{- if .Values.serviceAccount.create -}}
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+ name: {{ include "centrifugo.serviceAccountName" . }}
+ namespace: {{ include "centrifugo.namespace" . }}
+ labels:
+ {{- include "centrifugo.labels" . | nindent 4 }}
+ {{- with .Values.serviceAccount.annotations }}
+ annotations:
+ {{- toYaml . | nindent 4 }}
+ {{- end }}
+{{- end }}
diff --git a/install-bundler/install-centrifugo/centrifugo/templates/servicemonitor.yaml b/install-bundler/install-centrifugo/centrifugo/templates/servicemonitor.yaml
new file mode 100644
index 00000000..320b0847
--- /dev/null
+++ b/install-bundler/install-centrifugo/centrifugo/templates/servicemonitor.yaml
@@ -0,0 +1,43 @@
+{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }}
+apiVersion: monitoring.coreos.com/v1
+kind: ServiceMonitor
+metadata:
+ name: {{ template "centrifugo.fullname" . }}
+ {{- if .Values.metrics.serviceMonitor.namespace }}
+ namespace: {{ .Values.metrics.serviceMonitor.namespace }}
+ {{- else }}
+ namespace: {{ include "centrifugo.namespace" . }}
+ {{- end }}
+ labels:
+ {{- include "centrifugo.labels" . | nindent 4 }}
+ {{- range $key, $value := .Values.metrics.serviceMonitor.additionalLabels }}
+ {{ $key }}: {{ $value | quote }}
+ {{- end }}
+ {{- if .Values.metrics.serviceMonitor.annotations }}
+ annotations:
+ {{- range $key, $value := .Values.metrics.serviceMonitor.annotations }}
+ {{ $key }}: {{ $value | quote }}
+ {{- end }}
+ {{- end }}
+spec:
+ endpoints:
+ - port: internal
+ {{- if .Values.metrics.serviceMonitor.interval }}
+ interval: {{ .Values.metrics.serviceMonitor.interval }}
+ {{- end }}
+ {{- if .Values.metrics.serviceMonitor.scrapeTimeout }}
+ scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }}
+ {{- end }}
+ {{- if .Values.metrics.serviceMonitor.honorLabels }}
+ honorLabels: {{ .Values.metrics.serviceMonitor.honorLabels }}
+ {{- end }}
+ {{- if .Values.metrics.serviceMonitor.relabellings }}
+ metricRelabelings: {{- toYaml .Values.metrics.serviceMonitor.relabellings | nindent 6 }}
+ {{- end }}
+ selector:
+ matchLabels:
+ {{- include "centrifugo.selectorLabels" . | nindent 6 }}
+ namespaceSelector:
+ matchNames:
+ - {{ .Release.Namespace }}
+{{- end -}}
diff --git a/install-bundler/install-centrifugo/centrifugo/values.yaml b/install-bundler/install-centrifugo/centrifugo/values.yaml
new file mode 100644
index 00000000..14701799
--- /dev/null
+++ b/install-bundler/install-centrifugo/centrifugo/values.yaml
@@ -0,0 +1,331 @@
+## Global Docker image parameters
+## Please, note that this will override the image parameters, including dependencies, configured to use the global value
+## Current available global Docker image parameters: imageRegistry and imagePullSecrets
+##
+# global:
+# imageRegistry: myRegistryName
+# imagePullSecrets:
+# - myRegistryKeySecretName
+
+replicaCount: 1
+
+image:
+ registry: docker.io
+ repository: centrifugo/centrifugo
+ pullPolicy: IfNotPresent
+ # Overrides the image tag whose default is the chart appVersion.
+ tag: ""
+
+imagePullSecrets: []
+nameOverride: ""
+fullnameOverride: ""
+namespaceOverride: ""
+priorityClassName: ""
+
+service:
+ ## Service type
+ ##
+ type: ClusterIP
+ ## Service port
+ ##
+ port: 8000
+ ## Specify the nodePort value for the LoadBalancer and NodePort service types.
+ ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport
+ ##
+ nodePort: ""
+ ## Provide any additional annotations which may be required
+ ##
+ annotations: {}
+ ## Provide any additional labels which may be required
+ ##
+ labels: {}
+ ##
+ ## Specify custom appProtocol for a service port.
+ appProtocol: ""
+ ##
+ ## Use separate service for internal endpoints. It could be useful for configuring same port number for all services.
+ useSeparateInternalService: false
+ ## Use separate service for GRPC API endpoints. It could be useful for configuring same port number for all services.
+ useSeparateGrpcService: false
+ ## Use separate service for GRPC unidirectional stream. It could be useful for configuring same port number for all services.
+ useSeparateUniGrpcService: false
+
+internalService:
+ port: 9000
+ type: ClusterIP
+ nodePort: ""
+ # Static NodePort, if set.
+ # nodePort: 30101
+ annotations: {}
+ # prometheus.io/scrape: "true"
+ # prometheus.io/path: "/metrics"
+ # prometheus.io/port: "9000"
+ ## Specify custom appProtocol for a service port.
+ labels: {}
+ appProtocol: ""
+
+grpcService:
+ port: 10000
+ type: ClusterIP
+ nodePort: ""
+ # Static NodePort, if set.
+ # nodePort: 30102
+ annotations: {}
+ ## Specify custom appProtocol for a service port.
+ labels: {}
+ appProtocol: ""
+
+uniGrpcService:
+ port: 11000
+ type: ClusterIP
+ nodePort: ""
+ # Static NodePort, if set.
+ # nodePort: 30103
+ annotations: {}
+ ## Specify custom appProtocol for a service port.
+ labels: {}
+ appProtocol: ""
+
+ingress:
+ enabled: false
+
+ # Optionally set the ingressClassName. k8s >= 1.18
+ ingressClassName: ""
+
+ # pathType override - see: https://kubernetes.io/docs/concepts/services-networking/ingress/#path-types
+ pathType: Prefix
+
+ annotations: {}
+ # kubernetes.io/ingress.class: nginx
+ # kubernetes.io/tls-acme: "true"
+ #
+ # To run on custom path:
+ # nginx.ingress.kubernetes.io/rewrite-target: /$2
+ hosts: []
+ # - host: centrifugo.local
+ # paths:
+ # - /
+ # - host: centrifugo-with-prefix.local
+ # paths:
+ # - /test(/|$)(.*)
+ # https://kubernetes.github.io/ingress-nginx/examples/tls-termination/
+ tls: []
+ # - secretName: centrifugo-example-tls
+ # hosts:
+ # - centrifugo.local
+
+ingressInternal:
+ # !!! ATTENTION !!!
+ # Be careful in exposing internal services by ingressInternal. Make sure
+ # you understand which Centrifugo endpoints are exposed in this case (server API,
+ # admin, Prometheus metrics, healthcheck, etc.). If you really need exposing internal
+ # endpoints consider limiting access to the ingress from the outside by load balancer
+ # rules, probably per specific path. Probably `admin_external` or `api_external`
+ # options which expose corresponding handlers on the external ingress will work better
+ # for you.
+ enabled: false
+
+ # Optionally set the ingressClassName. k8s >= 1.18
+ ingressClassName: ""
+
+ # pathType override - see: https://kubernetes.io/docs/concepts/services-networking/ingress/#path-types
+ pathType: Prefix
+
+ annotations: {}
+ # kubernetes.io/ingress.class: nginx
+ # kubernetes.io/tls-acme: "true"
+ #
+ # To run on custom path:
+ # nginx.ingress.kubernetes.io/rewrite-target: /$2
+ hosts: []
+ # - host: centrifugo.local
+ # paths:
+ # - /
+ # - host: centrifugo-with-prefix.local
+ # paths:
+ # - /test(/|$)(.*)
+ # https://kubernetes.github.io/ingress-nginx/examples/tls-termination/
+ tls: []
+ # - secretName: centrifugo-example-tls
+ # hosts:
+ # - centrifugo.local
+
+resources:
+ requests:
+ memory: "100Mi"
+ cpu: "200m"
+ limits:
+ memory: "512Mi"
+ cpu: "512m"
+
+serviceAccount:
+ # Specifies whether a service account should be created.
+ create: true
+ # Annotations to add to the service account.
+ annotations: {}
+ # The name of the service account to use.
+ # If not set and create is true, a name is generated using the fullname template.
+ name: ""
+
+autoscaling:
+ enabled: false
+ minReplicas: 1
+ maxReplicas: 100
+ cpu:
+ enabled: false
+ targetCPUUtilizationPercentage: 80
+ memory:
+ enabled: false
+ targetMemoryUtilizationPercentage: 80
+ # ref: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#default-behavior
+ behavior: {}
+
+autoscalingTemplate: []
+ # Custom or additional autoscaling metrics
+ # ref: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-metrics-apis
+ # ref: https://github.com/kubernetes-sigs/prometheus-adapter/
+ # - type: Pods
+ # pods:
+ # metric:
+ # # kubectl get --raw "/apis/custom.metrics.k8s.io/v1beta1/namespaces/default/pods/*/hpa_custom_metric_centrifugo_node_num_clients" | jq .
+ # name: hpa_custom_metric_centrifugo_node_num_clients
+ # target:
+ # type: AverageValue
+ # averageValue: 10000m # NOTE: # 10000m = 10 actual metric value (10 clients)
+
+podDisruptionBudget:
+ enabled: false
+ minAvailable: 1
+
+terminationGracePeriodSeconds: 30
+
+podAnnotations: {}
+podLabels: {}
+
+podSecurityContext: {}
+ # fsGroup: 2000
+
+securityContext: {}
+ # capabilities:
+ # drop:
+ # - ALL
+ # readOnlyRootFilesystem: true
+ # runAsNonRoot: true
+ # runAsUser: 1000
+ #
+ # You can also tune sysctl, ex.:
+ # sysctls:
+ # - name: net.core.somaxconn
+ # value: "2048"
+
+deploymentStrategy: {}
+ # type: RollingUpdate
+ # rollingUpdate:
+ # maxSurge: 0
+ # maxUnavailable: 1
+
+metrics:
+ enabled: false
+ serviceMonitor:
+ enabled: false
+ ## Specify the namespace in which the serviceMonitor resource will be created
+ ##
+ # namespace: ""
+ ## Specify the interval at which metrics should be scraped
+ ##
+ interval: 30s
+ ## Specify the timeout after which the scrape is ended
+ ##
+ # scrapeTimeout: 30s
+ ## Specify Metric Relabellings to add to the scrape endpoint
+ ##
+ # relabellings:
+ ## Specify honorLabels parameter to add the scrape endpoint
+ ##
+ honorLabels: false
+ ## Used to pass Labels that are used by the Prometheus installed in your cluster to select Service Monitors to work with
+ ## ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#prometheusspec
+ ## Can be used to specify the release label for ServiceMonitor. Sometimes it should be custom for prometheus operator to work.
+ additionalLabels: {}
+ ## Set custom annotations.
+ annotations: {}
+
+nodeSelector: {}
+
+tolerations: []
+
+affinity: {}
+
+# Additional environment variables to be passed to Centrifugo container.
+env: {}
+
+# Additional secret environment variables to be passed to Centrifugo container.
+envSecret: []
+
+# Centrifugo configuration, will be transformed into config.json file.
+config:
+ # Engine to use. Default memory engine allows running only one Centrifugo pod.
+ # Scale to many pods with Redis engine or Nats broker. Refer to Centrifugo
+ # documentation: https://centrifugal.github.io/centrifugo/server/engines/
+ engine: "memory"
+
+ # Enable admin web interface by default.
+ admin: true
+
+ # Array of namespaces.
+ namespaces: []
+
+# Additional volumes for Centrifugo deployment.
+volumes: []
+ # - name: volume
+ # secret:
+ # secretName: volumeSecretName
+
+# Additional volume mounts for Centrifugo container.
+volumeMounts: []
+ # - name: volume
+ # mountPath: "/volume"
+ # readOnly: true
+
+
+# TopologySpreadConstrains, e.g. for spreading pods across nodes
+# see https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/
+topologySpreadConstraints: ""
+
+# Init Containers, e.g. for waiting for other resources like redis (evaluated as template)
+# see https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
+initContainers: ""
+
+# existingSecret: my-secret
+
+# Centrifugo secrets.
+secrets:
+ # Secret key for HMAC tokens.
+ tokenHmacSecretKey: ""
+
+ # Admin password used to protect access to web interface.
+ adminPassword: ""
+
+ # Admin secret used to create auth tokens on user login into admin web interface.
+ adminSecret: ""
+
+ # Centrifugo api_key for Centrifugo API endpoint authorization.
+ apiKey: ""
+
+ # Centrifugo grpc_api_key for Centrifugo GRPC API authorization.
+ grpcApiKey: ""
+
+ # Connection string to Redis.
+ redisAddress: ""
+
+ # Password for Redis.
+ redisPassword: ""
+
+ # Password for Redis Sentinel.
+ redisSentinelPassword: ""
+
+ # Connection string to Nats.
+ natsUrl: ""
+
+ # Centrifugo PRO license.
+ license: ""
\ No newline at end of file
diff --git a/install-bundler/install-centrifugo/install.sh b/install-bundler/install-centrifugo/install.sh
new file mode 100644
index 00000000..3ae7e359
--- /dev/null
+++ b/install-bundler/install-centrifugo/install.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+set -e
+
+NAMESPACE=$1
+REPLICA_COUNT=$2
+# Check if the required arguments are passed
+if [ "$#" -ne 2 ]; then
+ echo "Usage: $0 for centrifugo"
+ exit 1
+fi
+
+HELM_RELEASE="centrifugo";
+
+# shellcheck disable=SC2059
+printf "\n${GREEN}####### Deploying $HELM_RELEASE to $NAMESPACE ${NC} ####### \n";
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
+helm upgrade --install --wait --timeout 720s $HELM_RELEASE "$DIR/centrifugo/." \
+ --values "${DIR}/centrifugo/values.yaml" \
+ --namespace "${NAMESPACE}" \
+ --set nameOverride="${HELM_RELEASE}" \
+ --set replicaCount="${REPLICA_COUNT}" \
+ --set secrets.tokenHmacSecretKey=averystrongsecret \
+ --set secrets.adminPassword=usedIfAdminSetToTrue \
+ --set secrets.adminSecret=averystrongsecretforadmin \
+ --set secrets.apiKey=usedforpostapi \
+ --set config.admin=true \
+ --set config.debug=true \
+ --set config.log_level=debug \
+ --set config.client_anonymous=true \
+ --set config.client_channel_limit=512 \
+ --set config.namespaces[0].name=relayer \
+ --set config.namespaces[0].publish=true \
+ --set config.namespaces[0].history_size=10 \
+ --set config.namespaces[0].history_ttl=300s \
+ --set config.namespaces[0].recover=true \
+ --set config.namespaces[0].anonymous=false \
+ --set config.namespaces[1].name=transaction \
+ --set config.namespaces[1].publish=true \
+ --set config.namespaces[1].history_size=10 \
+ --set config.namespaces[1].history_ttl=300s \
+ --set config.namespaces[1].recover=true \
+ --set config.namespaces[1].anonymous=true \
+ --set metrics.enabled=true
+
+# shellcheck disable=SC2028
+echo "\n\n ####### Deployed $HELM_RELEASE to $NAMESPACE ####### \n";
\ No newline at end of file
diff --git a/install-bundler/install-grafana/custom-values.yaml b/install-bundler/install-grafana/custom-values.yaml
new file mode 100644
index 00000000..8938583c
--- /dev/null
+++ b/install-bundler/install-grafana/custom-values.yaml
@@ -0,0 +1,21 @@
+datasources:
+ datasources.yaml:
+ apiVersion: 1
+ datasources:
+ - access: proxy
+ name: Prometheus
+ type: prometheus
+ url: http://qabundler-test-monitoring-prometheus-server
+
+dashboardProviders:
+ dashboardproviders.yaml:
+ apiVersion: 1
+ providers:
+ - name: 'default'
+ orgId: 1
+ folder: ''
+ type: file
+ disableDeletion: false
+ editable: true
+ options:
+ path: /var/lib/grafana/dashboards/default
\ No newline at end of file
diff --git a/install-bundler/install-grafana/datasources.yaml b/install-bundler/install-grafana/datasources.yaml
new file mode 100644
index 00000000..88d9d9e6
--- /dev/null
+++ b/install-bundler/install-grafana/datasources.yaml
@@ -0,0 +1,21 @@
+datasources:
+ datasources.yaml:
+ apiVersion: 1
+ datasources:
+ - access: proxy
+ name: Prometheus
+ type: prometheus
+ url: ${PROMETHEUS_URL}
+
+dashboardProviders:
+ dashboardproviders.yaml:
+ apiVersion: 1
+ providers:
+ - name: 'default'
+ orgId: 1
+ folder: ''
+ type: file
+ disableDeletion: false
+ editable: true
+ options:
+ path: /var/lib/grafana/dashboards/default
\ No newline at end of file
diff --git a/install-bundler/install-grafana/grafana/.helmignore b/install-bundler/install-grafana/grafana/.helmignore
new file mode 100644
index 00000000..8cade131
--- /dev/null
+++ b/install-bundler/install-grafana/grafana/.helmignore
@@ -0,0 +1,23 @@
+# Patterns to ignore when building packages.
+# This supports shell glob matching, relative path matching, and
+# negation (prefixed with !). Only one pattern per line.
+.DS_Store
+# Common VCS dirs
+.git/
+.gitignore
+.bzr/
+.bzrignore
+.hg/
+.hgignore
+.svn/
+# Common backup files
+*.swp
+*.bak
+*.tmp
+*~
+# Various IDEs
+.vscode
+.project
+.idea/
+*.tmproj
+OWNERS
diff --git a/install-bundler/install-grafana/grafana/Chart.yaml b/install-bundler/install-grafana/grafana/Chart.yaml
new file mode 100644
index 00000000..1f9776f5
--- /dev/null
+++ b/install-bundler/install-grafana/grafana/Chart.yaml
@@ -0,0 +1,33 @@
+annotations:
+ artifacthub.io/license: AGPL-3.0-only
+ artifacthub.io/links: |
+ - name: Chart Source
+ url: https://github.com/grafana/helm-charts
+ - name: Upstream Project
+ url: https://github.com/grafana/grafana
+apiVersion: v2
+appVersion: 10.1.1
+description: The leading tool for querying and visualizing time series and metrics.
+home: https://grafana.net
+icon: https://raw.githubusercontent.com/grafana/grafana/master/public/img/logo_transparent_400x.png
+keywords:
+- monitoring
+- metric
+kubeVersion: ^1.8.0-0
+maintainers:
+- email: zanhsieh@gmail.com
+ name: zanhsieh
+- email: rluckie@cisco.com
+ name: rtluckie
+- email: maor.friedman@redhat.com
+ name: maorfr
+- email: miroslav.hadzhiev@gmail.com
+ name: Xtigyro
+- email: mail@torstenwalter.de
+ name: torstenwalter
+name: grafana
+sources:
+- https://github.com/grafana/grafana
+- https://github.com/grafana/helm-charts
+type: application
+version: 6.59.4
diff --git a/install-bundler/install-grafana/grafana/README.md b/install-bundler/install-grafana/grafana/README.md
new file mode 100644
index 00000000..80ddcbb8
--- /dev/null
+++ b/install-bundler/install-grafana/grafana/README.md
@@ -0,0 +1,692 @@
+#Queries
+
+http_requests_total{pod=~".*statefulset.*"}
+
+# Grafana Helm Chart
+
+* Installs the web dashboarding system [Grafana](http://grafana.org/)
+
+## Get Repo Info
+
+```console
+helm repo add grafana https://grafana.github.io/helm-charts
+helm repo update
+```
+
+_See [helm repo](https://helm.sh/docs/helm/helm_repo/) for command documentation._
+
+## Installing the Chart
+
+To install the chart with the release name `my-release`:
+
+```console
+helm install my-release grafana/grafana
+```
+
+## Uninstalling the Chart
+
+To uninstall/delete the my-release deployment:
+
+```console
+helm delete my-release
+```
+
+The command removes all the Kubernetes components associated with the chart and deletes the release.
+
+## Upgrading an existing Release to a new major version
+
+A major chart version change (like v1.2.3 -> v2.0.0) indicates that there is an
+incompatible breaking change needing manual actions.
+
+### To 4.0.0 (And 3.12.1)
+
+This version requires Helm >= 2.12.0.
+
+### To 5.0.0
+
+You have to add --force to your helm upgrade command as the labels of the chart have changed.
+
+### To 6.0.0
+
+This version requires Helm >= 3.1.0.
+
+## Configuration
+
+| Parameter | Description | Default |
+|-------------------------------------------|-----------------------------------------------|---------------------------------------------------------|
+| `replicas` | Number of nodes | `1` |
+| `podDisruptionBudget.minAvailable` | Pod disruption minimum available | `nil` |
+| `podDisruptionBudget.maxUnavailable` | Pod disruption maximum unavailable | `nil` |
+| `podDisruptionBudget.apiVersion` | Pod disruption apiVersion | `nil` |
+| `deploymentStrategy` | Deployment strategy | `{ "type": "RollingUpdate" }` |
+| `livenessProbe` | Liveness Probe settings | `{ "httpGet": { "path": "/api/health", "port": 3000 } "initialDelaySeconds": 60, "timeoutSeconds": 30, "failureThreshold": 10 }` |
+| `readinessProbe` | Readiness Probe settings | `{ "httpGet": { "path": "/api/health", "port": 3000 } }`|
+| `securityContext` | Deployment securityContext | `{"runAsUser": 472, "runAsGroup": 472, "fsGroup": 472}` |
+| `priorityClassName` | Name of Priority Class to assign pods | `nil` |
+| `image.repository` | Image repository | `grafana/grafana` |
+| `image.tag` | Overrides the Grafana image tag whose default is the chart appVersion (`Must be >= 5.0.0`) | `` |
+| `image.sha` | Image sha (optional) | `` |
+| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
+| `image.pullSecrets` | Image pull secrets (can be templated) | `[]` |
+| `service.enabled` | Enable grafana service | `true` |
+| `service.type` | Kubernetes service type | `ClusterIP` |
+| `service.port` | Kubernetes port where service is exposed | `80` |
+| `service.portName` | Name of the port on the service | `service` |
+| `service.appProtocol` | Adds the appProtocol field to the service | `` |
+| `service.targetPort` | Internal service is port | `3000` |
+| `service.nodePort` | Kubernetes service nodePort | `nil` |
+| `service.annotations` | Service annotations (can be templated) | `{}` |
+| `service.labels` | Custom labels | `{}` |
+| `service.clusterIP` | internal cluster service IP | `nil` |
+| `service.loadBalancerIP` | IP address to assign to load balancer (if supported) | `nil` |
+| `service.loadBalancerSourceRanges` | list of IP CIDRs allowed access to lb (if supported) | `[]` |
+| `service.externalIPs` | service external IP addresses | `[]` |
+| `headlessService` | Create a headless service | `false` |
+| `extraExposePorts` | Additional service ports for sidecar containers| `[]` |
+| `hostAliases` | adds rules to the pod's /etc/hosts | `[]` |
+| `ingress.enabled` | Enables Ingress | `false` |
+| `ingress.annotations` | Ingress annotations (values are templated) | `{}` |
+| `ingress.labels` | Custom labels | `{}` |
+| `ingress.path` | Ingress accepted path | `/` |
+| `ingress.pathType` | Ingress type of path | `Prefix` |
+| `ingress.hosts` | Ingress accepted hostnames | `["chart-example.local"]` |
+| `ingress.extraPaths` | Ingress extra paths to prepend to every host configuration. Useful when configuring [custom actions with AWS ALB Ingress Controller](https://kubernetes-sigs.github.io/aws-alb-ingress-controller/guide/ingress/annotation/#actions). Requires `ingress.hosts` to have one or more host entries. | `[]` |
+| `ingress.tls` | Ingress TLS configuration | `[]` |
+| `ingress.ingressClassName` | Ingress Class Name. MAY be required for Kubernetes versions >= 1.18 | `""` |
+| `resources` | CPU/Memory resource requests/limits | `{}` |
+| `nodeSelector` | Node labels for pod assignment | `{}` |
+| `tolerations` | Toleration labels for pod assignment | `[]` |
+| `affinity` | Affinity settings for pod assignment | `{}` |
+| `extraInitContainers` | Init containers to add to the grafana pod | `{}` |
+| `extraContainers` | Sidecar containers to add to the grafana pod | `""` |
+| `extraContainerVolumes` | Volumes that can be mounted in sidecar containers | `[]` |
+| `extraLabels` | Custom labels for all manifests | `{}` |
+| `schedulerName` | Name of the k8s scheduler (other than default) | `nil` |
+| `persistence.enabled` | Use persistent volume to store data | `false` |
+| `persistence.type` | Type of persistence (`pvc` or `statefulset`) | `pvc` |
+| `persistence.size` | Size of persistent volume claim | `10Gi` |
+| `persistence.existingClaim` | Use an existing PVC to persist data (can be templated) | `nil` |
+| `persistence.storageClassName` | Type of persistent volume claim | `nil` |
+| `persistence.accessModes` | Persistence access modes | `[ReadWriteOnce]` |
+| `persistence.annotations` | PersistentVolumeClaim annotations | `{}` |
+| `persistence.finalizers` | PersistentVolumeClaim finalizers | `[ "kubernetes.io/pvc-protection" ]` |
+| `persistence.extraPvcLabels` | Extra labels to apply to a PVC. | `{}` |
+| `persistence.subPath` | Mount a sub dir of the persistent volume (can be templated) | `nil` |
+| `persistence.inMemory.enabled` | If persistence is not enabled, whether to mount the local storage in-memory to improve performance | `false` |
+| `persistence.inMemory.sizeLimit` | SizeLimit for the in-memory local storage | `nil` |
+| `initChownData.enabled` | If false, don't reset data ownership at startup | true |
+| `initChownData.image.repository` | init-chown-data container image repository | `busybox` |
+| `initChownData.image.tag` | init-chown-data container image tag | `1.31.1` |
+| `initChownData.image.sha` | init-chown-data container image sha (optional)| `""` |
+| `initChownData.image.pullPolicy` | init-chown-data container image pull policy | `IfNotPresent` |
+| `initChownData.resources` | init-chown-data pod resource requests & limits | `{}` |
+| `schedulerName` | Alternate scheduler name | `nil` |
+| `env` | Extra environment variables passed to pods | `{}` |
+| `envValueFrom` | Environment variables from alternate sources. See the API docs on [EnvVarSource](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#envvarsource-v1-core) for format details. Can be templated | `{}` |
+| `envFromSecret` | Name of a Kubernetes secret (must be manually created in the same namespace) containing values to be added to the environment. Can be templated | `""` |
+| `envFromSecrets` | List of Kubernetes secrets (must be manually created in the same namespace) containing values to be added to the environment. Can be templated | `[]` |
+| `envFromConfigMaps` | List of Kubernetes ConfigMaps (must be manually created in the same namespace) containing values to be added to the environment. Can be templated | `[]` |
+| `envRenderSecret` | Sensible environment variables passed to pods and stored as secret. (passed through [tpl](https://helm.sh/docs/howto/charts_tips_and_tricks/#using-the-tpl-function)) | `{}` |
+| `enableServiceLinks` | Inject Kubernetes services as environment variables. | `true` |
+| `extraSecretMounts` | Additional grafana server secret mounts | `[]` |
+| `extraVolumeMounts` | Additional grafana server volume mounts | `[]` |
+| `createConfigmap` | Enable creating the grafana configmap | `true` |
+| `extraConfigmapMounts` | Additional grafana server configMap volume mounts (values are templated) | `[]` |
+| `extraEmptyDirMounts` | Additional grafana server emptyDir volume mounts | `[]` |
+| `plugins` | Plugins to be loaded along with Grafana | `[]` |
+| `datasources` | Configure grafana datasources (passed through tpl) | `{}` |
+| `alerting` | Configure grafana alerting (passed through tpl) | `{}` |
+| `notifiers` | Configure grafana notifiers | `{}` |
+| `dashboardProviders` | Configure grafana dashboard providers | `{}` |
+| `dashboards` | Dashboards to import | `{}` |
+| `dashboardsConfigMaps` | ConfigMaps reference that contains dashboards | `{}` |
+| `grafana.ini` | Grafana's primary configuration | `{}` |
+| `global.imagePullSecrets` | Global image pull secrets (can be templated). Allows either an array of {name: pullSecret} maps (k8s-style), or an array of strings (more common helm-style). | `[]` |
+| `ldap.enabled` | Enable LDAP authentication | `false` |
+| `ldap.existingSecret` | The name of an existing secret containing the `ldap.toml` file, this must have the key `ldap-toml`. | `""` |
+| `ldap.config` | Grafana's LDAP configuration | `""` |
+| `annotations` | Deployment annotations | `{}` |
+| `labels` | Deployment labels | `{}` |
+| `podAnnotations` | Pod annotations | `{}` |
+| `podLabels` | Pod labels | `{}` |
+| `podPortName` | Name of the grafana port on the pod | `grafana` |
+| `lifecycleHooks` | Lifecycle hooks for podStart and preStop [Example](https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/#define-poststart-and-prestop-handlers) | `{}` |
+| `sidecar.image.repository` | Sidecar image repository | `quay.io/kiwigrid/k8s-sidecar` |
+| `sidecar.image.tag` | Sidecar image tag | `1.24.6` |
+| `sidecar.image.sha` | Sidecar image sha (optional) | `""` |
+| `sidecar.imagePullPolicy` | Sidecar image pull policy | `IfNotPresent` |
+| `sidecar.resources` | Sidecar resources | `{}` |
+| `sidecar.securityContext` | Sidecar securityContext | `{}` |
+| `sidecar.enableUniqueFilenames` | Sets the kiwigrid/k8s-sidecar UNIQUE_FILENAMES environment variable. If set to `true` the sidecar will create unique filenames where duplicate data keys exist between ConfigMaps and/or Secrets within the same or multiple Namespaces. | `false` |
+| `sidecar.alerts.enabled` | Enables the cluster wide search for alerts and adds/updates/deletes them in grafana |`false` |
+| `sidecar.alerts.label` | Label that config maps with alerts should have to be added | `grafana_alert` |
+| `sidecar.alerts.labelValue` | Label value that config maps with alerts should have to be added | `""` |
+| `sidecar.alerts.searchNamespace` | Namespaces list. If specified, the sidecar will search for alerts config-maps inside these namespaces. Otherwise the namespace in which the sidecar is running will be used. It's also possible to specify ALL to search in all namespaces. | `nil` |
+| `sidecar.alerts.watchMethod` | Method to use to detect ConfigMap changes. With WATCH the sidecar will do a WATCH requests, with SLEEP it will list all ConfigMaps, then sleep for 60 seconds. | `WATCH` |
+| `sidecar.alerts.resource` | Should the sidecar looks into secrets, configmaps or both. | `both` |
+| `sidecar.alerts.reloadURL` | Full url of datasource configuration reload API endpoint, to invoke after a config-map change | `"http://localhost:3000/api/admin/provisioning/alerting/reload"` |
+| `sidecar.alerts.skipReload` | Enabling this omits defining the REQ_URL and REQ_METHOD environment variables | `false` |
+| `sidecar.alerts.initDatasources` | Set to true to deploy the datasource sidecar as an initContainer in addition to a container. This is needed if skipReload is true, to load any alerts defined at startup time. | `false` |
+| `sidecar.alerts.extraMounts` | Additional alerts sidecar volume mounts. | `[]` |
+| `sidecar.dashboards.enabled` | Enables the cluster wide search for dashboards and adds/updates/deletes them in grafana | `false` |
+| `sidecar.dashboards.SCProvider` | Enables creation of sidecar provider | `true` |
+| `sidecar.dashboards.provider.name` | Unique name of the grafana provider | `sidecarProvider` |
+| `sidecar.dashboards.provider.orgid` | Id of the organisation, to which the dashboards should be added | `1` |
+| `sidecar.dashboards.provider.folder` | Logical folder in which grafana groups dashboards | `""` |
+| `sidecar.dashboards.provider.disableDelete` | Activate to avoid the deletion of imported dashboards | `false` |
+| `sidecar.dashboards.provider.allowUiUpdates` | Allow updating provisioned dashboards from the UI | `false` |
+| `sidecar.dashboards.provider.type` | Provider type | `file` |
+| `sidecar.dashboards.provider.foldersFromFilesStructure` | Allow Grafana to replicate dashboard structure from filesystem. | `false` |
+| `sidecar.dashboards.watchMethod` | Method to use to detect ConfigMap changes. With WATCH the sidecar will do a WATCH requests, with SLEEP it will list all ConfigMaps, then sleep for 60 seconds. | `WATCH` |
+| `sidecar.skipTlsVerify` | Set to true to skip tls verification for kube api calls | `nil` |
+| `sidecar.dashboards.label` | Label that config maps with dashboards should have to be added | `grafana_dashboard` |
+| `sidecar.dashboards.labelValue` | Label value that config maps with dashboards should have to be added | `""` |
+| `sidecar.dashboards.folder` | Folder in the pod that should hold the collected dashboards (unless `sidecar.dashboards.defaultFolderName` is set). This path will be mounted. | `/tmp/dashboards` |
+| `sidecar.dashboards.folderAnnotation` | The annotation the sidecar will look for in configmaps to override the destination folder for files | `nil` |
+| `sidecar.dashboards.defaultFolderName` | The default folder name, it will create a subfolder under the `sidecar.dashboards.folder` and put dashboards in there instead | `nil` |
+| `sidecar.dashboards.searchNamespace` | Namespaces list. If specified, the sidecar will search for dashboards config-maps inside these namespaces. Otherwise the namespace in which the sidecar is running will be used. It's also possible to specify ALL to search in all namespaces. | `nil` |
+| `sidecar.dashboards.script` | Absolute path to shell script to execute after a configmap got reloaded. | `nil` |
+| `sidecar.dashboards.reloadURL` | Full url of dashboards configuration reload API endpoint, to invoke after a config-map change | `"http://localhost:3000/api/admin/provisioning/dashboards/reload"` |
+| `sidecar.dashboards.skipReload` | Enabling this omits defining the REQ_USERNAME, REQ_PASSWORD, REQ_URL and REQ_METHOD environment variables | `false` |
+| `sidecar.dashboards.resource` | Should the sidecar looks into secrets, configmaps or both. | `both` |
+| `sidecar.dashboards.extraMounts` | Additional dashboard sidecar volume mounts. | `[]` |
+| `sidecar.datasources.enabled` | Enables the cluster wide search for datasources and adds/updates/deletes them in grafana |`false` |
+| `sidecar.datasources.label` | Label that config maps with datasources should have to be added | `grafana_datasource` |
+| `sidecar.datasources.labelValue` | Label value that config maps with datasources should have to be added | `""` |
+| `sidecar.datasources.searchNamespace` | Namespaces list. If specified, the sidecar will search for datasources config-maps inside these namespaces. Otherwise the namespace in which the sidecar is running will be used. It's also possible to specify ALL to search in all namespaces. | `nil` |
+| `sidecar.datasources.watchMethod` | Method to use to detect ConfigMap changes. With WATCH the sidecar will do a WATCH requests, with SLEEP it will list all ConfigMaps, then sleep for 60 seconds. | `WATCH` |
+| `sidecar.datasources.resource` | Should the sidecar looks into secrets, configmaps or both. | `both` |
+| `sidecar.datasources.reloadURL` | Full url of datasource configuration reload API endpoint, to invoke after a config-map change | `"http://localhost:3000/api/admin/provisioning/datasources/reload"` |
+| `sidecar.datasources.skipReload` | Enabling this omits defining the REQ_URL and REQ_METHOD environment variables | `false` |
+| `sidecar.datasources.initDatasources` | Set to true to deploy the datasource sidecar as an initContainer in addition to a container. This is needed if skipReload is true, to load any datasources defined at startup time. | `false` |
+| `sidecar.notifiers.enabled` | Enables the cluster wide search for notifiers and adds/updates/deletes them in grafana | `false` |
+| `sidecar.notifiers.label` | Label that config maps with notifiers should have to be added | `grafana_notifier` |
+| `sidecar.notifiers.labelValue` | Label value that config maps with notifiers should have to be added | `""` |
+| `sidecar.notifiers.searchNamespace` | Namespaces list. If specified, the sidecar will search for notifiers config-maps (or secrets) inside these namespaces. Otherwise the namespace in which the sidecar is running will be used. It's also possible to specify ALL to search in all namespaces. | `nil` |
+| `sidecar.notifiers.watchMethod` | Method to use to detect ConfigMap changes. With WATCH the sidecar will do a WATCH requests, with SLEEP it will list all ConfigMaps, then sleep for 60 seconds. | `WATCH` |
+| `sidecar.notifiers.resource` | Should the sidecar looks into secrets, configmaps or both. | `both` |
+| `sidecar.notifiers.reloadURL` | Full url of notifier configuration reload API endpoint, to invoke after a config-map change | `"http://localhost:3000/api/admin/provisioning/notifications/reload"` |
+| `sidecar.notifiers.skipReload` | Enabling this omits defining the REQ_URL and REQ_METHOD environment variables | `false` |
+| `sidecar.notifiers.initNotifiers` | Set to true to deploy the notifier sidecar as an initContainer in addition to a container. This is needed if skipReload is true, to load any notifiers defined at startup time. | `false` |
+| `smtp.existingSecret` | The name of an existing secret containing the SMTP credentials. | `""` |
+| `smtp.userKey` | The key in the existing SMTP secret containing the username. | `"user"` |
+| `smtp.passwordKey` | The key in the existing SMTP secret containing the password. | `"password"` |
+| `admin.existingSecret` | The name of an existing secret containing the admin credentials (can be templated). | `""` |
+| `admin.userKey` | The key in the existing admin secret containing the username. | `"admin-user"` |
+| `admin.passwordKey` | The key in the existing admin secret containing the password. | `"admin-password"` |
+| `serviceAccount.autoMount` | Automount the service account token in the pod| `true` |
+| `serviceAccount.annotations` | ServiceAccount annotations | |
+| `serviceAccount.create` | Create service account | `true` |
+| `serviceAccount.labels` | ServiceAccount labels | `{}` |
+| `serviceAccount.name` | Service account name to use, when empty will be set to created account if `serviceAccount.create` is set else to `default` | `` |
+| `serviceAccount.nameTest` | Service account name to use for test, when empty will be set to created account if `serviceAccount.create` is set else to `default` | `nil` |
+| `rbac.create` | Create and use RBAC resources | `true` |
+| `rbac.namespaced` | Creates Role and Rolebinding instead of the default ClusterRole and ClusteRoleBindings for the grafana instance | `false` |
+| `rbac.useExistingRole` | Set to a rolename to use existing role - skipping role creating - but still doing serviceaccount and rolebinding to the rolename set here. | `nil` |
+| `rbac.pspEnabled` | Create PodSecurityPolicy (with `rbac.create`, grant roles permissions as well) | `false` |
+| `rbac.pspUseAppArmor` | Enforce AppArmor in created PodSecurityPolicy (requires `rbac.pspEnabled`) | `false` |
+| `rbac.extraRoleRules` | Additional rules to add to the Role | [] |
+| `rbac.extraClusterRoleRules` | Additional rules to add to the ClusterRole | [] |
+| `command` | Define command to be executed by grafana container at startup | `nil` |
+| `args` | Define additional args if command is used | `nil` |
+| `testFramework.enabled` | Whether to create test-related resources | `true` |
+| `testFramework.image` | `test-framework` image repository. | `bats/bats` |
+| `testFramework.tag` | `test-framework` image tag. | `v1.4.1` |
+| `testFramework.imagePullPolicy` | `test-framework` image pull policy. | `IfNotPresent` |
+| `testFramework.securityContext` | `test-framework` securityContext | `{}` |
+| `downloadDashboards.env` | Environment variables to be passed to the `download-dashboards` container | `{}` |
+| `downloadDashboards.envFromSecret` | Name of a Kubernetes secret (must be manually created in the same namespace) containing values to be added to the environment. Can be templated | `""` |
+| `downloadDashboards.resources` | Resources of `download-dashboards` container | `{}` |
+| `downloadDashboardsImage.repository` | Curl docker image repo | `curlimages/curl` |
+| `downloadDashboardsImage.tag` | Curl docker image tag | `7.73.0` |
+| `downloadDashboardsImage.sha` | Curl docker image sha (optional) | `""` |
+| `downloadDashboardsImage.pullPolicy` | Curl docker image pull policy | `IfNotPresent` |
+| `namespaceOverride` | Override the deployment namespace | `""` (`Release.Namespace`) |
+| `serviceMonitor.enabled` | Use servicemonitor from prometheus operator | `false` |
+| `serviceMonitor.namespace` | Namespace this servicemonitor is installed in | |
+| `serviceMonitor.interval` | How frequently Prometheus should scrape | `1m` |
+| `serviceMonitor.path` | Path to scrape | `/metrics` |
+| `serviceMonitor.scheme` | Scheme to use for metrics scraping | `http` |
+| `serviceMonitor.tlsConfig` | TLS configuration block for the endpoint | `{}` |
+| `serviceMonitor.labels` | Labels for the servicemonitor passed to Prometheus Operator | `{}` |
+| `serviceMonitor.scrapeTimeout` | Timeout after which the scrape is ended | `30s` |
+| `serviceMonitor.relabelings` | RelabelConfigs to apply to samples before scraping. | `[]` |
+| `serviceMonitor.metricRelabelings` | MetricRelabelConfigs to apply to samples before ingestion. | `[]` |
+| `revisionHistoryLimit` | Number of old ReplicaSets to retain | `10` |
+| `imageRenderer.enabled` | Enable the image-renderer deployment & service | `false` |
+| `imageRenderer.image.repository` | image-renderer Image repository | `grafana/grafana-image-renderer` |
+| `imageRenderer.image.tag` | image-renderer Image tag | `latest` |
+| `imageRenderer.image.sha` | image-renderer Image sha (optional) | `""` |
+| `imageRenderer.image.pullPolicy` | image-renderer ImagePullPolicy | `Always` |
+| `imageRenderer.env` | extra env-vars for image-renderer | `{}` |
+| `imageRenderer.envValueFrom` | Environment variables for image-renderer from alternate sources. See the API docs on [EnvVarSource](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#envvarsource-v1-core) for format details. Can be templated | `{}` |
+| `imageRenderer.serviceAccountName` | image-renderer deployment serviceAccountName | `""` |
+| `imageRenderer.securityContext` | image-renderer deployment securityContext | `{}` |
+| `imageRenderer.hostAliases` | image-renderer deployment Host Aliases | `[]` |
+| `imageRenderer.priorityClassName` | image-renderer deployment priority class | `''` |
+| `imageRenderer.service.enabled` | Enable the image-renderer service | `true` |
+| `imageRenderer.service.portName` | image-renderer service port name | `http` |
+| `imageRenderer.service.port` | image-renderer port used by deployment | `8081` |
+| `imageRenderer.service.targetPort` | image-renderer service port used by service | `8081` |
+| `imageRenderer.appProtocol` | Adds the appProtocol field to the service | `` |
+| `imageRenderer.grafanaSubPath` | Grafana sub path to use for image renderer callback url | `''` |
+| `imageRenderer.podPortName` | name of the image-renderer port on the pod | `http` |
+| `imageRenderer.revisionHistoryLimit` | number of image-renderer replica sets to keep | `10` |
+| `imageRenderer.networkPolicy.limitIngress` | Enable a NetworkPolicy to limit inbound traffic from only the created grafana pods | `true` |
+| `imageRenderer.networkPolicy.limitEgress` | Enable a NetworkPolicy to limit outbound traffic to only the created grafana pods | `false` |
+| `imageRenderer.resources` | Set resource limits for image-renderer pods | `{}` |
+| `imageRenderer.nodeSelector` | Node labels for pod assignment | `{}` |
+| `imageRenderer.tolerations` | Toleration labels for pod assignment | `[]` |
+| `imageRenderer.affinity` | Affinity settings for pod assignment | `{}` |
+| `networkPolicy.enabled` | Enable creation of NetworkPolicy resources. | `false` |
+| `networkPolicy.allowExternal` | Don't require client label for connections | `true` |
+| `networkPolicy.explicitNamespacesSelector` | A Kubernetes LabelSelector to explicitly select namespaces from which traffic could be allowed | `{}` |
+| `networkPolicy.ingress` | Enable the creation of an ingress network policy | `true` |
+| `networkPolicy.egress.enabled` | Enable the creation of an egress network policy | `false` |
+| `networkPolicy.egress.ports` | An array of ports to allow for the egress | `[]` |
+| `enableKubeBackwardCompatibility` | Enable backward compatibility of kubernetes where pod's defintion version below 1.13 doesn't have the enableServiceLinks option | `false` |
+
+### Example ingress with path
+
+With grafana 6.3 and above
+
+```yaml
+grafana.ini:
+ server:
+ domain: monitoring.example.com
+ root_url: "%(protocol)s://%(domain)s/grafana"
+ serve_from_sub_path: true
+ingress:
+ enabled: true
+ hosts:
+ - "monitoring.example.com"
+ path: "/grafana"
+```
+
+### Example of extraVolumeMounts
+
+Volume can be type persistentVolumeClaim or hostPath but not both at same time.
+If neither existingClaim or hostPath argument is given then type is emptyDir.
+
+```yaml
+- extraVolumeMounts:
+ - name: plugins
+ mountPath: /var/lib/grafana/plugins
+ subPath: configs/grafana/plugins
+ existingClaim: existing-grafana-claim
+ readOnly: false
+ - name: dashboards
+ mountPath: /var/lib/grafana/dashboards
+ hostPath: /usr/shared/grafana/dashboards
+ readOnly: false
+```
+
+## Import dashboards
+
+There are a few methods to import dashboards to Grafana. Below are some examples and explanations as to how to use each method:
+
+```yaml
+dashboards:
+ default:
+ some-dashboard:
+ json: |
+ {
+ "annotations":
+
+ ...
+ # Complete json file here
+ ...
+
+ "title": "Some Dashboard",
+ "uid": "abcd1234",
+ "version": 1
+ }
+ custom-dashboard:
+ # This is a path to a file inside the dashboards directory inside the chart directory
+ file: dashboards/custom-dashboard.json
+ prometheus-stats:
+ # Ref: https://grafana.com/dashboards/2
+ gnetId: 2
+ revision: 2
+ datasource: Prometheus
+ loki-dashboard-quick-search:
+ gnetId: 12019
+ revision: 2
+ datasource:
+ - name: DS_PROMETHEUS
+ value: Prometheus
+ - name: DS_LOKI
+ value: Loki
+ local-dashboard:
+ url: https://raw.githubusercontent.com/user/repository/master/dashboards/dashboard.json
+```
+
+## BASE64 dashboards
+
+Dashboards could be stored on a server that does not return JSON directly and instead of it returns a Base64 encoded file (e.g. Gerrit)
+A new parameter has been added to the url use case so if you specify a b64content value equals to true after the url entry a Base64 decoding is applied before save the file to disk.
+If this entry is not set or is equals to false not decoding is applied to the file before saving it to disk.
+
+### Gerrit use case
+
+Gerrit API for download files has the following schema: where {project-name} and
+{file-id} usually has '/' in their values and so they MUST be replaced by %2F so if project-name is user/repo, branch-id is master and file-id is equals to dir1/dir2/dashboard
+the url value is
+
+## Sidecar for dashboards
+
+If the parameter `sidecar.dashboards.enabled` is set, a sidecar container is deployed in the grafana
+pod. This container watches all configmaps (or secrets) in the cluster and filters out the ones with
+a label as defined in `sidecar.dashboards.label`. The files defined in those configmaps are written
+to a folder and accessed by grafana. Changes to the configmaps are monitored and the imported
+dashboards are deleted/updated.
+
+A recommendation is to use one configmap per dashboard, as a reduction of multiple dashboards inside
+one configmap is currently not properly mirrored in grafana.
+
+Example dashboard config:
+
+```yaml
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: sample-grafana-dashboard
+ labels:
+ grafana_dashboard: "1"
+data:
+ k8s-dashboard.json: |-
+ [...]
+```
+
+## Sidecar for datasources
+
+If the parameter `sidecar.datasources.enabled` is set, an init container is deployed in the grafana
+pod. This container lists all secrets (or configmaps, though not recommended) in the cluster and
+filters out the ones with a label as defined in `sidecar.datasources.label`. The files defined in
+those secrets are written to a folder and accessed by grafana on startup. Using these yaml files,
+the data sources in grafana can be imported.
+
+Should you aim for reloading datasources in Grafana each time the config is changed, set `sidecar.datasources.skipReload: false` and adjust `sidecar.datasources.reloadURL` to `http://..svc.cluster.local/api/admin/provisioning/datasources/reload`.
+
+Secrets are recommended over configmaps for this usecase because datasources usually contain private
+data like usernames and passwords. Secrets are the more appropriate cluster resource to manage those.
+
+Example values to add a postgres datasource as a kubernetes secret:
+```yaml
+apiVersion: v1
+kind: Secret
+metadata:
+ name: grafana-datasources
+ labels:
+ grafana_datasource: 'true' # default value for: sidecar.datasources.label
+stringData:
+ pg-db.yaml: |-
+ apiVersion: 1
+ datasources:
+ - name: My pg db datasource
+ type: postgres
+ url: my-postgresql-db:5432
+ user: db-readonly-user
+ secureJsonData:
+ password: 'SUperSEcretPa$$word'
+ jsonData:
+ database: my_datase
+ sslmode: 'disable' # disable/require/verify-ca/verify-full
+ maxOpenConns: 0 # Grafana v5.4+
+ maxIdleConns: 2 # Grafana v5.4+
+ connMaxLifetime: 14400 # Grafana v5.4+
+ postgresVersion: 1000 # 903=9.3, 904=9.4, 905=9.5, 906=9.6, 1000=10
+ timescaledb: false
+ # allow users to edit datasources from the UI.
+ editable: false
+```
+
+Example values to add a datasource adapted from [Grafana](http://docs.grafana.org/administration/provisioning/#example-datasource-config-file):
+
+```yaml
+datasources:
+ datasources.yaml:
+ apiVersion: 1
+ datasources:
+ # name of the datasource. Required
+ - name: Graphite
+ # datasource type. Required
+ type: graphite
+ # access mode. proxy or direct (Server or Browser in the UI). Required
+ access: proxy
+ # org id. will default to orgId 1 if not specified
+ orgId: 1
+ # url
+ url: http://localhost:8080
+ # database password, if used
+ password:
+ # database user, if used
+ user:
+ # database name, if used
+ database:
+ # enable/disable basic auth
+ basicAuth:
+ # basic auth username
+ basicAuthUser:
+ # basic auth password
+ basicAuthPassword:
+ # enable/disable with credentials headers
+ withCredentials:
+ # mark as default datasource. Max one per org
+ isDefault:
+ #