diff --git a/vaultwarden-argocd-apps/.helmignore b/vaultwarden-argocd-apps/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/vaultwarden-argocd-apps/.helmignore @@ -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/ diff --git a/vaultwarden-argocd-apps/Chart.yaml b/vaultwarden-argocd-apps/Chart.yaml new file mode 100644 index 0000000..30cabad --- /dev/null +++ b/vaultwarden-argocd-apps/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v2 +name: vaultwarden-argocd-apps +description: A Helm chart for Kubernetes +type: application +version: 0.1.0 diff --git a/vaultwarden-argocd-apps/templates/_helpers.tpl b/vaultwarden-argocd-apps/templates/_helpers.tpl new file mode 100644 index 0000000..71c0dfd --- /dev/null +++ b/vaultwarden-argocd-apps/templates/_helpers.tpl @@ -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 }} diff --git a/vaultwarden-argocd-apps/templates/vaultwarden-chart.yaml b/vaultwarden-argocd-apps/templates/vaultwarden-chart.yaml new file mode 100644 index 0000000..5dbfcee --- /dev/null +++ b/vaultwarden-argocd-apps/templates/vaultwarden-chart.yaml @@ -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 diff --git a/vaultwarden-argocd-apps/templates/vaultwarden-postinstall.yaml b/vaultwarden-argocd-apps/templates/vaultwarden-postinstall.yaml new file mode 100644 index 0000000..1b23944 --- /dev/null +++ b/vaultwarden-argocd-apps/templates/vaultwarden-postinstall.yaml @@ -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 diff --git a/vaultwarden-argocd-apps/templates/vaultwarden-requirements-app.yaml b/vaultwarden-argocd-apps/templates/vaultwarden-requirements-app.yaml new file mode 100644 index 0000000..9a14bf0 --- /dev/null +++ b/vaultwarden-argocd-apps/templates/vaultwarden-requirements-app.yaml @@ -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 diff --git a/vaultwarden-argocd-apps/values.yaml b/vaultwarden-argocd-apps/values.yaml new file mode 100644 index 0000000..c27afc8 --- /dev/null +++ b/vaultwarden-argocd-apps/values.yaml @@ -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 diff --git a/vaultwarden-postinstall/.helmignore b/vaultwarden-postinstall/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/vaultwarden-postinstall/.helmignore @@ -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/ diff --git a/vaultwarden-postinstall/Chart.yaml b/vaultwarden-postinstall/Chart.yaml new file mode 100644 index 0000000..a2d7dc7 --- /dev/null +++ b/vaultwarden-postinstall/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v2 +name: vaultwarden-postinstall +description: A Helm chart for deploynig vaultwarden's ingress +type: application +version: 0.1.0 diff --git a/vaultwarden-postinstall/templates/_helpers.tpl b/vaultwarden-postinstall/templates/_helpers.tpl new file mode 100644 index 0000000..f5f8d4e --- /dev/null +++ b/vaultwarden-postinstall/templates/_helpers.tpl @@ -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 }} diff --git a/vaultwarden-postinstall/templates/vaultwarden-ingress.yaml b/vaultwarden-postinstall/templates/vaultwarden-ingress.yaml new file mode 100644 index 0000000..2020167 --- /dev/null +++ b/vaultwarden-postinstall/templates/vaultwarden-ingress.yaml @@ -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 }} diff --git a/vaultwarden-postinstall/values.yaml b/vaultwarden-postinstall/values.yaml new file mode 100644 index 0000000..ceadf8a --- /dev/null +++ b/vaultwarden-postinstall/values.yaml @@ -0,0 +1,2 @@ +tailscaleIngresses: + vaultwardenHostname: vaultwarden \ No newline at end of file diff --git a/vaultwarden-requirements/.helmignore b/vaultwarden-requirements/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/vaultwarden-requirements/.helmignore @@ -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/ diff --git a/vaultwarden-requirements/Chart.yaml b/vaultwarden-requirements/Chart.yaml new file mode 100644 index 0000000..38b5d46 --- /dev/null +++ b/vaultwarden-requirements/Chart.yaml @@ -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 diff --git a/vaultwarden-requirements/templates/_helpers.tpl b/vaultwarden-requirements/templates/_helpers.tpl new file mode 100644 index 0000000..a01c686 --- /dev/null +++ b/vaultwarden-requirements/templates/_helpers.tpl @@ -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 }} diff --git a/vaultwarden-requirements/templates/db-cluster.yaml b/vaultwarden-requirements/templates/db-cluster.yaml new file mode 100644 index 0000000..d93f794 --- /dev/null +++ b/vaultwarden-requirements/templates/db-cluster.yaml @@ -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 }} diff --git a/vaultwarden-requirements/templates/vaultwarden-data.yaml b/vaultwarden-requirements/templates/vaultwarden-data.yaml new file mode 100644 index 0000000..7c326c3 --- /dev/null +++ b/vaultwarden-requirements/templates/vaultwarden-data.yaml @@ -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 }} \ No newline at end of file diff --git a/vaultwarden-requirements/values.yaml b/vaultwarden-requirements/values.yaml new file mode 100644 index 0000000..4662ce9 --- /dev/null +++ b/vaultwarden-requirements/values.yaml @@ -0,0 +1,8 @@ +vaultwarden: + dbCluster: + numInstances: 3 + size: 10Gi + dataPvc: + name: vaultwarden-data + storageClassName: '' + size: 10Gi