use patched helm chart k8s-at-home/bitwardenrs
This commit is contained in:
@ -1,7 +1,9 @@
|
||||
1. Get the application URL by running these commands:
|
||||
{{- if .Values.ingress.enabled }}
|
||||
{{- range .Values.ingress.hosts }}
|
||||
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }}
|
||||
{{- 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 "bitwarden.fullname" . }})
|
||||
@ -9,11 +11,11 @@
|
||||
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 svc -w {{ include "bitwarden.fullname" . }}'
|
||||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "bitwarden.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
|
||||
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "bitwarden.fullname" . }}'
|
||||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "bitwarden.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 "bitwarden.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
|
||||
echo "Visit http://127.0.0.1:8080 to use your application"
|
||||
kubectl port-forward $POD_NAME 8080:80
|
||||
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80
|
||||
{{- end }}
|
||||
|
38
bitwarden/templates/_database.tpl
Normal file
38
bitwarden/templates/_database.tpl
Normal file
@ -0,0 +1,38 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Generate environment variables for external database
|
||||
*/}}
|
||||
{{- define "bitwarden.externalDatabaseConfigMap" -}}
|
||||
{{- with .Values.bitwarden.externalDatabase }}
|
||||
{{- if and .enabled (or (eq .type "postgresql") (eq .type "mysql")) }}
|
||||
{{- if and (not .existingSecret.enabled) .user }}
|
||||
DATABASE_USER: {{ .user | quote }}
|
||||
{{- end }}
|
||||
{{- if and (not .existingSecret.enabled) .password }}
|
||||
DATABASE_PASSWORD: {{ .password | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "bitwarden.externalDatabaseEnv" -}}
|
||||
{{- with .Values.bitwarden.externalDatabase }}
|
||||
{{- if and .enabled (or (eq .type "postgresql") (eq .type "mysql")) }}
|
||||
{{- if .existingSecret.enabled }}
|
||||
- name: DATABASE_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .existingSecret.name | quote }}
|
||||
key: {{ .existingSecret.userKey | quote }}
|
||||
- name: DATABASE_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .existingSecret.name | quote }}
|
||||
key: {{ .existingSecret.passwordKey | quote }}
|
||||
{{- end }}
|
||||
{{- $dbport := not (empty .port) | ternary (printf ":%v" .port) "" }}
|
||||
- name: DATABASE_URL
|
||||
value: {{ printf "%v://$(DATABASE_USER):$(DATABASE_PASSWORD)@%v%v/%v" .type .host $dbport .database }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
@ -3,8 +3,8 @@
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "bitwarden.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
@ -12,21 +12,52 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "bitwarden.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 -}}
|
||||
{{- 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 "bitwarden.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Common labels
|
||||
*/}}
|
||||
{{- define "bitwarden.labels" -}}
|
||||
helm.sh/chart: {{ include "bitwarden.chart" . }}
|
||||
{{ include "bitwarden.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Selector labels
|
||||
*/}}
|
||||
{{- define "bitwarden.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "bitwarden.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create the name of the service account to use
|
||||
*/}}
|
||||
{{- define "bitwarden.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
{{- default (include "bitwarden.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- else }}
|
||||
{{- default "default" .Values.serviceAccount.name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
60
bitwarden/templates/configmap.yaml
Normal file
60
bitwarden/templates/configmap.yaml
Normal file
@ -0,0 +1,60 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ template "bitwarden.fullname" . }}
|
||||
labels:
|
||||
{{- include "bitwarden.labels" . | nindent 4 }}
|
||||
data:
|
||||
SIGNUPS_ALLOWED: {{ .Values.bitwarden.signupsAllowed | quote }}
|
||||
INVITATIONS_ALLOWED: {{ .Values.bitwarden.invitationsAllowed | quote }}
|
||||
{{- if .Values.bitwarden.domain }}
|
||||
DOMAIN: {{ .Values.bitwarden.domain | quote }}
|
||||
{{- end }}
|
||||
WEBSOCKET_ENABLED: {{ .Values.bitwarden.websockets.enabled | quote }}
|
||||
{{- if and .Values.bitwarden.admin.enabled .Values.bitwarden.admin.disableAdminToken }}
|
||||
DISABLE_ADMIN_TOKEN: "true"
|
||||
{{- end }}
|
||||
{{- with .Values.bitwarden.smtp }}
|
||||
{{- if .enabled }}
|
||||
SMTP_HOST: {{ required "SMTP host is required to enable SMTP" .host | quote }}
|
||||
SMTP_FROM: {{ required "SMTP sender address ('from') is required to enable SMTP" .from | quote }}
|
||||
{{- if .fromName }}
|
||||
SMTP_FROM_NAME: {{ .fromName | quote }}
|
||||
{{- end }}
|
||||
{{- if .ssl }}
|
||||
SMTP_SSL: {{ .ssl | quote }}
|
||||
{{- end }}
|
||||
{{- if .explicitTLS }}
|
||||
SMTP_EXPLICIT_TLS: {{ .explicitTLS | quote }}
|
||||
{{- end }}
|
||||
{{- if .port }}
|
||||
SMTP_PORT: {{ .port | quote }}
|
||||
{{- end }}
|
||||
{{- if .timeout }}
|
||||
SMTP_TIMEOUT: {{ .timeout | quote }}
|
||||
{{- end }}
|
||||
{{- if and (not .existingSecret.enabled) .user }}
|
||||
SMTP_USERNAME: {{ .user | quote }}
|
||||
{{- end }}
|
||||
{{- if and (not .existingSecret.enabled) .password }}
|
||||
SMTP_PASSWORD: {{ .password | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.bitwarden.yubico }}
|
||||
{{- if .enabled }}
|
||||
{{- if .server }}
|
||||
YUBICO_SERVER: {{ .server | quote }}
|
||||
{{- end }}
|
||||
{{- if and (not .existingSecret.enabled) .clientId }}
|
||||
YUBICO_CLIENT_ID: {{ .clientId | quote }}
|
||||
{{- end }}
|
||||
{{- if and (not .existingSecret.enabled) .secretKey }}
|
||||
YUBICO_SECRET_KEY: {{ .secretKey | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- include "bitwarden.externalDatabaseConfigMap" . | nindent 2 }}
|
||||
{{- if .Values.env }}
|
||||
{{- toYaml .Values.env | nindent 2 }}
|
||||
{{- end }}
|
@ -1,49 +1,102 @@
|
||||
{{- if eq .Values.persistence.type "deployment" }}
|
||||
{{- $fullName := include "bitwarden.fullname" . -}}
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "bitwarden.fullname" . }}
|
||||
{{- if .Values.deploymentAnnotations }}
|
||||
annotations:
|
||||
{{- range $key, $value := .Values.deploymentAnnotations }}
|
||||
{{ $key }}: {{ $value | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
name: {{ $fullName }}
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ include "bitwarden.name" . }}
|
||||
helm.sh/chart: {{ include "bitwarden.chart" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- include "bitwarden.labels" . | nindent 4 }}
|
||||
spec:
|
||||
{{- if not .Values.autoscaling.enabled }}
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: {{ include "bitwarden.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- include "bitwarden.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ include "bitwarden.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- with .Values.podAnnotations }}
|
||||
annotations:
|
||||
{{- if .Values.podAnnotations }}
|
||||
{{ toYaml .Values.podAnnotations | indent 8 }}
|
||||
{{- end }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "bitwarden.selectorLabels" . | nindent 8 }}
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ include "bitwarden.serviceAccountName" . }}
|
||||
{{- with .Values.podSecurityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
- name: {{ $fullName }}
|
||||
{{- with .Values.securityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
resources:
|
||||
{{ toYaml .Values.resources | indent 12 }}
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: {{ $fullName }}
|
||||
env:
|
||||
{{- range $key, $val := .Values.env }}
|
||||
- name: {{ $key }}
|
||||
value: {{ $val | quote }}
|
||||
{{- end}}
|
||||
{{- with .Values.bitwarden.admin }}
|
||||
{{- if and .enabled (not .disableAdminToken) }}
|
||||
- name: ADMIN_TOKEN
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
{{- if .existingSecret.enabled }}
|
||||
name: {{ .existingSecret.name | quote }}
|
||||
key: {{ .existingSecret.tokenKey | quote }}
|
||||
{{- else }}
|
||||
name: {{ $fullName }}
|
||||
key: admin-token
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.bitwarden.smtp }}
|
||||
{{- if eq .enabled true }}
|
||||
{{- if and .existingSecret.enabled (not .user) }}
|
||||
- name: SMTP_USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .existingSecret.name | quote }}
|
||||
key: {{ .existingSecret.userKey | quote }}
|
||||
- name: SMTP_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .existingSecret.name | quote }}
|
||||
key: {{ .existingSecret.passwordKey | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.bitwarden.yubico }}
|
||||
{{- if and .enabled .existingSecret.enabled }}
|
||||
- name: YUBICO_CLIENT_ID
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .existingSecret.name | quote }}
|
||||
key: {{ .existingSecret.clientIdKey | quote }}
|
||||
- name: YUBICO_SECRET_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .existingSecret.name | quote }}
|
||||
key: {{ .existingSecret.secretKeyKey | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- include "bitwarden.externalDatabaseEnv" . | nindent 12 }}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 80
|
||||
containerPort: {{ .Values.bitwarden.gui.port }}
|
||||
protocol: TCP
|
||||
{{- if .Values.bitwarden.websockets.enabled }}
|
||||
- name: websocket
|
||||
containerPort: {{ .Values.bitwarden.websockets.port }}
|
||||
protocol: TCP
|
||||
{{- end }}
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
@ -52,30 +105,31 @@ spec:
|
||||
httpGet:
|
||||
path: /
|
||||
port: http
|
||||
{{- with .Values.resources }}
|
||||
resources:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /data
|
||||
{{- if .Values.image.pullSecrets }}
|
||||
imagePullSecrets:
|
||||
- name: {{ .Values.image.pullSecrets }}
|
||||
- name: {{ include "bitwarden.fullname" . }}
|
||||
mountPath: /data
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: data
|
||||
{{- if .Values.persistence.enabled }}
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template "bitwarden.fullname" . }}{{- end }}
|
||||
{{- else }}
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{ toYaml . | indent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{ toYaml . | indent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{ toYaml . | indent 8 }}
|
||||
{{- end }}
|
||||
- name: {{ include "bitwarden.fullname" . }}
|
||||
{{- if .Values.persistence.enabled }}
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim | quote }}{{- else }}{{ include "bitwarden.fullname" . }}{{- end }}
|
||||
{{- else }}
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
{{- end }}
|
32
bitwarden/templates/hpa.yaml
Normal file
32
bitwarden/templates/hpa.yaml
Normal file
@ -0,0 +1,32 @@
|
||||
{{- if .Values.autoscaling.enabled }}
|
||||
apiVersion: autoscaling/v2beta1
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: {{ include "bitwarden.fullname" . }}
|
||||
labels:
|
||||
{{- include "bitwarden.labels" . | nindent 4 }}
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
{{- if eq .Values.persistence.type "statefulset" }}
|
||||
kind: StatefulSet
|
||||
{{- else }}
|
||||
kind: Deployment
|
||||
{{- end }}
|
||||
name: {{ include "bitwarden.fullname" . }}
|
||||
minReplicas: {{ .Values.autoscaling.minReplicas }}
|
||||
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
|
||||
metrics:
|
||||
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: cpu
|
||||
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
|
||||
{{- end }}
|
||||
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: memory
|
||||
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
||||
{{- end }}
|
||||
{{- end }}
|
@ -1,38 +1,52 @@
|
||||
{{- if .Values.ingress.enabled -}}
|
||||
{{- $fullName := include "bitwarden.fullname" . -}}
|
||||
{{- $ingressPath := .Values.ingress.path -}}
|
||||
{{- $svcPort := .Values.service.port -}}
|
||||
{{- $websockets := .Values.bitwarden.websockets -}}
|
||||
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
{{- else -}}
|
||||
apiVersion: extensions/v1beta1
|
||||
{{- end }}
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ $fullName }}
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ include "bitwarden.name" . }}
|
||||
helm.sh/chart: {{ include "bitwarden.chart" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- with .Values.ingress.annotations }}
|
||||
{{- include "bitwarden.labels" . | nindent 4 }}
|
||||
{{- with .Values.ingress.annotations }}
|
||||
annotations:
|
||||
{{ toYaml . | indent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.ingress.tls }}
|
||||
tls:
|
||||
{{- range .Values.ingress.tls }}
|
||||
- hosts:
|
||||
{{- range .hosts }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
secretName: {{ .secretName }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.ingress.tls }}
|
||||
tls:
|
||||
{{- range .Values.ingress.tls }}
|
||||
- hosts:
|
||||
{{- range .hosts }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
secretName: {{ .secretName }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- range .Values.ingress.hosts }}
|
||||
- host: {{ . | quote }}
|
||||
{{- range .Values.ingress.hosts }}
|
||||
- host: {{ .host | quote }}
|
||||
http:
|
||||
paths:
|
||||
- path: {{ $ingressPath }}
|
||||
{{- range .paths }}
|
||||
- path: {{ . }}
|
||||
backend:
|
||||
serviceName: {{ $fullName }}
|
||||
servicePort: http
|
||||
servicePort: {{ $svcPort }}
|
||||
{{- if $websockets.enabled }}
|
||||
- path: {{ . | trimSuffix "/" }}/notifications/hub
|
||||
backend:
|
||||
serviceName: {{ $fullName }}
|
||||
servicePort: {{ $websockets.port }}
|
||||
- path: {{ . | trimSuffix "/" }}/notifications/hub/negotiate
|
||||
backend:
|
||||
serviceName: {{ $fullName }}
|
||||
servicePort: {{ $svcPort}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
15
bitwarden/templates/pvc.yaml
Normal file
15
bitwarden/templates/pvc.yaml
Normal file
@ -0,0 +1,15 @@
|
||||
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}}
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: {{ include "bitwarden.fullname" . }}
|
||||
spec:
|
||||
accessModes:
|
||||
- {{ .Values.persistence.accessMode | quote }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.persistence.size | quote }}
|
||||
{{- if .Values.persistence.storageClass }}
|
||||
storageClassName: {{ .Values.persistence.storageClass | quote }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
11
bitwarden/templates/secret.yaml
Normal file
11
bitwarden/templates/secret.yaml
Normal file
@ -0,0 +1,11 @@
|
||||
{{- if not .Values.bitwarden.admin.existingSecret.enabled }}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ template "bitwarden.fullname" . }}
|
||||
labels:
|
||||
{{- include "bitwarden.labels" . | nindent 4 }}
|
||||
type: Opaque
|
||||
data:
|
||||
admin-token: {{ randAlphaNum 48 | b64enc | quote }}
|
||||
{{- end }}
|
@ -3,20 +3,26 @@ kind: Service
|
||||
metadata:
|
||||
name: {{ include "bitwarden.fullname" . }}
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ include "bitwarden.name" . }}
|
||||
helm.sh/chart: {{ include "bitwarden.chart" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- include "bitwarden.labels" . | nindent 4 }}
|
||||
{{- with .Values.service.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
{{- if .Values.service.loadBalancerIP }}
|
||||
loadBalancerIP: {{ .Values.service.loadBalancerIP }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- port: {{ .Values.service.port }}
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
name: http
|
||||
{{- if .Values.bitwarden.websockets.enabled }}
|
||||
- port: {{ .Values.bitwarden.websockets.port }}
|
||||
targetPort: websocket
|
||||
protocol: TCP
|
||||
name: websocket
|
||||
{{- end }}
|
||||
{{- with .Values.service.additionalSpec }}
|
||||
{{- toYaml . | nindent 2 }}
|
||||
{{- end }}
|
||||
selector:
|
||||
app.kubernetes.io/name: {{ include "bitwarden.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- include "bitwarden.selectorLabels" . | nindent 4 }}
|
||||
|
12
bitwarden/templates/serviceaccount.yaml
Normal file
12
bitwarden/templates/serviceaccount.yaml
Normal file
@ -0,0 +1,12 @@
|
||||
{{- if .Values.serviceAccount.create -}}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ include "bitwarden.serviceAccountName" . }}
|
||||
labels:
|
||||
{{- include "bitwarden.labels" . | nindent 4 }}
|
||||
{{- with .Values.serviceAccount.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
136
bitwarden/templates/statefulset.yaml
Normal file
136
bitwarden/templates/statefulset.yaml
Normal file
@ -0,0 +1,136 @@
|
||||
{{- if eq .Values.persistence.type "statefulset" }}
|
||||
{{- $fullName := include "bitwarden.fullname" . -}}
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: {{ $fullName }}
|
||||
labels:
|
||||
{{- include "bitwarden.labels" . | nindent 4 }}
|
||||
spec:
|
||||
{{- if not .Values.autoscaling.enabled }}
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "bitwarden.selectorLabels" . | nindent 6 }}
|
||||
serviceName: {{ $fullName }}
|
||||
template:
|
||||
metadata:
|
||||
{{- with .Values.podAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "bitwarden.selectorLabels" . | nindent 8 }}
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ include "bitwarden.serviceAccountName" . }}
|
||||
{{- with .Values.podSecurityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: {{ $fullName }}
|
||||
{{- with .Values.securityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: {{ $fullName }}
|
||||
env:
|
||||
{{- with .Values.bitwarden.admin }}
|
||||
{{- if and .enabled (not .disableAdminToken) }}
|
||||
- name: ADMIN_TOKEN
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
{{- if .existingSecret.enabled }}
|
||||
name: {{ .existingSecret.name | quote }}
|
||||
key: {{ .existingSecret.tokenKey | quote }}
|
||||
{{- else }}
|
||||
name: {{ $fullName }}
|
||||
key: admin-token
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.bitwarden.smtp }}
|
||||
{{- if eq .enabled true }}
|
||||
{{- if and .existingSecret.enabled (not .user) }}
|
||||
- name: SMTP_USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .existingSecret.name | quote }}
|
||||
key: {{ .existingSecret.userKey | quote }}
|
||||
- name: SMTP_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .existingSecret.name | quote }}
|
||||
key: {{ .existingSecret.passwordKey | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.bitwarden.yubico }}
|
||||
{{- if and .enabled .existingSecret.enabled }}
|
||||
- name: YUBICO_CLIENT_ID
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .existingSecret.name | quote }}
|
||||
key: {{ .existingSecret.clientIdKey | quote }}
|
||||
- name: YUBICO_SECRET_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .existingSecret.name | quote }}
|
||||
key: {{ .existingSecret.secretKeyKey | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- include "bitwarden.externalDatabaseEnv" . | nindent 12 }}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{ .Values.bitwarden.gui.port }}
|
||||
protocol: TCP
|
||||
{{- if .Values.bitwarden.websockets.enabled }}
|
||||
- name: websocket
|
||||
containerPort: {{ .Values.bitwarden.websockets.port }}
|
||||
protocol: TCP
|
||||
{{- end }}
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: http
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: http
|
||||
{{- with .Values.resources }}
|
||||
resources:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: {{ include "bitwarden.fullname" . }}
|
||||
mountPath: /data
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: {{ include "bitwarden.fullname" . }}
|
||||
{{- if .Values.persistence.enabled }}
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim | quote }}{{- else }}{{ include "bitwarden.fullname" . }}{{- end }}
|
||||
{{- else }}
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
{{- end }}
|
15
bitwarden/templates/tests/test-connection.yaml
Normal file
15
bitwarden/templates/tests/test-connection.yaml
Normal file
@ -0,0 +1,15 @@
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: "{{ include "bitwarden.fullname" . }}-test-connection"
|
||||
labels:
|
||||
{{- include "bitwarden.labels" . | nindent 4 }}
|
||||
annotations:
|
||||
"helm.sh/hook": test-success
|
||||
spec:
|
||||
containers:
|
||||
- name: wget
|
||||
image: busybox
|
||||
command: ['wget']
|
||||
args: ['{{ include "bitwarden.fullname" . }}:{{ .Values.service.port }}']
|
||||
restartPolicy: Never
|
Reference in New Issue
Block a user