From 5e87a317fad9b83369dac9693272aa0611ad2e64 Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Sun, 4 Dec 2022 22:37:51 -0500 Subject: [PATCH] helm mongo db deployment --- .../templates/backend-deployment.yaml | 3 + helm-charts/infisical/templates/ingress.yaml | 12 ++-- .../templates/mongodb-deployment.yaml | 40 +++++++++++ helm-charts/infisical/values.yaml | 70 +++++++++++++++---- 4 files changed, 105 insertions(+), 20 deletions(-) create mode 100644 helm-charts/infisical/templates/mongodb-deployment.yaml diff --git a/helm-charts/infisical/templates/backend-deployment.yaml b/helm-charts/infisical/templates/backend-deployment.yaml index f3ff2bb47..ca45c528b 100644 --- a/helm-charts/infisical/templates/backend-deployment.yaml +++ b/helm-charts/infisical/templates/backend-deployment.yaml @@ -23,6 +23,9 @@ spec: - containerPort: 4000 env: {{- range $key, $value := .Values.secrets }} + {{- if eq $value "MUST_REPLACE" }} + {{ fail "Environment variables are not set. Please set all environment variables to continue." }} + {{ end }} - name: {{ $key }} value: {{ $value }} {{- end }} diff --git a/helm-charts/infisical/templates/ingress.yaml b/helm-charts/infisical/templates/ingress.yaml index 3ff88e25b..e8b0febb3 100644 --- a/helm-charts/infisical/templates/ingress.yaml +++ b/helm-charts/infisical/templates/ingress.yaml @@ -1,3 +1,4 @@ +{{ if .Values.ingress.enabled }} apiVersion: networking.k8s.io/v1 kind: Ingress metadata: @@ -22,17 +23,18 @@ spec: - host: {{ .Values.ingress.hostName}} http: paths: - - path: / - pathType: Prefix + - path: {{ .Values.ingress.frontend.path }} + pathType: {{ .Values.ingress.frontend.pathType }} backend: service: name: infisical-frontend-service port: number: 3000 - - path: /api - pathType: Prefix + - path: {{ .Values.ingress.backend.path }} + pathType: {{ .Values.ingress.backend.pathType }} backend: service: name: infisical-backend-service port: - number: 4000 \ No newline at end of file + number: 4000 +{{ end }} \ No newline at end of file diff --git a/helm-charts/infisical/templates/mongodb-deployment.yaml b/helm-charts/infisical/templates/mongodb-deployment.yaml new file mode 100644 index 000000000..02d380b1e --- /dev/null +++ b/helm-charts/infisical/templates/mongodb-deployment.yaml @@ -0,0 +1,40 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: mongodb-deployment + namespace: {{ .Values.namespace }} + labels: + app: mongodb +spec: + replicas: 1 # Cannot be scaled. To scale, you must set up Stateful Set + selector: + matchLabels: + app: mongodb + template: + metadata: + labels: + app: mongodb + spec: + containers: + - name: mongodb + image: mongo + ports: + - containerPort: 27017 + env: + - name: MONGO_INITDB_ROOT_USERNAME + value: root + - name: MONGO_INITDB_ROOT_PASSWORD + value: root +--- +apiVersion: v1 +kind: Service +metadata: + name: mongodb-service + namespace: {{ .Values.namespace }} +spec: + selector: + app: mongodb + ports: + - protocol: TCP + port: 27017 + targetPort: 27017 # container port diff --git a/helm-charts/infisical/values.yaml b/helm-charts/infisical/values.yaml index a4c032899..94bce75ef 100644 --- a/helm-charts/infisical/values.yaml +++ b/helm-charts/infisical/values.yaml @@ -1,3 +1,8 @@ +##### +# INFISICAL K8 DEFAULT VALUES FIL +# PLEASE REPLACE VALUES/EDIT AS REQUIRED +##### + namespace: infisical frontend: @@ -15,22 +20,57 @@ backend: tag: "latest" ingress: - enabled: false - annotations: [] + enabled: true + annotations: {} hostName: example.com - tls: {} + frontend: + path: / + pathType: Prefix + backend: + path: /api + pathType: Prefix + tls: [] +## Complete Ingress example +# ingress: +# enabled: true +# annotations: +# kubernetes.io/ingress.class: "nginx" +# cert-manager.io/issuer: letsencrypt-nginx +# hostName: example.com +# frontend: +# path: / +# pathType: Prefix +# backend: +# path: /api +# pathType: Prefix +# tls: +# hosts: +# - k8.infisical.com +# secretName: letsencrypt-nginx + +### +### YOU MUST FILL IN ALL SECRETS BELOW +### secrets: - PRIVATE_KEY: REQUIRED - PUBLIC_KEY: REQUIRED - ENCRYPTION_KEY: REQUIRED - JWT_SIGNUP_SECRET: REQUIRED - JWT_REFRESH_SECRET: REQUIRED - JWT_AUTH_SECRET: REQUIRED - NODE_ENV: development - SMTP_HOST: REQUIRED - SMTP_NAME: REQUIRED - SMTP_USERNAME: REQUIRED - SMTP_PASSWORD: REQUIRED - MONGO_URL: REQUIRED + # Required keys for platform encryption/decryption ops. Replace with nacl sk keys + PRIVATE_KEY: MUST_REPLACE + PUBLIC_KEY: MUST_REPLACE + ENCRYPTION_KEY: MUST_REPLACE + + # JWT + # Required secrets to sign JWT tokens + JWT_SIGNUP_SECRET: MUST_REPLACE + JWT_REFRESH_SECRET: MUST_REPLACE + JWT_AUTH_SECRET: MUST_REPLACE + + # Mail/SMTP + # Required to send emails + SMTP_HOST: MUST_REPLACE + SMTP_NAME: MUST_REPLACE + SMTP_USERNAME: MUST_REPLACE + SMTP_PASSWORD: MUST_REPLACE + + # You may replace with Mongo Cloud URI + MONGO_URL: mongodb://root:root@mongodb-service:27017/ \ No newline at end of file