Skip to content

docs: provide K8s deploy #8585

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions helm/alist/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: alist

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that the version and appVersion fields are specified in the Chart.yaml file to maintain compatibility and clarity for users.

description: A file list program that supports multiple storages, powered by Gin and Solidjs.
version: v3.45.0
apiVersion: v1
keywords:
- alist
sources:
- https://github.com/AlistGo/alist
home: https://alistgo.com
icon: https://cdn.jsdelivr.net/gh/alist-org/logo@main/logo.svg
59 changes: 59 additions & 0 deletions helm/alist/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Alist Helm Chart

A file list program that supports multiple storages, powered by Gin and Solidjs.

## Introduction

This chart bootstraps alist on [Kubernetes](http://kubernetes.io) using the [Helm](https://helm.sh) package manager.

## Prerequisites

- Kubernetes cluster 1.20+
- Helm v3.2.0+

## Configure Alist Helm repo

No Helm repository has been provided. Please `git clone` the code project, and install it manually in the `helm` directory.

```bash
git clone https://github.com/AlistGo/alist.git

cd alist/helm
```

### Installing the Chart

Create the alist namespace.

```bash
kubectl create namespace alist
```

Install the helm chart into the alist namespace.

```bash
helm install alist . --namespace alist
```

### Values reference

The default values.yaml should be suitable for most basic deployments.

| Parameter | Description | Default |
|----------------------------|--------------------------------------------------------------|---------------------------------|
| `image.registry` | Imag registry | `docker.io` |
| `image.repository` | Image name | `xhofe/alist` |
| `image.tag` | Image tag | `latest` |
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `replicaCount` | Number of scanner adapter Pods to run | `1` |
| `persistence.storageClass` | Specify the storageClass used to provision the volume | |
| `persistence.accessMode` | The access mode of the volume | `ReadWriteOnce` |
| `persistence.size` | The size of the volume | `5Gi` |
| `service.type` | Kubernetes service type | `ClusterIP` |
| `service.loadBalancerIP` | Kubernetes service loadBalancerIP | |
| `service.http.port` | Kubernetes service http port | `5244` |
| `service.http.targetPort` | Kubernetes service http targetPort | `5244` |
| `service.http.nodePort` | Kubernetes service http nodePort | `35244` |
| `service.https.port` | Kubernetes service https port | `5245` |
| `service.https.targetPort` | Kubernetes service https targetPort | `5245` |
| `service.https.nodePort` | Kubernetes service https nodePort | `35245` |
32 changes: 32 additions & 0 deletions helm/alist/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "alist.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 "alist.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 "alist.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
47 changes: 47 additions & 0 deletions helm/alist/templates/alist-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: {{ template "alist.name" . }}
chart: {{ template "alist.chart" . }}
release: {{ .Release.Name }}
name: {{ template "alist.fullname" . }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ template "alist.name" . }}
release: {{ .Release.Name }}
template:
metadata:
labels:
app: {{ template "alist.name" . }}
release: {{ .Release.Name }}
spec:
containers:
- env:
- name: PGID
value: "0"
- name: PUID
value: "0"
- name: TZ
value: UTC
- name: UMASK
value: "022"
name: {{ .Chart.Name }}
image: "{{ .Values.image.registry}}/{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: {{ .Values.service.http.port }}
protocol: TCP
- containerPort: {{ .Values.service.https.port }}
protocol: TCP
volumeMounts:
- mountPath: /opt/alist/data
name: alist-data
restartPolicy: Always
enableServiceLinks: false
volumes:
- name: alist-data
persistentVolumeClaim:
claimName: {{ template "alist.fullname" . }}
21 changes: 21 additions & 0 deletions helm/alist/templates/alist-persistentvolumeclaim.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ template "alist.fullname" . }}
labels:
app: {{ template "alist.name" . }}
chart: {{ template "alist.chart" . }}
release: {{ .Release.Name }}
spec:
accessModes:
- {{ .Values.persistence.accessMode | quote }}
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- if .Values.persistence.storageClass }}
{{- if (eq "-" .Values.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.persistence.storageClass }}"
{{- end }}
{{- end }}
27 changes: 27 additions & 0 deletions helm/alist/templates/alist-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "alist.fullname" . }}
spec:
type: {{ .Values.service.type | default "ClusterIP" }}
{{- if and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerIP)) }}
loadBalancerIP: {{ default "" .Values.service.loadBalancerIP | quote }}
{{- end }}
ports:
- name: http
protocol: TCP
port: {{ .Values.service.http.port }}
targetPort: {{ .Values.service.http.targetPort }}
{{- if (and (eq .Values.service.type "NodePort") ( .Values.service.http.nodePort)) }}
nodePort: {{ .Values.service.http.nodePort }}
{{- end }}
- name: https
protocol: TCP
port: {{ .Values.service.https.port }}
targetPort: {{ .Values.service.https.targetPort }}
{{- if (and (eq .Values.service.type "NodePort") ( .Values.service.https.nodePort)) }}
nodePort: {{ .Values.service.https.nodePort }}
{{- end }}
selector:
app: {{ template "alist.name" . }}
release: {{ .Release.Name }}
28 changes: 28 additions & 0 deletions helm/alist/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
nameOverride: ""

fullnameOverride: ""

image:
registry: docker.io
repository: xhofe/alist
tag: latest
pullPolicy: IfNotPresent

replicaCount: 1

persistence:
storageClass: ""
accessMode: ReadWriteOnce
size: 5Gi

service:
type: ClusterIP
loadBalancerIP: ~
http:
port: 5244
targetPort: 5244
nodePort: 35244
https:
port: 5245
targetPort: 5245
nodePort: 35245