Merge branch 'vaultwarden'

This commit is contained in:
2024-11-14 23:07:49 +00:00
18 changed files with 461 additions and 0 deletions

View File

@@ -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/

View File

@@ -0,0 +1,5 @@
apiVersion: v2
name: vaultwarden-argocd-apps
description: A Helm chart for Kubernetes
type: application
version: 0.1.0

View File

@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "vaultwarden-argocd-apps.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 "vaultwarden-argocd-apps.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 "vaultwarden-argocd-apps.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "vaultwarden-argocd-apps.labels" -}}
helm.sh/chart: {{ include "vaultwarden-argocd-apps.chart" . }}
{{ include "vaultwarden-argocd-apps.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "vaultwarden-argocd-apps.selectorLabels" -}}
app.kubernetes.io/name: {{ include "vaultwarden-argocd-apps.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "vaultwarden-argocd-apps.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "vaultwarden-argocd-apps.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,44 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: vaultwarden
namespace: {{ .Values.argocd.namespace }}
annotations:
argocd.argoproj.io/sync-wave: "0"
notifications.argoproj.io/subscribe.on-sync-succeeded.telegram: "-1002270587578"
spec:
project: {{ .Values.argocd.project }}
source:
repoURL: "https://guerzon.github.io/vaultwarden"
chart: vaultwarden
targetRevision: v0.29.x
helm:
releaseName: vaultwarden
valuesObject:
domain: {{ .Values.vaultwarden.fqdn }}
timeZone: {{ .Values.vaultwarden.timeZone }}
database:
type: postgresql
existingSecret: {{ .Values.vaultwarden.dbCluster.secretName }}
existingSecretKey: uri
data:
name: {{ .Values.vaultwarden.dataPvc.name }}
size: {{ .Values.vaultwarden.dataPvc.size }}
class: {{ .Values.vaultwarden.dataPvc.storageClassName }}
attachments:
name: {{ .Values.vaultwarden.attachmentPvc.name }}
size: {{ .Values.vaultwarden.attachmentPvc.size }}
class: {{ .Values.vaultwarden.attachmentPvc.storageClassName }}
ingress:
enabled: false
destination:
server: {{ .Values.mainDestination }}
namespace: {{ .Values.mainNamespace }}
syncPolicy:
automated:
prune: true # Automatically remove resources no longer in the repo
selfHeal: true # Automatically self-heal when drift is detected
syncOptions:
- ApplyOutOfSyncOnly=true
- ServerSideApply=true
- CreateNamespace=true

View File

@@ -0,0 +1,30 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: vaultwarden-postinstall
namespace: {{ .Values.argocd.namespace }}
annotations:
argocd.argoproj.io/sync-wave: "1"
notifications.argoproj.io/subscribe.on-sync-succeeded.telegram: "-1002270587578"
spec:
project: {{ .Values.argocd.project }}
source:
repoURL: {{ .Values.argocd.postinstall.repoURL }}
targetRevision: {{ .Values.argocd.postinstall.targetRevision }}
path: {{ .Values.argocd.postinstall.path }}
helm:
releaseName: vaultwarden-postinstall
valuesObject:
tailscaleIngresses:
vaultwardenHostname: {{ .Values.tailscaleIngresses.vaultwardenHostname }}
destination:
server: {{ .Values.destination.server }}
namespace: {{ .Values.destination.namespace }}
syncPolicy:
automated:
prune: true # Automatically remove resources no longer in the repo
selfHeal: true # Automatically self-heal when drift is detected
syncOptions:
- ApplyOutOfSyncOnly=true
- ServerSideApply=true
- CreateNamespace=true

View File

@@ -0,0 +1,36 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: vaultwarden-requirements
namespace: {{ .Values.argocd.namespace }}
annotations:
argocd.argoproj.io/sync-wave: "-1"
notifications.argoproj.io/subscribe.on-sync-succeeded.telegram: "-1002270587578"
spec:
project: {{ .Values.argocd.project }}
source:
repoURL: {{ .Values.argocd.requirements.repoURL }}
targetRevision: {{ .Values.argocd.requirements.targetRevision }}
path: {{ .Values.argocd.requirements.path }}
helm:
releaseName: vaultwarden-requirements
valuesObject:
vaultwarden:
dbCluster:
numInstances: {{ .Values.vaultwarden.dbCluster.numInstances }}
size: {{ .Values.vaultwarden.dbCluster.size }}
dataPvc:
name: {{ .Values.vaultwarden.dataPvc.name }}
storageClassName: {{ .Values.vaultwarden.dataPvc.storageClassName }}
size: {{ .Values.vaultwarden.dataPvc.size }}
destination:
server: {{ .Values.destination.server }}
namespace: {{ .Values.destination.namespace }}
syncPolicy:
automated:
prune: true # Automatically remove resources no longer in the repo
selfHeal: true # Automatically self-heal when drift is detected
syncOptions:
- ApplyOutOfSyncOnly=true
- ServerSideApply=true
- CreateNamespace=true

View File

@@ -0,0 +1,34 @@
argocd:
namespace: argocd
project: default
requirements:
repoURL: "https://git.blarre.net/thomas/helm-charts.git"
targetRevision: HEAD
path: vaultwarden-requirements
postinstall:
repoURL: "https://git.blarre.net/thomas/helm-charts.git"
targetRevision: HEAD
path: vaultwarden-postinstall
destination:
server: "https://kubernetes.default.svc"
namespace: vaultwarden
vaultwarden:
dbCluster:
numInstances: 3
size: 10Gi
secretName: vaultwarden-db-app
dataPvc:
name: vaultwarden-data
storageClassName: ''
size: 10Gi
attachmentPvc:
name: vaultwarden-attachments
storageClassName: ''
size: 10Gi
fqdn: vaultwarden.domain.net
timeZone: "Europe/Lisbon"
tailscaleIngresses:
vaultwardenHostname: vaultwarden

View File

@@ -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/

View File

@@ -0,0 +1,5 @@
apiVersion: v2
name: vaultwarden-postinstall
description: A Helm chart for deploynig vaultwarden's ingress
type: application
version: 0.1.0

View File

@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "vaultwarden-postinstall.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 "vaultwarden-postinstall.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 "vaultwarden-postinstall.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "vaultwarden-postinstall.labels" -}}
helm.sh/chart: {{ include "vaultwarden-postinstall.chart" . }}
{{ include "vaultwarden-postinstall.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "vaultwarden-postinstall.selectorLabels" -}}
app.kubernetes.io/name: {{ include "vaultwarden-postinstall.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "vaultwarden-postinstall.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "vaultwarden-postinstall.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,16 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ts-vaultwarden
annotations:
tailscale.com/funnel: "true"
spec:
defaultBackend:
service:
name: vaultwarden
port:
name: http
ingressClassName: tailscale
tls:
- hosts:
- {{ .Values.tailscaleIngresses.vaultwardenHostname }}

View File

@@ -0,0 +1,2 @@
tailscaleIngresses:
vaultwardenHostname: vaultwarden

View File

@@ -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/

View File

@@ -0,0 +1,5 @@
apiVersion: v2
name: vaultwarden-requirements
description: A Helm chart for deploying the dbcluster and pvc for vaultwarden
type: application
version: 0.1.0

View File

@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "vaultwarden-requirements.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 "vaultwarden-requirements.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 "vaultwarden-requirements.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "vaultwarden-requirements.labels" -}}
helm.sh/chart: {{ include "vaultwarden-requirements.chart" . }}
{{ include "vaultwarden-requirements.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "vaultwarden-requirements.selectorLabels" -}}
app.kubernetes.io/name: {{ include "vaultwarden-requirements.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "vaultwarden-requirements.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "vaultwarden-requirements.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,8 @@
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: vaultwarden-db
spec:
instances: {{ .Values.vaultwarden.dbCluster.numInstances }}
storage:
size: {{ .Values.vaultwarden.dbCluster.size }}

View File

@@ -0,0 +1,13 @@
{{- if false -}}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ .Values.vaultwarden.dataPvc.name }}
spec:
storageClassName: {{ .Values.vaultwarden.dataPvc.storageClassName }}
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.vaultwarden.dataPvc.size }}
{{- end }}

View File

@@ -0,0 +1,8 @@
vaultwarden:
dbCluster:
numInstances: 3
size: 10Gi
dataPvc:
name: vaultwarden-data
storageClassName: ''
size: 10Gi