named templates for local k8s DNS resolution

This commit is contained in:
Martin McKeaveney 2021-08-16 15:15:07 +01:00
parent a248084c56
commit 0d6b0c887b
9 changed files with 45 additions and 32 deletions

View File

@ -26,6 +26,13 @@ CouchDB secret identifier
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}} {{- end -}}
{{/*
Internal DNS
*/}}
{{- define "budibase.serviceDns" -}}
{{- printf "%s.%s.%s" .Release.Namespace "svc" .Values.services.dns -}}
{{- end -}}
{{/* {{/*
Create chart name and version as used by the chart label. Create chart name and version as used by the chart label.
*/}} */}}

View File

@ -29,7 +29,8 @@ spec:
- name: BUDIBASE_ENVIRONMENT - name: BUDIBASE_ENVIRONMENT
value: {{ .Values.globals.budibaseEnv }} value: {{ .Values.globals.budibaseEnv }}
- name: COUCH_DB_URL - name: COUCH_DB_URL
value: {{ .Values.services.couchdb.url | quote }} # Or inject value directly
value: couchdb-service.{{ include "budibase.serviceDns" . }}:{{ .Values.services.couchdb.port }}
- name: ENABLE_ANALYTICS - name: ENABLE_ANALYTICS
value: {{ .Values.globals.enableAnalytics | quote }} value: {{ .Values.globals.enableAnalytics | quote }}
- name: INTERNAL_API_KEY - name: INTERNAL_API_KEY
@ -55,19 +56,21 @@ spec:
name: {{ template "budibase.fullname" . }} name: {{ template "budibase.fullname" . }}
key: objectStoreSecret key: objectStoreSecret
- name: MINIO_URL - name: MINIO_URL
value: {{ .Values.services.object_store.url }} # Or inject value directly
value: minio-service.{{ include "budibase.serviceDns" . }}{{ .Values.services.objectStore.port }}
- name: PORT - name: PORT
value: {{ .Values.services.apps.port | quote }} value: {{ .Values.services.apps.port | quote }}
- name: REDIS_PASSWORD - name: REDIS_PASSWORD
value: {{ .Values.services.redis.password }} value: {{ .Values.services.redis.password }}
- name: REDIS_URL - name: REDIS_URL
value: "{{ .Values.services.redis.host }}:{{ .Values.services.redis.port }}" # Or inject value directly
value: redis-service.{{ include "budibase.serviceDns" . }}:{{ .Values.services.redis.port }}
- name: SELF_HOSTED - name: SELF_HOSTED
value: {{ .Values.globals.selfHosted | quote }} value: {{ .Values.globals.selfHosted | quote }}
- name: SENTRY_DSN - name: SENTRY_DSN
value: {{ .Values.globals.sentryDSN }} value: {{ .Values.globals.sentryDSN }}
- name: WORKER_URL - name: WORKER_URL
value: "{{ .Values.services.worker.host }}:{{ .Values.services.worker.port }}" value: worker-service.{{ include "budibase.serviceDns" . }}:{{ .Values.services.worker.port }}
image: budibase/apps image: budibase/apps
imagePullPolicy: Always imagePullPolicy: Always
name: bbapps name: bbapps

View File

@ -1,4 +1,4 @@
{{- if .Values.services.object_store.minio }} {{- if .Values.services.objectStore.minio }}
apiVersion: v1 apiVersion: v1
kind: PersistentVolumeClaim kind: PersistentVolumeClaim
metadata: metadata:
@ -11,6 +11,6 @@ spec:
- ReadWriteOnce - ReadWriteOnce
resources: resources:
requests: requests:
storage: {{ .Values.services.object_store.storage }} storage: {{ .Values.services.objectStore.storage }}
status: {} status: {}
{{- end }} {{- end }}

View File

@ -1,4 +1,4 @@
{{- if .Values.services.object_store.minio }} {{- if .Values.services.objectStore.minio }}
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
@ -31,19 +31,17 @@ spec:
- /data - /data
env: env:
- name: MINIO_BROWSER - name: MINIO_BROWSER
value: {{ .Values.services.object_store.browser | quote }} value: {{ .Values.services.objectStore.browser | quote }}
- name: MINIO_ACCESS_KEY - name: MINIO_ACCESS_KEY
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: {{ template "budibase.fullname" . }} name: {{ template "budibase.fullname" . }}
key: objectStoreAccess key: objectStoreAccess
# value: {{ .Values.services.object_store.accessKey }}
- name: MINIO_SECRET_KEY - name: MINIO_SECRET_KEY
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: {{ template "budibase.fullname" . }} name: {{ template "budibase.fullname" . }}
key: objectStoreSecret key: objectStoreSecret
# value: {{ .Values.services.object_store.secretKey }}
image: minio/minio image: minio/minio
imagePullPolicy: "" imagePullPolicy: ""
livenessProbe: livenessProbe:
@ -57,7 +55,7 @@ spec:
timeoutSeconds: 20 timeoutSeconds: 20
name: minio-service name: minio-service
ports: ports:
- containerPort: {{ .Values.services.object_store.port }} - containerPort: {{ .Values.services.objectStore.port }}
resources: {} resources: {}
volumeMounts: volumeMounts:
- mountPath: /data - mountPath: /data

View File

@ -1,4 +1,4 @@
{{- if .Values.services.object_store.minio }} {{- if .Values.services.objectStore.minio }}
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
@ -11,9 +11,9 @@ metadata:
name: minio-service name: minio-service
spec: spec:
ports: ports:
- name: {{ .Values.services.object_store.port | quote }} - name: {{ .Values.services.objectStore.port | quote }}
port: {{ .Values.services.object_store.port }} port: {{ .Values.services.objectStore.port }}
targetPort: {{ .Values.services.object_store.port }} targetPort: {{ .Values.services.objectStore.port }}
selector: selector:
io.kompose.service: minio-service io.kompose.service: minio-service
status: status:

