diff --git a/README.md b/README.md index 7ed76717..c64317fd 100644 --- a/README.md +++ b/README.md @@ -18,21 +18,22 @@ Applications, developed or curated by [mika](https://github.com/irfanhakim-as), | Chart Name | Description | Support | Access | | ---------- | ----------- | ------- | ------ | -| [clog](https://github.com/irfanhakim-as/charts/tree/master/mika/clog) | Creative blog, Career blog, Coin blog, you name it. | ✅ | 🔒 | -| [cloudflared](https://github.com/irfanhakim-as/charts/tree/master/mika/cloudflared) | Cloudflare Tunnel is a tunneling software that lets you quickly secure and encrypt application traffic to any type of infrastructure. | ✅ | ✅ | -| [cloudflareddns](https://github.com/irfanhakim-as/charts/tree/master/mika/cloudflareddns) | Access your home network remotely via a custom domain name without a static IP! | ✅ | ✅ | -| [flex](https://github.com/irfanhakim-as/charts/tree/master/mika/flex) | Flex is a collection of curated services that aims to provide a complete home media server solution. | ✅ | ✅ | -| [grocy](https://github.com/irfanhakim-as/charts/tree/master/mika/grocy) | Grocy is a web-based self-hosted groceries & household management solution for your home. | ✅ | ✅ | -| [kutt](https://github.com/irfanhakim-as/charts/tree/master/mika/kutt) | Kutt is a modern URL shortener with support for custom domains. Shorten URLs, manage your links and view the click rate statistics. | ✅ | ✅ | -| [mango](https://github.com/irfanhakim-as/charts/tree/master/mika/mango) | Mango is an easy to use Mastodon bot framework built on top of Django. | ✅ | 🔒 | -| [mariadb-agent](https://github.com/irfanhakim-as/charts/tree/master/mika/mariadb-agent) | Easily create or delete multiple pairs of databases and users in a remote MariaDB instance. | ✅ | ✅ | -| [postgres](https://github.com/irfanhakim-as/charts/tree/master/mika/postgres) | Easy tool to deploy a PostgreSQL instance on Kubernetes. | ✅ | ✅ | -| [postgres-agent](https://github.com/irfanhakim-as/charts/tree/master/mika/postgres-agent) | Easily create or delete a database and user pair in a remote PostgreSQL instance. | ✅ | ✅ | -| [rizz](https://github.com/irfanhakim-as/charts/tree/master/mika/rizz) | Rizz is a simple web application that tracks and posts content from RSS Feeds to Mastodon. | ✅ | 🔒 | -| [telego](https://github.com/irfanhakim-as/charts/tree/master/mika/telego) | Telego is an easy to use Telegram bot framework built on top of Django. | ✅ | 🔒 | -| [vpbot](https://github.com/irfanhakim-as/charts/tree/master/mika/vpbot) | Vpbot is a Telegram bot with support for a number of useful features such as prayer time notifications, COVID-19 statistics, and more. | ✅ | 🔒 | -| [waktusolat](https://github.com/irfanhakim-as/charts/tree/master/mika/waktusolat) | Waktu Solat is a simple web application that posts local prayer times on Mastodon. | ✅ | 🔒 | -| [yuzu-multiplayer](https://github.com/irfanhakim-as/charts/tree/master/mika/yuzu-multiplayer) | Quickly stand up new dedicated multiplayer lobbies that will be broadcasted on yuzu. | ✅ | ✅ | +| [clog](mika/clog) | Creative blog, Career blog, Coin blog, you name it. | ✅ | 🔒 | +| [cloudflared](mika/cloudflared) | Cloudflare Tunnel is a tunneling software that lets you quickly secure and encrypt application traffic to any type of infrastructure. | ✅ | ✅ | +| [cloudflareddns](mika/cloudflareddns) | Access your home network remotely via a custom domain name without a static IP! | ✅ | ✅ | +| [flex](mika/flex) | Flex is a collection of curated services that aims to provide a complete home media server solution. | ✅ | ✅ | +| [grocy](mika/grocy) | Grocy is a web-based self-hosted groceries & household management solution for your home. | ✅ | ✅ | +| [kutt](mika/kutt) | Kutt is a modern URL shortener with support for custom domains. Shorten URLs, manage your links and view the click rate statistics. | ✅ | ✅ | +| [mango](mika/mango) | Mango is an easy to use Mastodon bot framework built on top of Django. | ✅ | 🔒 | +| [mariadb-agent](mika/mariadb-agent) | Easily create or delete multiple pairs of databases and users in a remote MariaDB instance. | ✅ | ✅ | +| [postgres](mika/postgres) | Easy tool to deploy a PostgreSQL instance on Kubernetes. | ✅ | ✅ | +| [postgres-agent](mika/postgres-agent) | Easily create or delete a database and user pair in a remote PostgreSQL instance. | ✅ | ✅ | +| [rizz](mika/rizz) | Rizz is a simple web application that tracks and posts content from RSS Feeds to Mastodon. | ✅ | 🔒 | +| [syncthing](mika/syncthing) | Syncthing is a continuous file synchronization program. It synchronizes files between two or more computers. | ✅ | ✅ | +| [telego](mika/telego) | Telego is an easy to use Telegram bot framework built on top of Django. | ✅ | 🔒 | +| [vpbot](mika/vpbot) | Vpbot is a Telegram bot with support for a number of useful features such as prayer time notifications, COVID-19 statistics, and more. | ✅ | 🔒 | +| [waktusolat](mika/waktusolat) | Waktu Solat is a simple web application that posts local prayer times on Mastodon. | ✅ | 🔒 | +| [yuzu-multiplayer](mika/yuzu-multiplayer) | Quickly stand up new dedicated multiplayer lobbies that will be broadcasted on yuzu. | ✅ | ✅ | --- diff --git a/logos/syncthing.png b/logos/syncthing.png new file mode 100644 index 00000000..90a95d67 Binary files /dev/null and b/logos/syncthing.png differ diff --git a/mika/syncthing/.helmignore b/mika/syncthing/.helmignore new file mode 100644 index 00000000..0e8a0eb3 --- /dev/null +++ b/mika/syncthing/.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/mika/syncthing/Chart.yaml b/mika/syncthing/Chart.yaml new file mode 100644 index 00000000..cf3defd1 --- /dev/null +++ b/mika/syncthing/Chart.yaml @@ -0,0 +1,18 @@ +apiVersion: v2 +name: syncthing +description: Syncthing is a continuous file synchronization program. It synchronizes files between two or more computers. +type: application +version: 0.1.0 +appVersion: "v1.27.3-ls131" +keywords: + - "syncthing" +home: "https://github.com/irfanhakim-as/charts" +icon: "https://irfanhakim-as.github.io/charts/logos/syncthing.png" +sources: + - "https://github.com/syncthing/syncthing" + - "https://github.com/linuxserver/docker-syncthing" + - "https://github.com/irfanhakim-as/charts" +maintainers: + - name: "Irfan Hakim" + email: "irfanhakim.as@yahoo.com" + url: "https://github.com/irfanhakim-as" diff --git a/mika/syncthing/README.md b/mika/syncthing/README.md new file mode 100644 index 00000000..69cbb4d5 --- /dev/null +++ b/mika/syncthing/README.md @@ -0,0 +1,163 @@ +# [Syncthing](https://github.com/syncthing/syncthing) + +Syncthing is a continuous file synchronization program. It synchronizes files between two or more computers. + +## Prerequisites + +> [!NOTE] +> You may refer to [Orked](https://github.com/irfanhakim-as/orked) for help with setting up a Kubernetes cluster that meets all the following prerequisites. + +- Kubernetes 1.19+ +- Helm 3.2.0+ +- Longhorn 1.4.1+ +- csi-driver-smb 1.14.0+ + +--- + +## External dependencies + +> [!IMPORTANT] +> The following items are required to be set up prior to installing this chart. + +**This section does not apply to this chart.** + +--- + +## Recommended configurations + +> [!NOTE] +> The following configuration recommendations might not be the default settings for this chart but are **highly recommended**. Please carefully consider them before configuring your installation. + +**This section does not apply to this chart.** + +--- + +## Application configurations + +> [!NOTE] +> The following configurations are expected or recommended to be set up from within the application after completing the installation. + +**This section does not apply to this chart.** + +--- + +## How to add the chart repo + +1. Add the repo to your local helm client: + + ```sh + helm repo add mika https://irfanhakim-as.github.io/charts + ``` + +2. Update the repo to retrieve the latest versions of the packages: + + ```sh + helm repo update + ``` + +--- + +## How to install or upgrade a chart release + +1. Get the values file of the Syncthing chart or an existing installation (release). + + Get the latest Syncthing chart values file for a new installation: + + ```sh + helm show values mika/syncthing > values.yaml + ``` + + Alternatively, get the values file of an existing Syncthing release: + + ```sh + helm get values ${releaseName} --namespace ${namespace} > values.yaml + ``` + + Replace `${releaseName}` and `${namespace}` accordingly. + +2. Edit your Syncthing values file with the intended configurations: + + ```sh + nano values.yaml + ``` + + Pay extra attention to the descriptions and sample values provided in the chart values file. + +3. Install a new release for Syncthing or upgrade an existing Syncthing release: + + ```sh + helm upgrade --install ${releaseName} mika/syncthing --namespace ${namespace} --create-namespace --values values.yaml --wait + ``` + + Replace `${releaseName}` and `${namespace}` accordingly. + +4. Verify that your Syncthing release has been installed: + + ```sh + helm ls --namespace ${namespace} | grep "${releaseName}" + ``` + + Replace `${namespace}` and `${releaseName}` accordingly. This should return the release information if the release has been installed. + +--- + +## How to uninstall a chart release + +> [!CAUTION] +> Uninstalling a release will irreversibly delete all the resources associated with the release, including any persistent data. + +1. Uninstall the desired release: + + ```sh + helm uninstall ${releaseName} --namespace ${namespace} --wait + ``` + + Replace `${releaseName}` and `${namespace}` accordingly. + +2. Verify that the release has been uninstalled: + + ```sh + helm ls --namespace ${namespace} | grep "${releaseName}" + ``` + + Replace `${namespace}` and `${releaseName}` accordingly. This should return nothing if the release has been uninstalled. + +--- + +## Chart configurations + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| image.syncthing.pullPolicy | string | `""` | The policy that determines when Kubernetes should pull the Syncthing container image. Default: `"IfNotPresent"`. | +| image.syncthing.registry | string | `""` | The registry where the Syncthing container image is hosted. Default: `"lscr.io"`. | +| image.syncthing.repository | string | `""` | The name of the repository that contains the Syncthing container image used. Default: `"linuxserver/syncthing"`. | +| image.syncthing.tag | string | `""` | The tag that specifies the version of the Syncthing container image used. Default: `Chart appVersion`. | +| imagePullSecrets | list | `[]` | Credentials used to securely authenticate and authorise the pulling of container images from private registries. | +| ingress.clusterIssuer | string | `""` | The name of the cluster issuer for Ingress. Default: `"letsencrypt-dns-prod"`. | +| ingress.enabled | bool | `false` | Specifies whether Ingress should be enabled for hosting Syncthing services. | +| replicaCount | string | `""` | The desired number of running replicas for Syncthing. Default: `"1"`. | +| resources.syncthing | object | `{}` | Syncthing container resources. | +| service.type | string | `""` | The type of service used for Syncthing services. Default: `"ClusterIP"`. | +| smb.enabled | bool | `false` | Specifies whether to enable persistent storage to be provisioned in the form of an SMB share. | +| smb.mountOptions | list | `[]` | The additional mount options used to mount the SMB share volume. | +| smb.pvStorage | string | `""` | The amount of persistent storage available on the SMB share volume. Default: `"100Gi"`. | +| smb.pvcStorage | string | `""` | The amount of persistent storage allocated for the SMB share storage. Default: `"1Gi"`. | +| smb.secretName | string | `""` | The name of the existing secret containing the credentials used to authenticate with the SMB share. Default: `"smbcreds"`. | +| smb.secretNamespace | string | `""` | The namespace where the secret containing the credentials used to authenticate with the SMB share is located. Default: `"default"`. | +| smb.share | string | `""` | The SMB share address and name to mount as a persistent volume. | +| smb.storageClassName | string | `""` | The storage class name used for dynamically provisioning a persistent volume for the SMB share storage. Default: `"smb"`. | +| storage.config.enabled | bool | `true` | Specifies whether persistent storage should be provisioned for config storage. | +| storage.config.mountPath | string | `""` | The path where the config storage should be mounted on the container. Default: `"/config"`. | +| storage.config.storage | string | `""` | The default amount of persistent storage allocated for the config storage. Default: `"1Gi"`. | +| storage.config.storageClassName | string | `""` | The storage class name used for dynamically provisioning a persistent volume for the config storage. Default: `"longhorn"`. | +| storage.config.subPath | string | `""` | The subpath within the config storage to mount to the container. Leave empty if not required. | +| storage.data.enabled | bool | `false` | Specifies whether persistent storage should be provisioned for data storage. | +| storage.data.mountPath | string | `""` | The path where the data storage should be mounted on the container. Default: `"/data"`. | +| storage.data.smb | bool | `false` | Specifies whether to use an SMB share for the data storage. | +| storage.data.storage | string | `""` | The default amount of persistent storage allocated for the data storage. Default: `"1Gi"`. | +| storage.data.storageClassName | string | `""` | The storage class name used for dynamically provisioning a persistent volume for the data storage. Default: `"longhorn"`. | +| storage.data.subPath | string | `""` | The subpath within the data storage to mount to the container. Leave empty if not required. | +| syncthing.customConfigs | list | `[]` | Optional custom configurations to be mounted as a file inside the Syncthing container. | +| syncthing.domain | string | `""` | The ingress domain name that hosts the Syncthing server. | +| syncthing.gid | string | `""` | The group ID used to run the Syncthing containers. Default: `"1000"`. | +| syncthing.uid | string | `""` | The user ID used to run the Syncthing containers. Default: `"1000"`. | \ No newline at end of file diff --git a/mika/syncthing/templates/NOTES.txt b/mika/syncthing/templates/NOTES.txt new file mode 100644 index 00000000..e933240d --- /dev/null +++ b/mika/syncthing/templates/NOTES.txt @@ -0,0 +1,10 @@ +{{- $ingress := .Values.ingress.enabled }} +{{- $syncthingIngress := .Values.syncthing.ingress }} +{{- $syncthingDomain := .Values.syncthing.domain | toString }} +Syncthing is now installed and configured for {{ .Release.Name | toString }}. + +Visit the following service to get started: + + Syncthing: {{ if and $ingress $syncthingIngress }}https://{{ $syncthingDomain }}{{- else }}Please refer to {{ .Release.Name }}-syncthing-svc for the right address{{- end }} + +For more information on how to use and configure Syncthing, please refer to the official documentation. diff --git a/mika/syncthing/templates/_helpers.tpl b/mika/syncthing/templates/_helpers.tpl new file mode 100644 index 00000000..a9a6fa9b --- /dev/null +++ b/mika/syncthing/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "syncthing.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 "syncthing.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 "syncthing.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "syncthing.labels" -}} +helm.sh/chart: {{ include "syncthing.chart" . }} +{{ include "syncthing.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "syncthing.selectorLabels" -}} +app.kubernetes.io/name: {{ include "syncthing.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "syncthing.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "syncthing.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/mika/syncthing/templates/configmap.yaml b/mika/syncthing/templates/configmap.yaml new file mode 100644 index 00000000..1d526ce7 --- /dev/null +++ b/mika/syncthing/templates/configmap.yaml @@ -0,0 +1,12 @@ +{{- $gid := .Values.syncthing.gid | default "1000" | toString | quote }} +{{- $uid := .Values.syncthing.uid | default "1000" | toString | quote }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-syncthing-cm + labels: + {{- include "syncthing.labels" . | nindent 4 }} +data: + PGID: {{ $gid }} + PUID: {{ $uid }} diff --git a/mika/syncthing/templates/deployment.yaml b/mika/syncthing/templates/deployment.yaml new file mode 100644 index 00000000..46b5acc9 --- /dev/null +++ b/mika/syncthing/templates/deployment.yaml @@ -0,0 +1,111 @@ +{{- $releaseName := .Release.Name | toString }} +{{- $smb := .Values.smb.enabled }} +{{- $dataSmb := .Values.storage.data.smb }} +{{- $configPersistence := .Values.storage.config.enabled }} +{{- $dataPersistence := .Values.storage.data.enabled }} +{{- $syncthing_registry := .Values.image.syncthing.registry | default "lscr.io" | toString }} +{{- $syncthing_repository := .Values.image.syncthing.repository | default "linuxserver/syncthing" | toString }} +{{- $syncthing_tag := .Values.image.syncthing.tag | default .Chart.AppVersion | toString }} +{{- $syncthing_pullPolicy := .Values.image.syncthing.pullPolicy | default "IfNotPresent" | toString | quote }} +{{- $replica_count := .Values.replicaCount | default "1" | toString }} +{{- $configMountPath := .Values.storage.config.mountPath | default "/config" | toString | quote }} +{{- $configSubPath := .Values.storage.config.subPath | toString }} +{{- $dataMountPath := .Values.storage.data.mountPath | default "/data" | toString | quote }} +{{- $dataSubPath := .Values.storage.data.subPath | toString }} +{{- $syncthingConfigs := .Values.syncthing.customConfigs }} +{{- $gid := .Values.syncthing.gid | default "1000" | int }} +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }}-syncthing + labels: + {{- include "syncthing.labels" . | nindent 4 }} +spec: + replicas: {{ int $replica_count }} + selector: + matchLabels: + {{- include "syncthing.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "syncthing.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: syncthing + image: {{ printf "%s/%s:%s" $syncthing_registry $syncthing_repository $syncthing_tag | quote }} + imagePullPolicy: {{ $syncthing_pullPolicy }} + ports: + - name: synct-web + containerPort: 8384 + protocol: TCP + - name: synct-tcp + containerPort: 22000 + protocol: TCP + - name: synct-udp + containerPort: 22000 + protocol: UDP + - name: synct-disco + containerPort: 21027 + protocol: UDP + resources: + {{- toYaml .Values.resources.syncthing | nindent 12 }} + envFrom: + - configMapRef: + name: {{ .Release.Name }}-syncthing-cm + {{- if or $configPersistence $dataPersistence $syncthingConfigs }} + volumeMounts: + {{- if $configPersistence }} + - name: {{ .Release.Name }}-syncthing-config + mountPath: {{ $configMountPath }} + {{- if $configSubPath }} + subPath: {{ $configSubPath | quote }} + {{- end }} + {{- end }} + {{- if $dataPersistence }} + - name: {{ .Release.Name }}-syncthing-{{- if and $smb $dataSmb }}smb{{- else }}data{{- end }} + mountPath: {{ $dataMountPath }} + {{- if $dataSubPath }} + subPath: {{ $dataSubPath | quote }} + {{- end }} + {{- end }} + {{- range $syncthingConfigs }} + - name: {{ $releaseName }}-custom-configs + mountPath: {{ .mountPath }} + subPath: syncthing-{{ .subPath }} + readOnly: false + {{- end }} + {{- end }} + {{- if or $configPersistence $dataPersistence $syncthingConfigs }} + volumes: + {{- if $configPersistence }} + - name: {{ .Release.Name }}-syncthing-config + persistentVolumeClaim: + claimName: {{ .Release.Name }}-syncthing-config-pvc + {{- end }} + {{- if and $dataPersistence (not (and $smb $dataSmb)) }} + - name: {{ .Release.Name }}-syncthing-data + persistentVolumeClaim: + claimName: {{ .Release.Name }}-syncthing-data-pvc + {{- end }} + {{- if and $smb (or (and $dataPersistence $dataSmb)) }} + - name: {{ .Release.Name }}-syncthing-smb + persistentVolumeClaim: + claimName: {{ .Release.Name }}-syncthing-smb-pvc + {{- end }} + {{- if or $syncthingConfigs }} + - name: {{ .Release.Name }}-syncthing-custom-configs + secret: + secretName: {{ .Release.Name }}-syncthing-custom-configs + {{- end }} + {{- end }} + securityContext: + fsGroup: {{ $gid }} diff --git a/mika/syncthing/templates/ingress.yaml b/mika/syncthing/templates/ingress.yaml new file mode 100644 index 00000000..68a8be2a --- /dev/null +++ b/mika/syncthing/templates/ingress.yaml @@ -0,0 +1,39 @@ +{{- $ingress := .Values.ingress.enabled }} +{{- $clusterIssuer := .Values.ingress.clusterIssuer | default "letsencrypt-dns-prod" | toString | quote }} +{{- $domain := .Values.syncthing.domain | toString }} +{{- if and $ingress $domain }} +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ .Release.Name }}-syncthing-ingress + labels: + {{- include "syncthing.labels" . | nindent 4 }} + annotations: + cert-manager.io/cluster-issuer: {{ $clusterIssuer }} + cert-manager.io/private-key-algorithm: "ECDSA" + nginx.ingress.kubernetes.io/affinity: "cookie" + nginx.ingress.kubernetes.io/affinity-mode: "persistent" + nginx.ingress.kubernetes.io/proxy-body-size: "100m" + nginx.ingress.kubernetes.io/session-cookie-expires: "172800" + nginx.ingress.kubernetes.io/session-cookie-max-age: "172800" + nginx.ingress.kubernetes.io/session-cookie-name: "route" + nginx.org/client-max-body-size: "100m" +spec: + ingressClassName: "nginx" + rules: + - host: {{ $domain | quote }} + http: + paths: + - backend: + service: + name: {{ .Release.Name }}-syncthing-svc + port: + name: syncthing + path: / + pathType: Prefix + tls: + - hosts: + - {{ $domain | quote }} + secretName: {{ .Release.Name }}-syncthing-tls-cert +{{- end }} diff --git a/mika/syncthing/templates/pv.yaml b/mika/syncthing/templates/pv.yaml new file mode 100644 index 00000000..495823ba --- /dev/null +++ b/mika/syncthing/templates/pv.yaml @@ -0,0 +1,50 @@ +{{- $smb := .Values.smb.enabled }} +{{- $dataSmb := .Values.storage.data.smb }} +{{- $dataPersistence := .Values.storage.data.enabled }} +{{- $mountOptions := .Values.smb.mountOptions }} +{{- $secretName := .Values.smb.secretName | default "smbcreds" | toString | quote }} +{{- $secretNamespace := .Values.smb.secretNamespace | default "default" | toString | quote }} +{{- $share := .Values.smb.share | toString | quote }} +{{- $storage := .Values.smb.pvStorage | default "100Gi" | toString | quote }} +{{- $storageClassName := .Values.smb.storageClassName | default "smb" | toString | quote }} +{{- $uid := .Values.syncthing.uid | default "1000" | toString }} +{{- $gid := .Values.syncthing.gid | default "1000" | toString }} +{{- if and $smb (or (and $dataPersistence $dataSmb)) }} +--- +apiVersion: v1 +kind: PersistentVolume +metadata: + name: {{ .Release.Name }}-syncthing-smb-pv + annotations: + pv.kubernetes.io/provisioned-by: smb.csi.k8s.io + labels: + {{- include "syncthing.labels" . | nindent 4 }} +spec: + capacity: + storage: {{ $storage }} + accessModes: + - ReadWriteMany + persistentVolumeReclaimPolicy: Retain + storageClassName: {{ $storageClassName }} + mountOptions: + - dir_mode=0777 + - file_mode=0777 + - uid={{ $uid }} + - gid={{ $gid }} + - noperm + - mfsymlinks + - cache=strict + - noserverino # required to prevent data corruption + {{- range $option := $mountOptions }} + - {{ $option }} + {{- end }} + csi: + driver: smb.csi.k8s.io + readOnly: false + volumeHandle: {{ .Release.Name }}-syncthing-smb-pv + volumeAttributes: + source: {{ $share }} + nodeStageSecretRef: + name: {{ $secretName }} + namespace: {{ $secretNamespace }} +{{- end }} diff --git a/mika/syncthing/templates/pvc.yaml b/mika/syncthing/templates/pvc.yaml new file mode 100644 index 00000000..230abda4 --- /dev/null +++ b/mika/syncthing/templates/pvc.yaml @@ -0,0 +1,59 @@ +{{- $smb := .Values.smb.enabled }} +{{- $dataSmb := .Values.storage.data.smb }} +{{- $configPersistence := .Values.storage.config.enabled }} +{{- $dataPersistence := .Values.storage.data.enabled }} +{{- $configStorage := .Values.storage.config.storage | default "1Gi" | toString | quote }} +{{- $configStorageClassName := .Values.storage.config.storageClassName | default "longhorn" | toString | quote }} +{{- $dataStorage := .Values.storage.data.storage | default "1Gi" | toString | quote }} +{{- $dataStorageClassName := .Values.storage.data.storageClassName | default "longhorn" | toString | quote }} +{{- $smbStorage := .Values.smb.pvcStorage | default "1Gi" | toString | quote }} +{{- $smbStorageClassName := .Values.smb.storageClassName | default "smb" | toString | quote }} +{{- if $configPersistence }} +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ .Release.Name }}-syncthing-config-pvc + labels: + {{- include "syncthing.labels" . | nindent 4 }} +spec: + accessModes: + - ReadWriteMany + resources: + requests: + storage: {{ $configStorage }} + storageClassName: {{ $configStorageClassName }} +{{- end }} +{{- if and $dataPersistence (not (and $smb $dataSmb)) }} +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ .Release.Name }}-syncthing-data-pvc + labels: + {{- include "syncthing.labels" . | nindent 4 }} +spec: + accessModes: + - ReadWriteMany + resources: + requests: + storage: {{ $dataStorage }} + storageClassName: {{ $dataStorageClassName }} +{{- end }} +{{- if and $smb (or (and $dataPersistence $dataSmb)) }} +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ .Release.Name }}-syncthing-smb-pvc + labels: + {{- include "syncthing.labels" . | nindent 4 }} +spec: + accessModes: + - ReadWriteMany + resources: + requests: + storage: {{ $smbStorage }} + volumeName: {{ .Release.Name }}-syncthing-smb-pv + storageClassName: {{ $smbStorageClassName }} +{{- end }} diff --git a/mika/syncthing/templates/secret.yaml b/mika/syncthing/templates/secret.yaml new file mode 100644 index 00000000..c8a55fc1 --- /dev/null +++ b/mika/syncthing/templates/secret.yaml @@ -0,0 +1,16 @@ +{{- $syncthingConfigs := .Values.syncthing.customConfigs }} +{{- if or $syncthingConfigs }} +--- +apiVersion: v1 +kind: Secret +metadata: + name: {{ .Release.Name }}-syncthing-custom-configs + labels: + {{- include "syncthing.labels" . | nindent 4 }} +type: Opaque +data: + {{- range $syncthingConfigs }} + syncthing-{{ .subPath }}: |- + {{- .config | toString | b64enc | nindent 4 }} + {{- end }} +{{- end }} diff --git a/mika/syncthing/templates/service.yaml b/mika/syncthing/templates/service.yaml new file mode 100644 index 00000000..b7dd124c --- /dev/null +++ b/mika/syncthing/templates/service.yaml @@ -0,0 +1,29 @@ +{{- $type := .Values.service.type | default "ClusterIP" | toString }} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }}-syncthing-svc + labels: + {{- include "syncthing.labels" . | nindent 4 }} +spec: + type: {{ $type }} + ports: + - port: 8384 + targetPort: synct-web + protocol: TCP + name: synct-web + - port: 22000 + targetPort: synct-tcp + protocol: TCP + name: synct-tcp + - port: 22000 + targetPort: synct-udp + protocol: UDP + name: synct-udp + - port: 21027 + targetPort: synct-disco + protocol: UDP + name: synct-disco + selector: + {{- include "syncthing.selectorLabels" . | nindent 4 }} diff --git a/mika/syncthing/values.yaml b/mika/syncthing/values.yaml new file mode 100644 index 00000000..7fe7e2ce --- /dev/null +++ b/mika/syncthing/values.yaml @@ -0,0 +1,206 @@ +# Default values for syncthing. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +# The desired number of running replicas for Syncthing. +# Default: "1" +replicaCount: "" + +# Container images used for Syncthing. +image: + # Syncthing container image configurations. + # Source: https://github.com/linuxserver/docker-syncthing/pkgs/container/syncthing + syncthing: + # The registry where the Syncthing container image is hosted. + # Default: "lscr.io" + registry: "" + # The name of the repository that contains the Syncthing container image used. + # Default: "linuxserver/syncthing" + repository: "" + # The tag that specifies the version of the Syncthing container image used. + # Default: Chart appVersion + tag: "" + # The policy that determines when Kubernetes should pull the Syncthing container image. + # Default: "IfNotPresent" + pullPolicy: "" + +# Credentials used to securely authenticate and authorise the pulling of container images from private registries. +# Example: +# imagePullSecrets: +# - name: "ghcr-token-secret" +imagePullSecrets: [] + +# Syncthing configurations. +syncthing: + # The ingress domain name that hosts the Syncthing server. + # Example: + # domain: "chart_name.example.com" + domain: "" + # The group ID used to run the Syncthing containers. + # Default: "1000" + # Example: + # gid: "" + gid: "" + # The user ID used to run the Syncthing containers. + # Default: "1000" + # Example: + # uid: "" + uid: "" + # Optional custom configurations to be mounted as a file inside the Syncthing container. + # Example: + # customConfigs: + # - mountPath: "/config" + # subPath: "config.xml" + # config: >- + # + # * + # 8989 + # 9898 + # + customConfigs: [] + +# Ingress configurations. +ingress: + # Specifies whether Ingress should be enabled for hosting Syncthing services. + # Example: + # enabled: true + enabled: false + # The name of the cluster issuer for Ingress. + # Default: "letsencrypt-dns-prod" + clusterIssuer: "" + +# Service configurations. +service: + # The type of service used for Syncthing services. + # Default: "ClusterIP" + # Example: + # type: "NodePort" + type: "" + +# Storage configurations. +storage: + # Config storage configurations. + config: + # Specifies whether persistent storage should be provisioned for config storage. + # Example: + # enabled: false + enabled: true + # The path where the config storage should be mounted on the container. + # Default: "/config" + # Example: + # mountPath: "/settings" + mountPath: "" + # The subpath within the config storage to mount to the container. Leave empty if not required. + # Example: + # subPath: "Config" + subPath: "" + # The default amount of persistent storage allocated for the config storage. + # Default: "1Gi" + # Example: + # storage: "10Gi" + storage: "" + # The storage class name used for dynamically provisioning a persistent volume for the config storage. + # Default: "longhorn" + # Example: + # storageClassName: "longhorn" + storageClassName: "" + # Data storage configurations. + data: + # Specifies whether persistent storage should be provisioned for data storage. + # Example: + # enabled: true + enabled: false + # Specifies whether to use an SMB share for the data storage. + # Example: + # smb: true + smb: false + # The path where the data storage should be mounted on the container. + # Default: "/data" + # Example: + # mountPath: "/files" + mountPath: "" + # The subpath within the data storage to mount to the container. Leave empty if not required. + # Example: + # subPath: "Data" + subPath: "" + # The default amount of persistent storage allocated for the data storage. + # Default: "1Gi" + # Example: + # storage: "10Gi" + storage: "" + # The storage class name used for dynamically provisioning a persistent volume for the data storage. + # Default: "longhorn" + # Example: + # storageClassName: "longhorn" + storageClassName: "" + +# SMB storage configurations. +smb: + # Specifies whether to enable persistent storage to be provisioned in the form of an SMB share. + # Example: + # enabled: true + enabled: false + # The additional mount options used to mount the SMB share volume. + # Example: + # mountOptions: + # - "_netdev" + # - "nofail" + # - "vers=3.0" + # - "iocharset=utf8" + mountOptions: [] + # The amount of persistent storage available on the SMB share volume. + # Default: "100Gi" + # Example: + # pvStorage: "10Gi" + pvStorage: "" + # The amount of persistent storage allocated for the SMB share storage. + # Default: "1Gi" + # Example: + # pvcStorage: "500Mi" + pvcStorage: "" + # The name of the existing secret containing the credentials used to authenticate with the SMB share. + # Default: "smbcreds" + # Example: + # secretName: "smb-secret" + secretName: "" + # The namespace where the secret containing the credentials used to authenticate with the SMB share is located. + # Default: "default" + # Example: + # secretNamespace: "smb" + secretNamespace: "" + # The SMB share address and name to mount as a persistent volume. + # Example: + # share: "//192.168.0.123/mynas" + share: "" + # The storage class name used for dynamically provisioning a persistent volume for the SMB share storage. + # Default: "smb" + # Example: + # storageClassName: "smb" + storageClassName: "" + +# Resource requirements and limits for Syncthing containers. +resources: + # Syncthing container resources. + # Example: + # syncthing: + # # The minimum amount of resources required by Syncthing to run. + # requests: + # # The minimum amount of CPU resources required by Syncthing. + # # Example: + # # cpu: "10m" + # cpu: "10m" + # # The minimum amount of memory required by Syncthing. + # # Example: + # # memory: "10Mi" + # memory: "100Mi" + # # The maximum amount of resources allowed for Syncthing. + # limits: + # # The maximum amount of CPU resources allowed for Syncthing. + # # Example: + # # cpu: "250m" + # cpu: "250m" + # # The maximum amount of memory allowed for Syncthing. + # # Example: + # # memory: "250Mi" + # memory: "200Mi" + syncthing: {} diff --git a/template/chartName/README.md b/template/chartName/README.md index 36214b59..2e7f0d60 100644 --- a/template/chartName/README.md +++ b/template/chartName/README.md @@ -32,6 +32,15 @@ A Helm chart for deploying ChartName. --- +## Application configurations + +> [!NOTE] +> The following configurations are expected or recommended to be set up from within the application after completing the installation. + +1. TODO. + +--- + ## How to add the chart repo 1. Add the repo to your local helm client: