Skip to content

Commit 8600219

Browse files
committed
feat: allow config override and add support for custom assets
Signed-off-by: Frederic Leger <frederic@webofmars.com>
1 parent 9b9591f commit 8600219

File tree

12 files changed

+1484
-19
lines changed

12 files changed

+1484
-19
lines changed

.vscode/extensions.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"recommendations": [
3+
"tim-koehler.helm-intellisense"
4+
]
5+
}

Taskfile.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
version: '3'
2+
3+
vars:
4+
K8S_VERSION: 1.31.0
5+
6+
tasks:
7+
8+
default:
9+
cmds:
10+
- task --list-all | awk '{ print $2 }' | cut -d ':' -f 1 | grep -vE '^Available|default$' | fzf | xargs -L 1 task
11+
silent: true
12+
13+
tests:
14+
cmds:
15+
- task kubeconform
16+
- task ct-lint
17+
- task ct-install
18+
19+
ct-lint:
20+
cmds:
21+
- ct lint
22+
23+
ct-install:
24+
cmds:
25+
- ct install
26+
27+
kubeconform:
28+
cmds:
29+
- helm kubeconform --values-dir dufs/ci --kubernetes-version {{ .K8S_VERSION }} --summary dufs

dufs/ci/assets-values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
assetsZipUrl: 'https://indigo-recent-tiger-10.mypinata.cloud/ipfs/bafkreidu6r3girym4ltsslvab3j3is5i52zrbs2jgf25u34nonkfx26qkq'

dufs/ci/empty-values.yaml

Whitespace-only changes.

dufs/templates/configmap.yaml

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,4 @@ metadata:
55
labels:
66
{{- include "dufs.labels" . | nindent 4 }}
77
data:
8-
dufs.yaml : |
9-
serve-path: '/dufs/data'
10-
bind: 0.0.0.0
11-
port: 5000
12-
auth: []
13-
allow-all: false
14-
allow-upload: true
15-
allow-delete: true
16-
allow-search: true
17-
allow-symlink: true
18-
allow-archive: true
19-
enable-cors: true
20-
render-index: true
21-
render-try-index: true
22-
render-spa: true
23-
log-format: '$remote_addr "$request" $status $http_user_agent'
24-
log-file: /dev/stdout
25-
compress: low
8+
dufs.yaml: {{ index .Values "dufs.yaml" | quote }}

dufs/templates/deployment.yaml

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,37 @@ spec:
3030
serviceAccountName: {{ include "dufs.serviceAccountName" . }}
3131
securityContext:
3232
{{- toYaml .Values.podSecurityContext | nindent 8 }}
33+
{{- if .Values.assetsZipUrl }}
34+
initContainers:
35+
- name: setup-theme
36+
image: busybox
37+
command:
38+
- sh
39+
- -c
40+
- |
41+
set -ex
42+
cd /assets
43+
wget --no-verbose --tries=3 --timeout=15 -O assets.zip {{ .Values.assetsZipUrl | quote }}
44+
unzip assets.zip
45+
rm assets.zip
46+
volumeMounts:
47+
- name: dufs-assets
48+
mountPath: /assets
49+
readOnly: false
50+
{{- end }}
3351
containers:
3452
- name: {{ .Chart.Name }}
3553
env:
3654
- name: DUFS_CONFIG
37-
value: "/dufs/config/dufs.yaml"
55+
value: '/dufs/config/dufs.yaml'
56+
- name: DUFS_BIND
57+
value: '0.0.0.0'
58+
- name: DUFS_PORT
59+
value: '5000'
60+
{{- if .Values.assetsZipUrl }}
61+
- name: DUFS_ASSETS
62+
value: '/assets'
63+
{{- end }}
3864
securityContext:
3965
{{- toYaml .Values.securityContext | nindent 12 }}
4066
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
@@ -53,13 +79,22 @@ spec:
5379
- name: config
5480
mountPath: /dufs/config
5581
readOnly: true
82+
{{- if .Values.assetsZipUrl }}
83+
- name: dufs-assets
84+
mountPath: /assets
85+
readOnly: false
86+
{{- end }}
5687
{{- with .Values.volumeMounts }}
5788
{{- toYaml . | nindent 12 }}
5889
{{- end }}
5990
volumes:
6091
- name: config
6192
configMap:
6293
name: {{ include "dufs.fullname" . }}
94+
{{- if .Values.assetsZipUrl }}
95+
- name: dufs-assets
96+
emptyDir: {}
97+
{{- end }}
6398
{{- with .Values.volumes }}
6499
{{- toYaml . | nindent 8 }}
65100
{{- end }}

dufs/values.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,31 @@
22
# This is a YAML-formatted file.
33
# Declare variables to be passed into your templates.
44

5+
# -- dufs config file that will be used
6+
# check the auth section if you want to add some authentication
7+
# and allow uploads/deletes/patchs
8+
"dufs.yaml": |
9+
# please adjust settings to your needs
10+
serve-path: '/dufs/data'
11+
auth: []
12+
allow-all: false
13+
allow-upload: true
14+
allow-delete: true
15+
allow-search: true
16+
allow-symlink: true
17+
allow-archive: true
18+
enable-cors: true
19+
render-index: true
20+
render-try-index: true
21+
render-spa: true
22+
log-format: '$remote_addr "$request" $status $http_user_agent'
23+
log-file: /dev/stdout
24+
compress: low
25+
26+
# -- url of a zip file containing assets for custom Ui
27+
# see https://github.com/sigoden/dufs/tree/main/assets for reference
28+
assetsZipUrl: ""
29+
530
replicaCount: 1
631

732
image:

tests/assets/assets.zip

14 KB
Binary file not shown.

tests/assets/favicon.ico

2.15 KB
Binary file not shown.

0 commit comments

Comments
 (0)