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 "-" -}}
{{- 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.
*/}}

View File

@ -29,7 +29,8 @@ spec:
- name: BUDIBASE_ENVIRONMENT
value: {{ .Values.globals.budibaseEnv }}
- 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
value: {{ .Values.globals.enableAnalytics | quote }}
- name: INTERNAL_API_KEY
@ -55,19 +56,21 @@ spec:
name: {{ template "budibase.fullname" . }}
key: objectStoreSecret
- 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
value: {{ .Values.services.apps.port | quote }}
- name: REDIS_PASSWORD
value: {{ .Values.services.redis.password }}
- 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
value: {{ .Values.globals.selfHosted | quote }}
- name: SENTRY_DSN
value: {{ .Values.globals.sentryDSN }}
- 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
imagePullPolicy: Always
name: bbapps

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -11,7 +11,11 @@ PouchDB.plugin(find)
PouchDB.adapter("writableStream", replicationStream.adapters.writableStream)
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()) {