chart-seafile: add

This commit is contained in:
2024-09-08 18:38:02 +02:00
parent 18d0ae563c
commit 940de05d13
15 changed files with 651 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,9 @@
dependencies:
- name: mariadb
repository: oci://registry-1.docker.io/bitnamicharts
version: 19.0.5
- name: memcached
repository: oci://registry-1.docker.io/bitnamicharts
version: 7.4.12
digest: sha256:c789ded21a78e56ce163b1f02b63aa54b0f8fee1c15363aa96a8ff24131e17b7
generated: "2024-09-08T18:15:15.839569423+02:00"

27
charts/seafile/Chart.yaml Normal file
View File

@ -0,0 +1,27 @@
---
apiVersion: v2
name: seafile
description: >
An open-source, cross-platform file-hosting software system.
home: https://www.seafile.com/en/home/
icon: https://www.seafile.com/media/img/seafile-logo.png
type: application
version: 0.1.0
appVersion: 11.0.12
dependencies:
- name: mariadb
version: 19.0.5
repository: oci://registry-1.docker.io/bitnamicharts
condition: mariadb.enabled
- name: memcached
version: 7.4.12
repository: oci://registry-1.docker.io/bitnamicharts
condition: memcached.enabled
sources: [https://github.com/haiwen/seafile]
maintainers:
- name: Bertalan Zoltán Péter
email: bertalan.peter@bp99.eu
url: https://bp99.eu/

86
charts/seafile/README.md Normal file
View File

@ -0,0 +1,86 @@
# seafile
![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 11.0.12](https://img.shields.io/badge/AppVersion-11.0.12-informational?style=flat-square)
An open-source, cross-platform file-hosting software system.
**Homepage:** <https://www.seafile.com/en/home/>
## Maintainers
| Name | Email | Url |
| ---- | ------ | --- |
| Bertalan Zoltán Péter | <bertalan.peter@bp99.eu> | <https://bp99.eu/> |
## Source Code
* <https://github.com/haiwen/seafile>
## Requirements
| Repository | Name | Version |
|------------|------|---------|
| oci://registry-1.docker.io/bitnamicharts | mariadb | 19.0.5 |
| oci://registry-1.docker.io/bitnamicharts | memcached | 7.4.12 |
## Values
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | affinity |
| autoscaling | object | `{"enabled":false,"maxReplicas":100,"minReplicas":1,"targetCPUUtilizationPercentage":80}` | autoscaling settings |
| autoscaling.enabled | boolean | `false` | whether autoscaling should be enabled |
| autoscaling.maxReplicas | int | `100` | maximum number of replicas |
| autoscaling.minReplicas | int | `1` | minimum number of replicas |
| autoscaling.targetCPUUtilizationPercentage | int | `80` | try to utilize this much CPU [%] |
| fullnameOverride | string | `""` | override the fullname of the entire chart |
| global | object | `{"storageClass":""}` | global settings |
| global.storageClass | string | `""` | global storage class for PVCs |
| image | object | `{"pullPolicy":"IfNotPresent","repository":"seafileltd/seafile-mc","tag":""}` | seafile image configuration |
| image.pullPolicy | string | `"IfNotPresent"` | when to pull the image |
| image.repository | string | `"seafileltd/seafile-mc"` | what seafile image to use |
| image.tag | string | `""` | override image tag; default is the chart appVersion |
| imagePullSecrets | list | `[]` | secrets used to pull the image |
| ingress | object | `{"annotations":{},"className":"","enabled":false,"hosts":[{"host":"chart-example.local","paths":[{"path":"/","pathType":"ImplementationSpecific"}]}],"tls":[]}` | ingress setup |
| ingress.annotations | object | `{}` | additional ingress annotations |
| ingress.className | string | `""` | override ingress class name |
| ingress.enabled | boolean | `false` | whether an ingress should be generated |
| ingress.hosts | list | `[{"host":"chart-example.local","paths":[{"path":"/","pathType":"ImplementationSpecific"}]}]` | ingress hosts |
| ingress.tls | list | `[]` | TLS setup |
| livenessProbe.httpGet.path | string | `"/"` | |
| livenessProbe.httpGet.port | string | `"http"` | |
| mariadb | object | `{"auth":{"rootPassword":"changeme"},"persistence":{"enabled":true,"size":"1Gi","storageClass":""}}` | mariadb subchart configuration |
| mariadb.auth | object | `{"rootPassword":"changeme"}` | auth settings |
| mariadb.auth.rootPassword | string | `"changeme"` | root user password; DO NOT FORGET TO CHANGE THIS VALUE |
| mariadb.persistence | object | `{"enabled":true,"size":"1Gi","storageClass":""}` | DB persistence settings |
| memcached | object | `{"extraEnvVars":[{"name":"MEMCACHED_CACHE_SIZE","value":"256M"}]}` | memcached subchart configuration |
| nameOverride | string | `""` | override the name of the entire chart |
| nodeSelector | object | `{}` | node selectors |
| persistence | object | `{"accessModes":["ReadWriteOnce"],"annotations":{},"create":true,"enabled":true,"labels":{},"size":"16Gi","storageClass":""}` | persistence settings |
| persistence.accessModes | list | `["ReadWriteOnce"]` | PVC access modes |
| persistence.annotations | object | `{}` | additional PVC annotations |
| persistence.create | boolean | `true` | whether to create PVCs |
| persistence.enabled | boolean | `true` | whether to handle persistence at all |
| persistence.labels | object | `{}` | additional PVC labels |
| persistence.size | string | `"16Gi"` | limit PVC size |
| persistence.storageClass | string | `""` | override PVC storage class |
| podAnnotations | object | `{}` | additional pod annotations |
| podLabels | object | `{}` | additional pod labels |
| podSecurityContext | object | `{}` | custom pod security context |
| readinessProbe.httpGet.path | string | `"/"` | |
| readinessProbe.httpGet.port | string | `"http"` | |
| replicaCount | int | `1` | number of seafile replicas to run (only tested with 1) |
| resources | object | `{}` | custom resources |
| seafile | object | `{"admin_email":"admin@hostname.tld","admin_password":"changeme2","timezone":"Europe/Berlin"}` | seafile app configuration |
| seafile.admin_email | string | `"admin@hostname.tld"` | email address of the admin user |
| seafile.admin_password | string | `"changeme2"` | password of the admin user; DO NOT FORGET TO CHANGE THIS VALUE |
| seafile.timezone | string | `"Europe/Berlin"` | [TZ identifier](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) |
| securityContext | object | `{}` | custom security context |
| service | object | `{"port":80,"type":"ClusterIP"}` | service setup |
| service.port | int | `80` | service port |
| service.type | string | `"ClusterIP"` | service type |
| serviceAccount.annotations | object | `{}` | service account annotations |
| serviceAccount.create | boolean | `false` | whether a service account should be created |
| serviceAccount.name | string | `""` | the name of the service account to use; if unset and create is true, a name is generated using the fullname template |
| tolerations | list | `[]` | tolerations |

View File

@ -0,0 +1,22 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
{{- 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 "seafile.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
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 its status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "seafile.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "seafile.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 "seafile.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
{{- end }}

View File

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

View File

@ -0,0 +1,83 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "seafile.fullname" . }}
labels:
{{- include "seafile.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "seafile.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "seafile.labels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "seafile.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: DB_HOST
value: {{ template "mariadb.primary.fullname" .Subcharts.mariadb }}
- name: DB_ROOT_PASSWD
value: {{ .Values.mariadb.auth.rootPassword }}
- name: TIME_ZONE
value: {{ .Values.seafile.timezone }}
- name: SEAFILE_ADMIN_EMAIL
value: {{ .Values.seafile.admin_email }}
- name: SEAFILE_ADMIN_PASSWORD
value: {{ .Values.seafile.admin_password }}
- name: SEAFILE_SERVER_LETSENCRYPT
value: 'false'
- name: SEAFILE_SERVER_HOSTNAME
value: seafile
ports:
- name: http
containerPort: {{ .Values.service.port }}
protocol: TCP
livenessProbe:
{{- toYaml .Values.livenessProbe | nindent 12 }}
readinessProbe:
{{- toYaml .Values.readinessProbe | nindent 12 }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- name: {{ include "seafile.fullname" . }}-volume
mountPath: /shared
volumes:
- name: {{ include "seafile.fullname" . }}-volume
persistentVolumeClaim:
claimName: {{ include "seafile.fullname" . }}-claim
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}

View File

@ -0,0 +1,32 @@
{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "seafile.fullname" . }}
labels:
{{- include "seafile.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "seafile.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,61 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "seafile.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "seafile.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .pathType }}
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,27 @@
{{- if and .Values.persistence.enabled .Values.persistence.create }}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "seafile.fullname" . }}-claim
namespace: {{ $.Release.Namespace }}
annotations:
{{ .Values.persistence.annotations | toYaml | indent 4}}
labels:
{{ .Values.persistence.labels | toYaml | indent 4}}
spec:
accessModes:
{{- if gt .Values.replicaCount 1.0 }}
- ReadWriteMany
{{- else }}
{{- .Values.persistence.accessModes | toYaml | nindent 4 }}
{{- end }}
volumeMode: Filesystem
{{- include "seafile.persistence.storageClass" . | nindent 2 }}
{{- with .Values.persistence.volumeName }}
volumeName: {{ . }}
{{- end }}
resources:
requests:
storage: {{ .Values.persistence.size }}
{{- end }}

View File

@ -0,0 +1,16 @@
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "seafile.fullname" . }}
labels:
{{- include "seafile.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- name: http
port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
selector:
{{- include "seafile.selectorLabels" . | nindent 4 }}

View File

@ -0,0 +1,14 @@
{{- if .Values.serviceAccount.create -}}
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "seafile.serviceAccountName" . }}
labels:
{{- include "seafile.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
automountServiceAccountToken: {{ .Values.serviceAccount.automount }}
{{- end }}

View File

@ -0,0 +1,15 @@
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "seafile.fullname" . }}-test-connection"
labels:
{{- include "seafile.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "seafile.fullname" . }}:{{ .Values.service.port }}']
restartPolicy: Never

163
charts/seafile/values.yaml Normal file
View File

@ -0,0 +1,163 @@
---
# -- (int) number of seafile replicas to run (only tested with 1)
replicaCount: 1
# -- global settings
global:
# -- global storage class for PVCs
storageClass: ''
# -- seafile image configuration
image:
# -- what seafile image to use
repository: seafileltd/seafile-mc
# -- when to pull the image
pullPolicy: IfNotPresent
# -- override image tag; default is the chart appVersion
tag: ''
# -- secrets used to pull the image
imagePullSecrets: []
# -- override the name of the entire chart
nameOverride: ''
# -- override the fullname of the entire chart
fullnameOverride: ''
serviceAccount:
# -- (boolean) whether a service account should be created
create: false
# -- service account annotations
annotations: {}
# -- the name of the service account to use; if unset and create is true, a name is generated using the fullname template
name: ''
# -- additional pod annotations
podAnnotations: {}
# -- additional pod labels
podLabels: {}
# -- custom pod security context
podSecurityContext: {}
# fsGroup: 2000
# -- custom security context
securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
# -- service setup
service:
# -- service type
type: ClusterIP
# -- (int) service port
port: 80
# -- ingress setup
ingress:
# -- (boolean) whether an ingress should be generated
enabled: false
# -- override ingress class name
className: ''
# -- additional ingress annotations
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
# -- ingress hosts
hosts:
- host: chart-example.local
paths:
- path: /
pathType: ImplementationSpecific
# -- TLS setup
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
# -- custom resources
resources: {}
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
# -- autoscaling settings
autoscaling:
# -- (boolean) whether autoscaling should be enabled
enabled: false
# -- (int) minimum number of replicas
minReplicas: 1
# -- (int) maximum number of replicas
maxReplicas: 100
# -- (int) try to utilize this much CPU [%]
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80
# -- persistence settings
persistence:
# -- (boolean) whether to handle persistence at all
enabled: true
# -- (boolean) whether to create PVCs
create: true
# -- additional PVC annotations
annotations: {}
# -- additional PVC labels
labels: {}
# -- PVC access modes
accessModes: [ReadWriteOnce]
# -- override PVC storage class
storageClass: ''
# -- limit PVC size
size: 16Gi
# -- node selectors
nodeSelector: {}
# -- tolerations
tolerations: []
# -- affinity
affinity: {}
# -- seafile app configuration
seafile:
# -- [TZ identifier](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)
timezone: Europe/Berlin
# -- email address of the admin user
admin_email: admin@hostname.tld
# -- password of the admin user; DO NOT FORGET TO CHANGE THIS VALUE
admin_password: changeme2
# -- mariadb subchart configuration
mariadb:
# -- auth settings
auth:
# -- root user password; DO NOT FORGET TO CHANGE THIS VALUE
rootPassword: changeme
# -- DB persistence settings
persistence:
enabled: true
storageClass: ''
size: 1Gi
# -- memcached subchart configuration
memcached:
extraEnvVars:
- name: MEMCACHED_CACHE_SIZE
value: 256M