Browse Source

Merge pull request #1742 from LazyDBA247-Anyvision/master

K8S Chart
pull/1743/head
Chris Lu 4 years ago
committed by GitHub
parent
commit
9e41941ba8
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      k8s/seaweedfs/Chart.yaml
  2. 12
      k8s/seaweedfs/templates/_helpers.tpl
  3. 1
      k8s/seaweedfs/templates/cronjob.yaml
  4. 31
      k8s/seaweedfs/templates/filer-service-client.yaml
  5. 9
      k8s/seaweedfs/templates/filer-service.yaml
  6. 12
      k8s/seaweedfs/templates/filer-statefulset.yaml
  7. 1
      k8s/seaweedfs/templates/master-service.yaml
  8. 10
      k8s/seaweedfs/templates/master-statefulset.yaml
  9. 27
      k8s/seaweedfs/templates/s3-deployment.yaml
  10. 13
      k8s/seaweedfs/templates/volume-statefulset.yaml
  11. 15
      k8s/seaweedfs/values.yaml

3
k8s/seaweedfs/Chart.yaml

@ -1,4 +1,5 @@
apiVersion: v1 apiVersion: v1
description: SeaweedFS description: SeaweedFS
name: seaweedfs name: seaweedfs
version: 2.14
appVersion: "2.20"
version: 2.20

12
k8s/seaweedfs/templates/_helpers.tpl

