mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
add a post-install hook for creating buckets
This commit is contained in:
parent
7a50762b9e
commit
c44149a88f
71
k8s/charts/seaweedfs/templates/post-install-bucket-hook.yaml
Normal file
71
k8s/charts/seaweedfs/templates/post-install-bucket-hook.yaml
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
{{- if .Values.master.enabled }}
|
||||||
|
{{- if .Values.filer.s3.enabled }}
|
||||||
|
---
|
||||||
|
apiVersion: batch/v1
|
||||||
|
kind: Job
|
||||||
|
metadata:
|
||||||
|
name: "{{ $.Release.Name }}"
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name | quote }}
|
||||||
|
annotations:
|
||||||
|
"helm.sh/hook": post-install
|
||||||
|
"helm.sh/hook-weight": "-5"
|
||||||
|
"helm.sh/hook-delete-policy": hook-succeeded
|
||||||
|
spec:
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
name: "{{ .Release.Name }}"
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name | quote }}
|
||||||
|
spec:
|
||||||
|
restartPolicy: Never
|
||||||
|
containers:
|
||||||
|
- name: post-install-job
|
||||||
|
image: {{ template "master.image" . }}
|
||||||
|
env:
|
||||||
|
- name: WEED_CLUSTER_DEFAULT
|
||||||
|
value: "sw"
|
||||||
|
- name: WEED_CLUSTER_SW_MASTER
|
||||||
|
value: "seaweedfs-master.seaweedfs:9333"
|
||||||
|
- name: WEED_CLUSTER_SW_FILER
|
||||||
|
value: "seaweedfs-filer-client.seaweedfs:8888"
|
||||||
|
- name: POD_IP
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
fieldPath: status.podIP
|
||||||
|
- name: POD_NAME
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
fieldPath: metadata.name
|
||||||
|
- name: NAMESPACE
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
fieldPath: metadata.namespace
|
||||||
|
- name: SEAWEEDFS_FULLNAME
|
||||||
|
value: "{{ template "seaweedfs.name" . }}"
|
||||||
|
command:
|
||||||
|
- "/bin/sh"
|
||||||
|
- "-ec"
|
||||||
|
{{- range $.Values.filer.s3.createBuckets }}
|
||||||
|
- |
|
||||||
|
exec /bin/echo \
|
||||||
|
"s3.bucket.create --name {{ . }}" |\
|
||||||
|
/usr/bin/weed shell
|
||||||
|
{{- end }}
|
||||||
|
ports:
|
||||||
|
- containerPort: {{ .Values.master.port }}
|
||||||
|
name: swfs-master
|
||||||
|
{{- if and .Values.global.monitoring.enabled .Values.master.metricsPort }}
|
||||||
|
- containerPort: {{ .Values.master.metricsPort }}
|
||||||
|
name: metrics
|
||||||
|
{{- end }}
|
||||||
|
- containerPort: {{ .Values.master.grpcPort }}
|
||||||
|
#name: swfs-master-grpc
|
||||||
|
{{- if .Values.master.readinessProbe.enabled }}
|
||||||
|
{{- $hostpath_exists := include "master.hostpath_exists" . -}}
|
||||||
|
{{- $existing_claims := include "master.existing_claims" . -}}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
|
@ -576,6 +576,16 @@ filer:
|
||||||
# should have a secret key called seaweedfs_s3_config with an inline json configure
|
# should have a secret key called seaweedfs_s3_config with an inline json configure
|
||||||
existingConfigSecret: ""
|
existingConfigSecret: ""
|
||||||
auditLogConfig: {}
|
auditLogConfig: {}
|
||||||
|
# You may specify buckets and users to be created during the install process
|
||||||
|
# createBuckets:
|
||||||
|
# - bucketA
|
||||||
|
# - bucketB
|
||||||
|
# createUsers:
|
||||||
|
# - name: friend
|
||||||
|
# actions: "read,write,list"
|
||||||
|
# buckets: "bucketA"
|
||||||
|
# secretName: friend-s3-creds
|
||||||
|
|
||||||
|
|
||||||
s3:
|
s3:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
|
Loading…
Reference in a new issue