swarm
This commit is contained in:
16
helm/fastdfs-nginx/templates/NOTES.txt
Normal file
16
helm/fastdfs-nginx/templates/NOTES.txt
Normal file
@ -0,0 +1,16 @@
|
||||
Thank you for installing {{ .Chart.Name }}.
|
||||
|
||||
Your release is named {{ .Release.Name }}.
|
||||
|
||||
Your can use tracker should look like:
|
||||
{{ template "fastdfs-nginx.fullname" . }}-tracker-0.{{ template "fastdfs-nginx.fullname" . }}-tracker-headless:{{ .Values.trackerPorts.tracker.containerPort }}
|
||||
{{ template "fastdfs-nginx.fullname" . }}-tracker-1.{{ template "fastdfs-nginx.fullname" . }}-tracker-headless:{{ .Values.trackerPorts.tracker.containerPort }}
|
||||
|
||||
You can also use the service {{ template "fastdfs-nginx.fullname" . }}-tracker-headless:{{ .Values.trackerPorts.tracker.containerPort }} to connect to an available tracker server.
|
||||
|
||||
Your can access tracker nginx should look like:
|
||||
{{ template "fastdfs-nginx.fullname" . }}-tracker-0.{{ template "fastdfs-nginx.fullname" . }}-tracker-headless:{{ .Values.trackerPorts.trackernginx.containerPort }}
|
||||
{{ template "fastdfs-nginx.fullname" . }}-tracker-1.{{ template "fastdfs-nginx.fullname" . }}-tracker-headless:{{ .Values.trackerPorts.trackernginx.containerPort }}
|
||||
|
||||
You can also use the service {{ template "fastdfs-nginx.fullname" . }}-tracker-headless:{{ .Values.trackerPorts.trackernginx.containerPort }} to connect to an available tracker nginx server.
|
||||
|
113
helm/fastdfs-nginx/templates/_helpers.tpl
Normal file
113
helm/fastdfs-nginx/templates/_helpers.tpl
Normal file
@ -0,0 +1,113 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "fastdfs-nginx.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 "fastdfs-nginx.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 "fastdfs-nginx.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper image name
|
||||
*/}}
|
||||
{{- define "fastdfs-nginx.image" -}}
|
||||
{{- $registryName := .Values.image.registry -}}
|
||||
{{- $repositoryName := .Values.image.repository -}}
|
||||
{{- $tag := .Values.image.tag | toString -}}
|
||||
{{/*
|
||||
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
|
||||
but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
|
||||
Also, we can't use a single if because lazy evaluation is not an option
|
||||
*/}}
|
||||
{{- if .Values.global }}
|
||||
{{- if .Values.global.imageRegistry }}
|
||||
{{- printf "%s/%s:%s" .Values.global.imageRegistry $repositoryName $tag -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper image name (for the metrics image)
|
||||
*/}}
|
||||
{{- define "fastdfs-nginx.metrics.image" -}}
|
||||
{{- $registryName := .Values.metrics.image.registry -}}
|
||||
{{- $repositoryName := .Values.metrics.image.repository -}}
|
||||
{{- $tag := .Values.metrics.image.tag | toString -}}
|
||||
{{/*
|
||||
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
|
||||
but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
|
||||
Also, we can't use a single if because lazy evaluation is not an option
|
||||
*/}}
|
||||
{{- if .Values.global }}
|
||||
{{- if .Values.global.imageRegistry }}
|
||||
{{- printf "%s/%s:%s" .Values.global.imageRegistry $repositoryName $tag -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper Docker Image Registry Secret Names
|
||||
*/}}
|
||||
{{- define "fastdfs-nginx.imagePullSecrets" -}}
|
||||
{{/*
|
||||
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
|
||||
but Helm 2.9 and 2.10 does not support it, so we need to implement this if-else logic.
|
||||
Also, we can not use a single if because lazy evaluation is not an option
|
||||
*/}}
|
||||
{{- if .Values.global }}
|
||||
{{- if .Values.global.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- range .Values.global.imagePullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- else if or .Values.image.pullSecrets .Values.metrics.image.pullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- range .Values.image.pullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- range .Values.metrics.image.pullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{- else if or .Values.image.pullSecrets .Values.metrics.image.pullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- range .Values.image.pullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- range .Values.metrics.image.pullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
48
helm/fastdfs-nginx/templates/configmap.yaml
Normal file
48
helm/fastdfs-nginx/templates/configmap.yaml
Normal file
@ -0,0 +1,48 @@
|
||||
{{- $root := . -}}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ template "fastdfs-nginx.fullname" $root }}
|
||||
labels:
|
||||
app: {{ template "fastdfs-nginx.fullname" $root }}
|
||||
chart: {{ template "fastdfs-nginx.chart" $root }}
|
||||
release: "{{ $.Release.Name }}"
|
||||
heritage: "{{ $.Release.Service }}"
|
||||
data:
|
||||
tracker.conf: |
|
||||
#tracker.conf
|
||||
{{- range $skey, $svalue := $.Values.fastdfs.storage }}
|
||||
upstream fdfs_{{ $svalue.name }} {
|
||||
dynamic_resolve fallback=stale fail_timeout=30s;
|
||||
{{- range $i, $e := until (int $svalue.replica) }}
|
||||
{{- $storageNginxPort := $.Values.storagePorts.storagenginx.containerPort }}
|
||||
{{- $storagePodName := (printf "%s-storage-%s-%d" (include "fastdfs-nginx.fullname" $root) $svalue.name $i) }}
|
||||
{{- $storageServiceName := (printf "%s-storage-%s-headless" (include "fastdfs-nginx.fullname" $root) $svalue.name) }}
|
||||
server {{ $storagePodName }}.{{ $storageServiceName }}:{{ $storageNginxPort }};
|
||||
{{- end }}
|
||||
check interval=3000 rise=2 fall=5 timeout=1000 type=http;
|
||||
}
|
||||
{{- end }}
|
||||
server {
|
||||
listen 80 ;
|
||||
# server_name _ ;
|
||||
|
||||
location / {
|
||||
root html;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /status {
|
||||
check_status;
|
||||
access_log off;
|
||||
allow 127.0.0.1;
|
||||
deny all;
|
||||
}
|
||||
{{- range $skey, $svalue := $.Values.fastdfs.storage }}
|
||||
location ~/{{ $svalue.name }}/ {
|
||||
proxy_pass http://fdfs_{{ $svalue.name }};
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
{{- end }}
|
||||
}
|
43
helm/fastdfs-nginx/templates/ingress.yaml
Normal file
43
helm/fastdfs-nginx/templates/ingress.yaml
Normal file
@ -0,0 +1,43 @@
|
||||
{{- if .Values.ingress.enabled -}}
|
||||
{{- $fullName := include "fastdfs-nginx.fullname" . -}}
|
||||
{{- $ingressPath := .Values.ingress.path -}}
|
||||
{{- $http := .Values.trackerPorts.trackernginx.containerPort -}}
|
||||
apiVersion: {{ include "common.capabilities.ingress.apiVersion" . }}
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ $fullName }}
|
||||
labels:
|
||||
app: {{ template "fastdfs-nginx.name" . }}
|
||||
chart: {{ template "fastdfs-nginx.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
{{- with .Values.ingress.annotations }}
|
||||
annotations:
|
||||
{{ toYaml . | indent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if and .Values.ingress.ingressClassName (eq "true" (include "common.ingress.supportsIngressClassname" .)) }}
|
||||
ingressClassName: {{ .Values.ingress.ingressClassName | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.ingress.tls }}
|
||||
tls:
|
||||
{{- range .Values.ingress.tls }}
|
||||
- hosts:
|
||||
{{- range .hosts }}
|
||||
- {{ . }}
|
||||
{{- end }}
|
||||
secretName: {{ .secretName }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- range .Values.ingress.hosts }}
|
||||
- host: {{ . }}
|
||||
http:
|
||||
paths:
|
||||
- path: {{ $ingressPath }}
|
||||
{{- if eq "true" (include "common.ingress.supportsPathType" $) }}
|
||||
pathType: {{ $.Values.ingress.pathType }}
|
||||
{{- end }}
|
||||
backend: {{- include "common.ingress.backend" (dict "serviceName" (printf "%s-%s" (include "common.names.fullname" $) "tracker") "servicePort" $http "context" $) | nindent 14 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
30
helm/fastdfs-nginx/templates/storage-service-headless.yaml
Normal file
30
helm/fastdfs-nginx/templates/storage-service-headless.yaml
Normal file
@ -0,0 +1,30 @@
|
||||
{{ $root := . }}
|
||||
{{- range $skey, $svalue := $.Values.fastdfs.storage }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ template "fastdfs-nginx.fullname" $root }}-storage-{{ $svalue.name }}-headless
|
||||
labels:
|
||||
app: {{ template "fastdfs-nginx.name" $root }}
|
||||
chart: {{ template "fastdfs-nginx.chart" $root }}
|
||||
release: {{ $.Release.Name }}
|
||||
heritage: {{ $.Release.Service }}
|
||||
{{- if $.Values.headless.annotations }}
|
||||
annotations:
|
||||
{{ $.Values.headless.annotations | toYaml | trimSuffix "\n" | indent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
clusterIP: None
|
||||
publishNotReadyAddresses: true
|
||||
ports:
|
||||
{{- range $key, $port := $.Values.storagePorts }}
|
||||
- name: {{ $key }}
|
||||
port: {{ $port.containerPort }}
|
||||
targetPort: {{ $port.name }}
|
||||
protocol: {{ $port.protocol }}
|
||||
{{- end }}
|
||||
selector:
|
||||
app: {{ template "fastdfs-nginx.name" $root }}-storage-{{ $svalue.name }}
|
||||
release: {{ $.Release.Name }}
|
||||
---
|
||||
{{- end }}
|
24
helm/fastdfs-nginx/templates/storage-service.yaml
Normal file
24
helm/fastdfs-nginx/templates/storage-service.yaml
Normal file
@ -0,0 +1,24 @@
|
||||
{{ $root := . }}
|
||||
{{- range $skey, $svalue := $.Values.fastdfs.storage }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ template "fastdfs-nginx.fullname" $root }}-storage-{{ $svalue.name }}
|
||||
labels:
|
||||
app: {{ template "fastdfs-nginx.name" $root }}
|
||||
chart: {{ template "fastdfs-nginx.chart" $root }}
|
||||
release: {{ $.Release.Name }}
|
||||
heritage: {{ $.Release.Service }}
|
||||
spec:
|
||||
ports:
|
||||
{{- range $key, $port := $.Values.storagePorts }}
|
||||
- name: {{ $key }}
|
||||
port: {{ $port.containerPort }}
|
||||
targetPort: {{ $port.name }}
|
||||
protocol: {{ $port.protocol }}
|
||||
{{- end }}
|
||||
selector:
|
||||
app: {{ template "fastdfs-nginx.name" $root }}-storage-{{ $svalue.name }}
|
||||
release: {{ $.Release.Name }}
|
||||
---
|
||||
{{- end }}
|
118
helm/fastdfs-nginx/templates/storage-statefulset.yaml
Normal file
118
helm/fastdfs-nginx/templates/storage-statefulset.yaml
Normal file
@ -0,0 +1,118 @@
|
||||
{{- $root := . -}}
|
||||
{{- range $skey, $svalue := .Values.fastdfs.storage }}
|
||||
apiVersion: "{{ include "common.capabilities.statefulset.apiVersion" $root }}"
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ template "fastdfs-nginx.name" $root }}
|
||||
chart: {{ template "fastdfs-nginx.chart" $root }}
|
||||
heritage: {{ $.Release.Service }}
|
||||
release: {{ $.Release.Name }}
|
||||
name: {{ template "fastdfs-nginx.fullname" $root }}-storage-{{ $svalue.name }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{ template "fastdfs-nginx.name" $root }}-storage-{{ $svalue.name }}
|
||||
release: {{ $.Release.Name }}
|
||||
serviceName: {{ template "fastdfs-nginx.fullname" $root }}-storage-{{ $svalue.name }}-headless
|
||||
replicas: {{ $svalue.replica }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ template "fastdfs-nginx.name" $root }}-storage-{{ $svalue.name }}
|
||||
release: {{ $.Release.Name }}
|
||||
annotations:
|
||||
{{- if $.Values.podAnnotations }}
|
||||
{{ toYaml $.Values.podAnnotations | indent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
containers:
|
||||
- name: {{ template "fastdfs-nginx.name" $root }}
|
||||
image: "{{ $.Values.image.repository }}:{{ $.Values.image.tag }}"
|
||||
imagePullPolicy: "{{ $.Values.image.pullPolicy }}"
|
||||
args:
|
||||
- storage
|
||||
env:
|
||||
- name: GROUP_NAME
|
||||
value: {{ $svalue.name }}
|
||||
- name: TRACKER_SERVER
|
||||
value: {{ template "fastdfs-nginx.fullname" $root }}-tracker-headless:{{ $.Values.trackerPorts.tracker.containerPort }}
|
||||
ports:
|
||||
- name: storage
|
||||
containerPort: {{ $.Values.storagePorts.storage.containerPort }}
|
||||
- name: storage-nginx
|
||||
containerPort: {{ $.Values.storagePorts.storagenginx.containerPort }}
|
||||
resources:
|
||||
{{ toYaml $.Values.resources.storage | indent 12 }}
|
||||
volumeMounts:
|
||||
- name: data-storage
|
||||
mountPath: /var/fdfs
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- bash
|
||||
- "-c"
|
||||
- |
|
||||
set -x
|
||||
ps aux |grep 'fdfs_storaged /etc/fdfs/storage.conf start'|grep -v grep \
|
||||
&& curl --connect-timeout 1 -s 127.0.0.1:{{ $.Values.storagePorts.storagenginx.containerPort }}
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 20
|
||||
failureThreshold: 3
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- bash
|
||||
- "-c"
|
||||
- |
|
||||
set -x
|
||||
ps aux |grep 'fdfs_storaged /etc/fdfs/storage.conf start'|grep -v grep \
|
||||
&& curl --connect-timeout 1 -s 127.0.0.1:{{ $.Values.storagePorts.storagenginx.containerPort }}
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 20
|
||||
failureThreshold: 3
|
||||
volumes:
|
||||
{{- with $.Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{ toYaml $root | indent 8 }}
|
||||
{{- end }}
|
||||
{{- with $.Values.affinity }}
|
||||
affinity:
|
||||
{{ toYaml $root | indent 8 }}
|
||||
{{- end }}
|
||||
{{- with $.Values.tolerations }}
|
||||
tolerations:
|
||||
{{ toYaml $root | indent 8 }}
|
||||
{{- end }}
|
||||
{{- if $.Values.persistentVolume.enabled }}
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: data-storage
|
||||
labels:
|
||||
app: {{ template "fastdfs-nginx.name" $root }}
|
||||
chart: {{ template "fastdfs-nginx.chart" $root }}
|
||||
release: {{ $.Release.Name }}
|
||||
heritage: {{ $.Release.Service }}
|
||||
spec:
|
||||
accessModes:
|
||||
- {{ $.Values.persistentVolume.accessMode | quote }}
|
||||
annotations:
|
||||
{{- range $key, $value := $.Values.persistentVolume.annotations }}
|
||||
{{ $key }}: {{ $value }}
|
||||
{{- end }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ $svalue.size }}
|
||||
{{- if $.Values.persistentVolume.storageClass }}
|
||||
{{- if (eq "-" $.Values.persistentVolume.storageClass) }}
|
||||
storageClassName: ""
|
||||
{{- else }}
|
||||
storageClassName: "{{ $.Values.persistentVolume.storageClass }}"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
- name: data-storage
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
---
|
||||
{{- end }}
|
26
helm/fastdfs-nginx/templates/tracker-service-headless.yaml
Normal file
26
helm/fastdfs-nginx/templates/tracker-service-headless.yaml
Normal file
@ -0,0 +1,26 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ template "fastdfs-nginx.fullname" . }}-tracker-headless
|
||||
labels:
|
||||
app: {{ template "fastdfs-nginx.name" . }}
|
||||
chart: {{ template "fastdfs-nginx.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
{{- if .Values.headless.annotations }}
|
||||
annotations:
|
||||
{{ .Values.headless.annotations | toYaml | trimSuffix "\n" | indent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
clusterIP: None
|
||||
publishNotReadyAddresses: true
|
||||
ports:
|
||||
{{- range $key, $port := .Values.trackerPorts }}
|
||||
- name: {{ $key }}
|
||||
port: {{ $port.containerPort }}
|
||||
targetPort: {{ $port.name }}
|
||||
protocol: {{ $port.protocol }}
|
||||
{{- end }}
|
||||
selector:
|
||||
app: {{ template "fastdfs-nginx.name" . }}-tracker
|
||||
release: {{ .Release.Name }}
|
21
helm/fastdfs-nginx/templates/tracker-service.yaml
Normal file
21
helm/fastdfs-nginx/templates/tracker-service.yaml
Normal file
@ -0,0 +1,21 @@
|
||||
{{ $root := . }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ template "fastdfs-nginx.fullname" $root }}-tracker
|
||||
labels:
|
||||
app: {{ template "fastdfs-nginx.name" $root }}
|
||||
chart: {{ template "fastdfs-nginx.chart" $root }}
|
||||
release: {{ $.Release.Name }}
|
||||
heritage: {{ $.Release.Service }}
|
||||
spec:
|
||||
ports:
|
||||
{{- range $key, $port := $.Values.trackerPorts }}
|
||||
- name: {{ $key }}
|
||||
port: {{ $port.containerPort }}
|
||||
targetPort: {{ $port.name }}
|
||||
protocol: {{ $port.protocol }}
|
||||
{{- end }}
|
||||
selector:
|
||||
app: {{ template "fastdfs-nginx.name" $root }}-tracker
|
||||
release: {{ $.Release.Name }}
|
124
helm/fastdfs-nginx/templates/tracker-statefulset.yaml
Normal file
124
helm/fastdfs-nginx/templates/tracker-statefulset.yaml
Normal file
@ -0,0 +1,124 @@
|
||||
apiVersion: {{ include "common.capabilities.statefulset.apiVersion" . }}
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ template "fastdfs-nginx.name" . }}
|
||||
chart: {{ template "fastdfs-nginx.chart" . }}
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
name: {{ template "fastdfs-nginx.fullname" . }}-tracker
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{ template "fastdfs-nginx.name" . }}-tracker
|
||||
release: {{ .Release.Name }}
|
||||
serviceName: {{ template "fastdfs-nginx.fullname" . }}-tracker-headless
|
||||
replicas: {{ .Values.fastdfs.tracker.replica }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ template "fastdfs-nginx.name" . }}-tracker
|
||||
release: {{ .Release.Name }}
|
||||
annotations:
|
||||
{{- if .Values.podAnnotations }}
|
||||
{{ toYaml .Values.podAnnotations | indent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
containers:
|
||||
- name: {{ template "fastdfs-nginx.name" . }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
env:
|
||||
- name: TRACKER_SERVER
|
||||
value: {{ template "fastdfs-nginx.fullname" . }}-tracker-headless:{{ $.Values.trackerPorts.tracker.containerPort }}
|
||||
ports:
|
||||
- name: tracker
|
||||
containerPort: {{ .Values.trackerPorts.tracker.containerPort }}
|
||||
- name: tracker-nginx
|
||||
containerPort: {{ .Values.trackerPorts.trackernginx.containerPort }}
|
||||
resources:
|
||||
{{ toYaml .Values.resources.tracker | indent 12 }}
|
||||
volumeMounts:
|
||||
- name: data-tracker
|
||||
mountPath: /var/fdfs
|
||||
- name: config-map
|
||||
mountPath: /usr/local/nginx/conf/conf.d
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- bash
|
||||
- "-c"
|
||||
- |
|
||||
set -x
|
||||
curl --connect-timeout 1 -s 127.0.0.1:{{ $.Values.trackerPorts.trackernginx.containerPort }} \
|
||||
&& /usr/local/nginx/sbin/nginx -s reload || {
|
||||
{{- $root := . -}}
|
||||
{{- range $skey, $svalue := .Values.fastdfs.storage }}
|
||||
echo 127.0.0.1 {{ template "fastdfs-nginx.fullname" $root }}-storage-{{ $svalue.name }}-headless >> /etc/hosts
|
||||
{{- end }}
|
||||
/usr/local/nginx/sbin/nginx
|
||||
cat /etc/hosts > /tmp/hosts.tmp
|
||||
{{- $root := . -}}
|
||||
{{- range $skey, $svalue := .Values.fastdfs.storage }}
|
||||
sed -i "/{{ template "fastdfs-nginx.fullname" $root }}-storage-{{ $svalue.name }}-headless/d" /tmp/hosts.tmp
|
||||
{{- end }}
|
||||
cat /tmp/hosts.tmp > /etc/hosts
|
||||
}
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 60
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- bash
|
||||
- "-c"
|
||||
- |
|
||||
set -ex
|
||||
ps aux |grep 'fdfs_trackerd /etc/fdfs/tracker.conf start'|grep -v grep
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 20
|
||||
volumes:
|
||||
- name: config-map
|
||||
configMap:
|
||||
name: {{ template "fastdfs-nginx.fullname" . }}
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{ toYaml . | indent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{ toYaml . | indent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{ toYaml . | indent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.persistentVolume.enabled }}
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: data-tracker
|
||||
labels:
|
||||
app: {{ template "fastdfs-nginx.name" . }}
|
||||
chart: {{ template "fastdfs-nginx.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
spec:
|
||||
accessModes:
|
||||
- {{ .Values.persistentVolume.accessMode | quote }}
|
||||
annotations:
|
||||
{{- range $key, $value := .Values.persistentVolume.annotations }}
|
||||
{{ $key }}: {{ $value }}
|
||||
{{- end }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.fastdfs.tracker.size | quote }}
|
||||
{{- if .Values.persistentVolume.storageClass }}
|
||||
{{- if (eq "-" .Values.persistentVolume.storageClass) }}
|
||||
storageClassName: ""
|
||||
{{- else }}
|
||||
storageClassName: "{{ .Values.persistentVolume.storageClass }}"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
- name: data-tracker
|
||||
emptyDir: {}
|
||||
{{- end -}}
|
Reference in New Issue
Block a user