Skip to content

Commit fb89a4f

Browse files
committed
feat(k8s-dbs): dbs纳管rustfs #14920
1 parent 64e9388 commit fb89a4f

File tree

13 files changed

+932
-0
lines changed

13 files changed

+932
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: v1
2+
appVersion: 1.0.0
3+
description: A Helm chart for Kubernetes
4+
name: rustfs
5+
version: 1.0.0
Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
{{/* vim: set filetype=mustache: */}}
2+
{{/*
3+
Expand the name of the chart.
4+
*/}}
5+
{{- define "rustfs.name" -}}
6+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
7+
{{- end -}}
8+
9+
{{/*
10+
Create a default fully qualified app name.
11+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
12+
If release name contains chart name it will be used as a full name.
13+
*/}}
14+
{{- define "rustfs.fullname" -}}
15+
{{- if .Values.fullnameOverride -}}
16+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
17+
{{- else -}}
18+
{{- $name := default .Chart.Name .Values.nameOverride -}}
19+
{{- if contains $name .Release.Name -}}
20+
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
21+
{{- else -}}
22+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
23+
{{- end -}}
24+
{{- end -}}
25+
{{- end -}}
26+
27+
{{/*
28+
Create chart name and version as used by the chart label.
29+
*/}}
30+
{{- define "rustfs.chart" -}}
31+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
32+
{{- end -}}
33+
34+
{{/*
35+
Common labels
36+
*/}}
37+
{{- define "rustfs.labels" -}}
38+
helm.sh/chart: {{ include "rustfs.chart" . }}
39+
{{ include "rustfs.selectorLabels" . }}
40+
{{- if .Chart.AppVersion }}
41+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
42+
{{- end }}
43+
app.kubernetes.io/managed-by: {{ .Release.Service }}
44+
{{- end }}
45+
46+
{{/*
47+
Selector labels
48+
*/}}
49+
{{- define "rustfs.selectorLabels" -}}
50+
app.kubernetes.io/name: {{ include "rustfs.name" . }}
51+
app.kubernetes.io/instance: {{ .Release.Name }}
52+
{{- end }}
53+
54+
{{/*
55+
Return the appropriate apiVersion for poddisruptionbudget.
56+
*/}}
57+
{{- define "rustfs.pdb.apiVersion" -}}
58+
{{- if semverCompare "<1.21-0" .Capabilities.KubeVersion.Version -}}
59+
{{- print "policy/v1beta1" -}}
60+
{{- else -}}
61+
{{- print "policy/v1" -}}
62+
{{- end -}}
63+
{{- end -}}
64+
65+
{{/*
66+
Return the appropriate apiVersion for statefulset.
67+
*/}}
68+
{{- define "rustfs.statefulset.apiVersion" -}}
69+
{{- if semverCompare "<1.16-0" .Capabilities.KubeVersion.Version -}}
70+
{{- print "apps/v1beta2" -}}
71+
{{- else -}}
72+
{{- print "apps/v1" -}}
73+
{{- end -}}
74+
{{- end -}}
75+
76+
{{/*
77+
Determine secret name.
78+
*/}}
79+
{{- define "rustfs.secretName" -}}
80+
{{- if .Values.existingSecret -}}
81+
{{- .Values.existingSecret }}
82+
{{- else -}}
83+
{{- include "rustfs.fullname" . -}}
84+
{{- end -}}
85+
{{- end -}}
86+
87+
{{/*
88+
Properly format optional additional arguments to RustFS binary
89+
*/}}
90+
{{- define "rustfs.extraArgs" -}}
91+
{{- range .Values.extraArgs -}}
92+
{{ " " }}{{ . }}
93+
{{- end -}}
94+
{{- end -}}
95+
96+
{{/*
97+
Return the proper Docker Image Registry Secret Names
98+
*/}}
99+
{{- define "rustfs.imagePullSecrets" -}}
100+
{{- if .Values.global }}
101+
{{- if .Values.global.imagePullSecrets }}
102+
imagePullSecrets:
103+
{{- range .Values.global.imagePullSecrets }}
104+
- name: {{ . }}
105+
{{- end }}
106+
{{- else if .Values.imagePullSecrets }}
107+
imagePullSecrets:
108+
{{ toYaml .Values.imagePullSecrets }}
109+
{{- end -}}
110+
{{- else if .Values.imagePullSecrets }}
111+
imagePullSecrets:
112+
{{ toYaml .Values.imagePullSecrets }}
113+
{{- end -}}
114+
{{- end -}}
115+
116+
{{/*
117+
Formats volumeMount for RustFS tls keys and trusted certs
118+
*/}}
119+
{{- define "rustfs.tlsKeysVolumeMount" -}}
120+
{{- if .Values.tls.enabled }}
121+
- name: cert-secret-volume
122+
mountPath: {{ .Values.certsPath }}
123+
{{- end }}
124+
{{- end -}}
125+
126+
{{/*
127+
Formats volume for RustFS tls keys and trusted certs
128+
*/}}
129+
{{- define "rustfs.tlsKeysVolume" -}}
130+
{{- if .Values.tls.enabled }}
131+
- name: cert-secret-volume
132+
secret:
133+
secretName: {{ .Values.tls.certSecret }}
134+
items:
135+
- key: {{ .Values.tls.publicCrt }}
136+
path: public.crt
137+
- key: {{ .Values.tls.privateKey }}
138+
path: private.key
139+
{{- end }}
140+
{{- end -}}
141+
142+
{{/*
143+
Expand the name of the clusterdefinition.
144+
*/}}
145+
{{- define "rustfs.cdName" -}}
146+
rustfs-{{ .Chart.Version }}
147+
{{- end -}}
148+
149+
{{/*
150+
Expand the name of the componentdefinition.
151+
*/}}
152+
{{- define "rustfs.cmpdName" -}}
153+
rustfs-{{ .Chart.Version }}
154+
{{- end -}}
155+
156+
{{/*
157+
Expand the name of the componentversion.
158+
*/}}
159+
{{- define "rustfs.cmpvName" -}}
160+
rustfs-{{ .Chart.Version }}
161+
{{- end -}}
162+
163+
{{/*
164+
Expand the name of the configmap.
165+
*/}}
166+
{{- define "rustfs.config" -}}
167+
rustfs-configuration-{{ .Chart.Version }}
168+
{{- end -}}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
apiVersion: apps.kubeblocks.io/v1alpha1
2+
kind: ClusterDefinition
3+
metadata:
4+
name: {{ include "rustfs.cdName" . }}
5+
labels:
6+
{{- include "rustfs.labels" . | nindent 4 }}
7+
spec:
8+
topologies:
9+
- name: standalone
10+
default: true
11+
components:
12+
- name: rustfs
13+
compDef: {{ include "rustfs.cmpdName" . }}-standalone
14+
- name: distributed
15+
components:
16+
- name: rustfs
17+
compDef: {{ include "rustfs.cmpdName" . }}-distributed

0 commit comments

Comments
 (0)