@ -52,12 +52,12 @@ Inject extra environment vars in the format key:value, if populated
{{- $registryName := default .Values.image.registry .Values.global.localRegistry | toString -}} {{- $registryName := default .Values.image.registry .Values.global.localRegistry | toString -}}
{{- $repositoryName := .Values.image.repository | toString -}} {{- $repositoryName := .Values.image.repository | toString -}}
{{- $name := .Values.global.imageName | toString -}} {{- $name := .Values.global.imageName | toString -}}
{{- $tag := .Values.global.imageTag | toString -}}
{{- $tag := .Chart.AppVersion | toString -}}
{{- printf "%s%s%s:%s" $registryName $repositoryName $name $tag -}} {{- printf "%s%s%s:%s" $registryName $repositoryName $name $tag -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{/* Return the proper postgresqlSchema image */}}
{{/* Return the proper dbSchema image */}}
{{- define "filer.dbSchema.image" -}} {{- define "filer.dbSchema.image" -}}
{{- if .Values.filer.dbSchema.imageOverride -}} {{- if .Values.filer.dbSchema.imageOverride -}}
{{- $imageOverride := .Values.filer.dbSchema.imageOverride -}} {{- $imageOverride := .Values.filer.dbSchema.imageOverride -}}
@ -80,7 +80,7 @@ Inject extra environment vars in the format key:value, if populated
{{- $registryName := default .Values.image.registry .Values.global.localRegistry | toString -}} {{- $registryName := default .Values.image.registry .Values.global.localRegistry | toString -}}
{{- $repositoryName := .Values.image.repository | toString -}} {{- $repositoryName := .Values.image.repository | toString -}}
{{- $name := .Values.global.imageName | toString -}} {{- $name := .Values.global.imageName | toString -}}
{{- $tag := .Values.global.imageTag | toString -}}
{{- $tag := .Chart.AppVersion | toString -}}
{{- printf "%s%s%s:%s" $registryName $repositoryName $name $tag -}} {{- printf "%s%s%s:%s" $registryName $repositoryName $name $tag -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
@ -94,7 +94,7 @@ Inject extra environment vars in the format key:value, if populated
{{- $registryName := default .Values.image.registry .Values.global.localRegistry | toString -}} {{- $registryName := default .Values.image.registry .Values.global.localRegistry | toString -}}
{{- $repositoryName := .Values.image.repository | toString -}} {{- $repositoryName := .Values.image.repository | toString -}}
{{- $name := .Values.global.imageName | toString -}} {{- $name := .Values.global.imageName | toString -}}
{{- $tag := .Values.global.imageTag | toString -}}
{{- $tag := .Chart.AppVersion | toString -}}
{{- printf "%s%s%s:%s" $registryName $repositoryName $name $tag -}} {{- printf "%s%s%s:%s" $registryName $repositoryName $name $tag -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
@ -108,7 +108,7 @@ Inject extra environment vars in the format key:value, if populated
{{- $registryName := default .Values.image.registry .Values.global.localRegistry | toString -}} {{- $registryName := default .Values.image.registry .Values.global.localRegistry | toString -}}
{{- $repositoryName := .Values.image.repository | toString -}} {{- $repositoryName := .Values.image.repository | toString -}}
{{- $name := .Values.global.imageName | toString -}} {{- $name := .Values.global.imageName | toString -}}
{{- $tag := .Values.global.imageTag | toString -}}
{{- $tag := .Chart.AppVersion | toString -}}
{{- printf "%s%s%s:%s" $registryName $repositoryName $name $tag -}} {{- printf "%s%s%s:%s" $registryName $repositoryName $name $tag -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
@ -122,7 +122,7 @@ Inject extra environment vars in the format key:value, if populated
{{- $registryName := default .Values.image.registry .Values.global.localRegistry | toString -}} {{- $registryName := default .Values.image.registry .Values.global.localRegistry | toString -}}
{{- $repositoryName := .Values.image.repository | toString -}} {{- $repositoryName := .Values.image.repository | toString -}}
{{- $name := .Values.global.imageName | toString -}} {{- $name := .Values.global.imageName | toString -}}
{{- $tag := .Values.global.imageTag | toString -}}
{{- $tag := .Chart.AppVersion | toString -}}
{{- printf "%s%s%s:%s" $registryName $repositoryName $name $tag -}} {{- printf "%s%s%s:%s" $registryName $repositoryName $name $tag -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}

1
k8s/seaweedfs/templates/cronjob.yaml

@ -6,6 +6,7 @@ metadata:
name: {{ include "seaweedfs.fullname" . }}-cronjob name: {{ include "seaweedfs.fullname" . }}-cronjob
spec: spec:
schedule: "{{ .Values.cronjob.schedule }}" schedule: "{{ .Values.cronjob.schedule }}"
startingDeadlineSeconds: 200
concurrencyPolicy: Forbid concurrencyPolicy: Forbid
failedJobsHistoryLimit: 2 failedJobsHistoryLimit: 2
successfulJobsHistoryLimit: 2 successfulJobsHistoryLimit: 2

31
k8s/seaweedfs/templates/filer-service-client.yaml

@ -0,0 +1,31 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "seaweedfs.name" . }}-filer-client
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "seaweedfs.name" . }}
component: filer
{{- if .Values.filer.metricsPort }}
monitoring: "true"
{{- end }}
spec:
clusterIP: None
ports:
- name: "swfs-filer"
port: {{ .Values.filer.port }}
targetPort: {{ .Values.filer.port }}
protocol: TCP
- name: "swfs-filer-grpc"
port: {{ .Values.filer.grpcPort }}
targetPort: {{ .Values.filer.grpcPort }}
protocol: TCP
{{- if .Values.filer.metricsPort }}
- name: "metrics"
port: {{ .Values.filer.metricsPort }}
targetPort: {{ .Values.filer.metricsPort }}
protocol: TCP
{{- end }}
selector:
app: {{ template "seaweedfs.name" . }}
component: filer

9
k8s/seaweedfs/templates/filer-service.yaml

@ -1,6 +1,8 @@
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
annotations:
service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
name: {{ template "seaweedfs.name" . }}-filer name: {{ template "seaweedfs.name" . }}-filer
namespace: {{ .Release.Namespace }} namespace: {{ .Release.Namespace }}
labels: labels:
@ -8,6 +10,7 @@ metadata:
component: filer component: filer
spec: spec:
clusterIP: None clusterIP: None
publishNotReadyAddresses: true
ports: ports:
- name: "swfs-filer" - name: "swfs-filer"
port: {{ .Values.filer.port }} port: {{ .Values.filer.port }}
@ -17,12 +20,6 @@ spec:
port: {{ .Values.filer.grpcPort }} port: {{ .Values.filer.grpcPort }}
targetPort: {{ .Values.filer.grpcPort }} targetPort: {{ .Values.filer.grpcPort }}
protocol: TCP protocol: TCP
{{- if .Values.filer.metricsPort }}
- name: "swfs-filer-metrics"
port: {{ .Values.filer.metricsPort }}
targetPort: {{ .Values.filer.metricsPort }}
protocol: TCP
{{- end }}
selector: selector:
app: {{ template "seaweedfs.name" . }} app: {{ template "seaweedfs.name" . }}
component: filer component: filer

12
k8s/seaweedfs/templates/filer-statefulset.yaml

@ -87,6 +87,12 @@ spec:
value: {{ $value | quote }} value: {{ $value | quote }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if .Values.global.extraEnvironmentVars }}
{{- range $key, $value := .Values.global.extraEnvironmentVars }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }}
{{- end }}
command: command:
- "/bin/sh" - "/bin/sh"
- "-ec" - "-ec"
@ -128,7 +134,7 @@ spec:
{{- end }} {{- end }}
-ip=${POD_IP} \ -ip=${POD_IP} \
{{- if gt (.Values.filer.replicas | int) 1 }} {{- if gt (.Values.filer.replicas | int) 1 }}
-peers={{ range $index := until (.Values.filer.replicas | int) }}${SEAWEEDFS_FULLNAME}-filer-{{ $index }}.${SEAWEEDFS_FULLNAME}-filer:{{ $.Values.filer.port }}{{ if lt $index (sub ($.Values.filer.replicas | int) 1) }},{{ end }}{{ end }}
-peers=$(echo -n "{{ range $index := until (.Values.filer.replicas | int) }}${SEAWEEDFS_FULLNAME}-filer-{{ $index }}.${SEAWEEDFS_FULLNAME}-filer:{{ $.Values.filer.port }}{{ if lt $index (sub ($.Values.filer.replicas | int) 1) }},{{ end }}{{ end }}" | sed "s/$HOSTNAME.${SEAWEEDFS_FULLNAME}-filer:{{ $.Values.filer.port }}//" | sed 's/,$//; 's/^,//'; s/,,/,/;' ) \
{{- end }} {{- end }}
-master={{ range $index := until (.Values.master.replicas | int) }}${SEAWEEDFS_FULLNAME}-master-{{ $index }}.${SEAWEEDFS_FULLNAME}-master:{{ $.Values.master.port }}{{ if lt $index (sub ($.Values.master.replicas | int) 1) }},{{ end }}{{ end }} -master={{ range $index := until (.Values.master.replicas | int) }}${SEAWEEDFS_FULLNAME}-master-{{ $index }}.${SEAWEEDFS_FULLNAME}-master:{{ $.Values.master.port }}{{ if lt $index (sub ($.Values.master.replicas | int) 1) }},{{ end }}{{ end }}
{{- if or (.Values.global.enableSecurity) (.Values.filer.extraVolumeMounts) }} {{- if or (.Values.global.enableSecurity) (.Values.filer.extraVolumeMounts) }}
@ -172,7 +178,7 @@ spec:
periodSeconds: 15 periodSeconds: 15
successThreshold: 1 successThreshold: 1
failureThreshold: 100 failureThreshold: 100
timeoutSeconds: 3
timeoutSeconds: 10
livenessProbe: livenessProbe:
httpGet: httpGet:
path: / path: /
@ -182,7 +188,7 @@ spec:
periodSeconds: 30 periodSeconds: 30
successThreshold: 1 successThreshold: 1
failureThreshold: 5 failureThreshold: 5
timeoutSeconds: 3
timeoutSeconds: 10
{{- if .Values.filer.resources }} {{- if .Values.filer.resources }}
resources: resources:
{{ tpl .Values.filer.resources . | nindent 12 | trim }} {{ tpl .Values.filer.resources . | nindent 12 | trim }}

1
k8s/seaweedfs/templates/master-service.yaml

@ -10,6 +10,7 @@ metadata:
service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
spec: spec:
clusterIP: None clusterIP: None
publishNotReadyAddresses: true
ports: ports:
- name: "swfs-master" - name: "swfs-master"
port: {{ .Values.master.port }} port: {{ .Values.master.port }}

10
k8s/seaweedfs/templates/master-statefulset.yaml

@ -76,6 +76,12 @@ spec:
value: {{ $value | quote }} value: {{ $value | quote }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if .Values.global.extraEnvironmentVars }}
{{- range $key, $value := .Values.global.extraEnvironmentVars }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }}
{{- end }}
command: command:
- "/bin/sh" - "/bin/sh"
- "-ec" - "-ec"
@ -157,7 +163,7 @@ spec:
periodSeconds: 45 periodSeconds: 45
successThreshold: 2 successThreshold: 2
failureThreshold: 100 failureThreshold: 100
timeoutSeconds: 5
timeoutSeconds: 10
livenessProbe: livenessProbe:
httpGet: httpGet:
path: /cluster/status path: /cluster/status
@ -167,7 +173,7 @@ spec:
periodSeconds: 30 periodSeconds: 30
successThreshold: 1 successThreshold: 1
failureThreshold: 4 failureThreshold: 4
timeoutSeconds: 5
timeoutSeconds: 10
{{- if .Values.master.resources }} {{- if .Values.master.resources }}
resources: resources:
{{ tpl .Values.master.resources . | nindent 12 | trim }} {{ tpl .Values.master.resources . | nindent 12 | trim }}

27
k8s/seaweedfs/templates/s3-deployment.yaml

@ -59,11 +59,17 @@ spec:
fieldPath: metadata.namespace fieldPath: metadata.namespace
- name: SEAWEEDFS_FULLNAME - name: SEAWEEDFS_FULLNAME
value: "{{ template "seaweedfs.name" . }}" value: "{{ template "seaweedfs.name" . }}"
{{- if .Values.global.extraEnvironmentVars }}
{{- range $key, $value := .Values.global.extraEnvironmentVars }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }}
{{- end }}
command: command:
- "/bin/sh" - "/bin/sh"
- "-ec" - "-ec"
- | - |
exec /usr/bin/weed \
exec /usr/bin/weed -logdir=/logs \
{{- if .Values.s3.loggingOverrideLevel }} {{- if .Values.s3.loggingOverrideLevel }}
-v={{ .Values.s3.loggingOverrideLevel }} \ -v={{ .Values.s3.loggingOverrideLevel }} \
{{- else }} {{- else }}
@ -81,9 +87,13 @@ spec:
{{- if .Values.s3.domainName }} {{- if .Values.s3.domainName }}
-domainName={{ .Values.s3.domainName }} \ -domainName={{ .Values.s3.domainName }} \
{{- end }} {{- end }}
-filer={{ template "seaweedfs.name" . }}-filer:{{ .Values.filer.port }}
{{- if or (.Values.global.enableSecurity) (.Values.s3.extraVolumeMounts) }}
{{- if .Values.s3.allowEmptyFolder }}
-allowEmptyFolder={{ .Values.s3.allowEmptyFolder }} \
{{- end }}
-filer={{ template "seaweedfs.name" . }}-filer-client:{{ .Values.filer.port }}
volumeMounts: volumeMounts:
- name: logs
mountPath: "/logs/"
{{- if .Values.global.enableSecurity }} {{- if .Values.global.enableSecurity }}
- name: security-config - name: security-config
readOnly: true readOnly: true
@ -106,7 +116,6 @@ spec:
mountPath: /usr/local/share/ca-certificates/client/ mountPath: /usr/local/share/ca-certificates/client/
{{- end }} {{- end }}
{{ tpl .Values.s3.extraVolumeMounts . | nindent 12 | trim }} {{ tpl .Values.s3.extraVolumeMounts . | nindent 12 | trim }}
{{- end }}
ports: ports:
- containerPort: {{ .Values.s3.port }} - containerPort: {{ .Values.s3.port }}
name: swfs-s3 name: swfs-s3
@ -119,7 +128,7 @@ spec:
periodSeconds: 15 periodSeconds: 15
successThreshold: 1 successThreshold: 1
failureThreshold: 100 failureThreshold: 100
timeoutSeconds: 3
timeoutSeconds: 10
livenessProbe: livenessProbe:
httpGet: httpGet:
path: / path: /
@ -129,12 +138,18 @@ spec:
periodSeconds: 60 periodSeconds: 60
successThreshold: 1 successThreshold: 1
failureThreshold: 20 failureThreshold: 20
timeoutSeconds: 3
timeoutSeconds: 10
{{- if .Values.s3.resources }} {{- if .Values.s3.resources }}
resources: resources:
{{ tpl .Values.s3.resources . | nindent 12 | trim }} {{ tpl .Values.s3.resources . | nindent 12 | trim }}
{{- end }} {{- end }}
volumes: volumes:
{{- if eq .Values.s3.logs.type "hostPath" }}
- name: logs
hostPath:
path: /storage/logs/seaweedfs/s3
type: DirectoryOrCreate
{{- end }}
{{- if .Values.global.enableSecurity }} {{- if .Values.global.enableSecurity }}
- name: security-config - name: security-config
configMap: configMap:

