diff --git a/nextcloud-syncthing-argocd-apps/templates/nc-syncthing-postinstall.yaml b/nextcloud-syncthing-argocd-apps/templates/nc-syncthing-postinstall.yaml new file mode 100644 index 0000000..7354dd1 --- /dev/null +++ b/nextcloud-syncthing-argocd-apps/templates/nc-syncthing-postinstall.yaml @@ -0,0 +1,30 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: nc-syncthing-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: nc-syncthing-postinstall + valuesObject: + tailscaleIngresses: + odooHostname: {{ .Values.tailscaleIngresses.ncHostname }} + 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/nextcloud-syncthing-argocd-apps/values.yaml b/nextcloud-syncthing-argocd-apps/values.yaml index 0b5d573..835463e 100644 --- a/nextcloud-syncthing-argocd-apps/values.yaml +++ b/nextcloud-syncthing-argocd-apps/values.yaml @@ -1,6 +1,10 @@ argocd: namespace: argocd project: default + postinstall: + repoURL: "https://git.blarre.net/thomas/helm-charts.git" + targetRevision: HEAD + path: nc-syncthing-postinstall destination: server: https://kubernetes.default.svc diff --git a/nextcloud-syncthing-postinstall/.helmignore b/nextcloud-syncthing-postinstall/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/nextcloud-syncthing-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/nextcloud-syncthing-postinstall/Chart.yaml b/nextcloud-syncthing-postinstall/Chart.yaml new file mode 100644 index 0000000..de46bd3 --- /dev/null +++ b/nextcloud-syncthing-postinstall/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v2 +name: nextcloud-syncthing-postinstall +description: A Helm chart for deploying the nc and syncthing ingresses +type: application +version: 0.1.0 diff --git a/nextcloud-syncthing-postinstall/templates/_helpers.tpl b/nextcloud-syncthing-postinstall/templates/_helpers.tpl new file mode 100644 index 0000000..e4959d4 --- /dev/null +++ b/nextcloud-syncthing-postinstall/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "nextcloud-syncthing-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 "nextcloud-syncthing-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 "nextcloud-syncthing-postinstall.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "nextcloud-syncthing-postinstall.labels" -}} +helm.sh/chart: {{ include "nextcloud-syncthing-postinstall.chart" . }} +{{ include "nextcloud-syncthing-postinstall.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "nextcloud-syncthing-postinstall.selectorLabels" -}} +app.kubernetes.io/name: {{ include "nextcloud-syncthing-postinstall.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "nextcloud-syncthing-postinstall.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "nextcloud-syncthing-postinstall.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/nextcloud-syncthing-postinstall/templates/nc-ingress.yaml b/nextcloud-syncthing-postinstall/templates/nc-ingress.yaml new file mode 100644 index 0000000..0ee5f4b --- /dev/null +++ b/nextcloud-syncthing-postinstall/templates/nc-ingress.yaml @@ -0,0 +1,16 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: ts-nextcloud + annotations: + tailscale.com/funnel: "true" +spec: + defaultBackend: + service: + name: nextcloud + port: + name: http + ingressClassName: tailscale + tls: + - hosts: + - {{ .Values.tailscaleIngresses.ncHostname }} diff --git a/nextcloud-syncthing-postinstall/values.yaml b/nextcloud-syncthing-postinstall/values.yaml new file mode 100644 index 0000000..930a0c4 --- /dev/null +++ b/nextcloud-syncthing-postinstall/values.yaml @@ -0,0 +1,3 @@ +tailscaleIngresses: + ncHostname: nextcloud + syncthingHostname: syncthing \ No newline at end of file