View File

@ -12,6 +12,6 @@ type: Opaque
data: data:
internalApiKey: {{ template "budibase.defaultsecret" .Values.globals.internalApiKey }} internalApiKey: {{ template "budibase.defaultsecret" .Values.globals.internalApiKey }}
jwtSecret: {{ template "budibase.defaultsecret" .Values.globals.jwtSecret }} jwtSecret: {{ template "budibase.defaultsecret" .Values.globals.jwtSecret }}
objectStoreAccess: {{ template "budibase.defaultsecret" .Values.services.object_store.accessKey }} objectStoreAccess: {{ template "budibase.defaultsecret" .Values.services.objectStore.accessKey }}
objectStoreSecret: {{ template "budibase.defaultsecret" .Values.services.object_store.secretKey }} objectStoreSecret: {{ template "budibase.defaultsecret" .Values.services.objectStore.secretKey }}
{{- end -}} {{- end -}}

View File

@ -40,7 +40,7 @@ spec:
name: {{ template "couchdb.fullname" . }} name: {{ template "couchdb.fullname" . }}
key: adminPassword key: adminPassword
- name: COUCH_DB_URL - name: COUCH_DB_URL
value: {{ .Values.services.couchdb.url | quote }} value: http://couchdb-service.{{ include "budibase.serviceDns" . }}:{{ .Values.services.couchdb.port }}
- name: INTERNAL_API_KEY - name: INTERNAL_API_KEY
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
@ -62,13 +62,13 @@ spec:
name: {{ template "budibase.fullname" . }} name: {{ template "budibase.fullname" . }}
key: objectStoreSecret key: objectStoreSecret
- name: MINIO_URL - name: MINIO_URL
value: {{ .Values.services.object_store.url }} value: minio-service.{{ include "budibase.serviceDns" . }}{{ .Values.services.objectStore.port }}
- name: PORT - name: PORT
value: {{ .Values.services.worker.port | quote }} value: {{ .Values.services.worker.port | quote }}
- name: REDIS_PASSWORD - name: REDIS_PASSWORD
value: {{ .Values.services.redis.password | quote }} value: {{ .Values.services.redis.password | quote }}
- name: REDIS_URL - name: REDIS_URL
value: "{{ .Values.services.redis.host }}:{{ .Values.services.redis.port }}" value: redis-service.{{ include "budibase.serviceDns" . }}{{ .Values.services.redis.port }}
- name: SELF_HOSTED - name: SELF_HOSTED
value: {{ .Values.globals.selfHosted | quote }} value: {{ .Values.globals.selfHosted | quote }}
image: budibase/worker image: budibase/worker

View File

@ -88,14 +88,16 @@ globals:
sentryDSN: "" sentryDSN: ""
logLevel: info logLevel: info
selfHosted: 1 selfHosted: 1
# creates an internal API key, JWT secrets and redis password for you createSecrets: true # creates an internal API key, JWT secrets and redis password for you
createSecrets: true
# if createSecrets is set to false, you can hard-code your secrets here # if createSecrets is set to false, you can hard-code your secrets here
internalApiKey: "" internalApiKey: ""
jwtSecret: "" jwtSecret: ""
services: services:
dns: cluster.local
proxy: proxy:
port: 10000 port: 10000
replicaCount: 1 replicaCount: 1
@ -114,28 +116,27 @@ services:
couchdb: couchdb:
replicaCount: 3 replicaCount: 3
host: budibase-prod-svc-couchdb url: "" # only change if pointing to existing couch server
url: budibase-prod-svc-couchdb # only change if pointing to existing couch server
user: "" # only change if pointing to existing couch server user: "" # only change if pointing to existing couch server
password: "" # only change if pointing to existing couch server password: "" # only change if pointing to existing couch server
port: 5678 port: 5678
storage: 100Mi storage: 100Mi
redis: redis:
# disable if using external redis enabled: true # disable if using external redis
enabled: true
port: 6379 port: 6379
replicaCount: 1 replicaCount: 1
host: "" # only change if pointing to existing redis cluster and enabled: false
password: "budibase" # recommended to override if using built-in redis password: "budibase" # recommended to override if using built-in redis
storage: 100Mi storage: 100Mi
object_store: objectStore:
minio: false minio: true
browser: true browser: true
accessKey: "" # AWS_ACCESS_KEY or existing minio access key
secretKey: "" # AWS_SECRET_ACCESS_KEY or existing minio secret
url: minio-service.budibase.svc.cluster.local:9000
port: 9000 port: 9000
replicaCount: 1 replicaCount: 1
accessKey: "" # AWS_ACCESS_KEY if using S3 or existing minio access key
secretKey: "" # AWS_SECRET_ACCESS_KEY if using S3 or existing minio secret
url: "" # only change if pointing to existing minio cluster and minio: false
storage: 100Mi storage: 100Mi

View File

@ -11,7 +11,11 @@ PouchDB.plugin(find)
PouchDB.adapter("writableStream", replicationStream.adapters.writableStream) PouchDB.adapter("writableStream", replicationStream.adapters.writableStream)
let POUCH_DB_DEFAULTS = { let POUCH_DB_DEFAULTS = {
prefix: COUCH_DB_URL prefix: COUCH_DB_URL,
auth: {
username: env.COUCH_DB_USER,
password: env.COUCH_DB_PASSWORD,
}
} }
if (env.isTest()) { if (env.isTest()) {