13
k8s/seaweedfs/templates/volume-statefulset.yaml

@ -64,6 +64,12 @@ spec:
fieldPath: status.hostIP fieldPath: status.hostIP
- name: SEAWEEDFS_FULLNAME - name: SEAWEEDFS_FULLNAME
value: "{{ template "seaweedfs.name" . }}" value: "{{ template "seaweedfs.name" . }}"
{{- if .Values.global.extraEnvironmentVars }}
{{- range $key, $value := .Values.global.extraEnvironmentVars }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }}
{{- end }}
command: command:
- "/bin/sh" - "/bin/sh"
- "-ec" - "-ec"
@ -80,6 +86,9 @@ spec:
-metricsPort {{ .Values.volume.metricsPort }} \ -metricsPort {{ .Values.volume.metricsPort }} \
{{- end }} {{- end }}
-dir={{ .Values.volume.dir }} \ -dir={{ .Values.volume.dir }} \
{{- if .Values.volume.dir_idx }}
-dir.idx={{ .Values.volume.dir_idx }} \
{{- end }}
-max={{ .Values.volume.maxVolumes }} \ -max={{ .Values.volume.maxVolumes }} \
{{- if .Values.volume.rack }} {{- if .Values.volume.rack }}
-rack={{ .Values.volume.rack }} \ -rack={{ .Values.volume.rack }} \
@ -149,7 +158,7 @@ spec:
periodSeconds: 90 periodSeconds: 90
successThreshold: 1 successThreshold: 1
failureThreshold: 100 failureThreshold: 100
timeoutSeconds: 5
timeoutSeconds: 30
livenessProbe: livenessProbe:
httpGet: httpGet:
path: /status path: /status
@ -159,7 +168,7 @@ spec:
periodSeconds: 90 periodSeconds: 90
successThreshold: 1 successThreshold: 1
failureThreshold: 4 failureThreshold: 4
timeoutSeconds: 5
timeoutSeconds: 30
{{- if .Values.volume.resources }} {{- if .Values.volume.resources }}
resources: resources:
{{ tpl .Values.volume.resources . | nindent 12 | trim }} {{ tpl .Values.volume.resources . | nindent 12 | trim }}

15
k8s/seaweedfs/values.yaml

@ -4,7 +4,7 @@ global:
registry: "" registry: ""
repository: "" repository: ""
imageName: chrislusf/seaweedfs imageName: chrislusf/seaweedfs
imageTag: "2.20"
# imageTag: "2.20" - started using {.Chart.appVersion}
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
imagePullSecrets: imagepullsecret imagePullSecrets: imagepullsecret
restartPolicy: Always restartPolicy: Always
@ -21,6 +21,10 @@ global:
# Y number of replica in other racks in the same data center # Y number of replica in other racks in the same data center
# Z number of replica in other servers in the same rack # Z number of replica in other servers in the same rack
replicationPlacment: "001" replicationPlacment: "001"
extraEnvironmentVars:
WEED_CLUSTER_DEFAULT: "sw"
WEED_CLUSTER_SW_MASTER: "seaweedfs-master:9333"
WEED_CLUSTER_SW_FILER: "seaweedfs-filer-client:8888"
image: image:
registry: "" registry: ""
@ -140,6 +144,8 @@ volume:
# Directories to store data files. dir[,dir]... (default "/tmp") # Directories to store data files. dir[,dir]... (default "/tmp")
dir: "/data" dir: "/data"
# Directories to store index files. dir[,dir]... (default "/tmp")
dir_idx: null
# Maximum numbers of volumes, count[,count]... # Maximum numbers of volumes, count[,count]...
# If set to zero on non-windows OS, the limit will be auto configured. (default "7") # If set to zero on non-windows OS, the limit will be auto configured. (default "7")
@ -313,6 +319,8 @@ s3:
port: 8333 port: 8333
metricsPort: 9327 metricsPort: 9327
loggingOverrideLevel: null loggingOverrideLevel: null
#allow empty folders
allowEmptyFolder: true
# Suffix of the host name, {bucket}.{domainName} # Suffix of the host name, {bucket}.{domainName}
domainName: "" domainName: ""
@ -343,6 +351,11 @@ s3:
# ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/ # ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/
priorityClassName: "" priorityClassName: ""
logs:
type: "hostPath"
size: ""
storageClass: ""
cronjob: cronjob:
enabled: false enabled: false
schedule: "*/7 * * * *" schedule: "*/7 * * * *"

Loading…
Cancel
Save