rancher-partner-charts/charts/quobyte/quobyte-cluster/templates/dataservice-statefulset.yaml

162 lines
4.9 KiB
YAML

---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: quobyte-data
spec:
selector:
matchLabels:
app: quobyte-data # has to match .spec.template.metadata.labels
serviceName: "quobyte-data"
replicas: {{ .Values.quobyte.replicas }} # by default is 4
template:
metadata:
labels:
app: quobyte-data # has to match .spec.selector.matchLabels
annotations:
timestamp: "{{ now }}"
spec:
terminationGracePeriodSeconds: 10
hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet
initContainers:
- name: quobyte-data-pre
image: {{ .Values.quobyte.image }}
env:
- name: NODENAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: MY_POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: HOST_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: QUOBYTE_DATA_PORT
value: "7863"
- name: QUOBYTE_META_PORT
value: "7862"
- name: QUOBYTE_REG_PORT
value: "7861"
- name: QUOBYTE_API_PORT
value: "7860"
- name: QUOBYTE_S3_PORT
value: "8484"
- name: QUOBYTE_SERVICE
value: data
- name: CLOUD_INSTALL
value: "1"
- name: CLUSTER_NS
value: {{ .Release.Namespace }}
- name: LIMIT_OPEN_FILES
value: "{{ .Values.quobyte.maxopenfiles }}"
- name: LIMIT_MAX_PROCESSES
value: "{{ .Values.quobyte.maxprocs }}"
volumeMounts:
- name: config
mountPath: /etc/quobyte
{{- range .Values.quobyte.datadisks }}
- name: {{ .name }}
mountPath: {{ .mountpoint }}
{{- end }}
command:
- /bin/sh
- -xc
- |
touch /etc/quobyte/$QUOBYTE_SERVICE.cfg
echo test.device_dir=/var/lib/quobyte/devices >> /etc/quobyte/data.cfg
echo rpc.bind.address=${MY_POD_IP} >> /etc/quobyte/data.cfg
echo hostname=${HOSTNAME} >> /etc/quobyte/data.cfg
for j in $(ls -d /var/lib/quobyte/devices/data*)
do
i=$(basename $j)
if [ ! -e /var/lib/quobyte/devices/${i}/QUOBYTE_DEV_SETUP ];then
/usr/bin/qmkdev -d -t DATA /var/lib/quobyte/devices/${i}
fi
done
containers:
- name: quobyte-data
image: {{ .Values.quobyte.image }}
imagePullPolicy: Always
env:
- name: NODENAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: MY_POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: HOST_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: QUOBYTE_DATA_PORT
value: "7863"
- name: QUOBYTE_META_PORT
value: "7862"
- name: QUOBYTE_REG_PORT
value: "7861"
- name: QUOBYTE_API_PORT
value: "7860"
- name: QUOBYTE_S3_PORT
value: "8484"
- name: QUOBYTE_SERVICE
value: data
- name: CLOUD_INSTALL
value: "1"
- name: CLUSTER_NS
value: {{ .Release.Namespace }}
- name: QUOBYTE_REGISTRY
value: _quobyte._tcp.quobyte.{{ .Release.Namespace }}.svc.cluster.local
- name: LIMIT_OPEN_FILES
value: "{{ .Values.quobyte.maxopenfiles }}"
- name: LIMIT_MAX_PROCESSES
value: "{{ .Values.quobyte.maxprocs }}"
ports:
- containerPort: 7863
name: quobyte-data
volumeMounts:
- name: config
mountPath: /etc/quobyte
{{- range .Values.quobyte.datadisks }}
- name: {{ .name }}
mountPath: {{ .mountpoint }}
{{- end }}
{{- if .Values.nodepoolname }}
nodeSelector:
storage-node-pool: {{ .Values.nodepoolname }}
{{- end }}
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- quobyte
topologyKey: "kubernetes.io/hostname"
volumeClaimTemplates:
- metadata:
name: config
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 10Gi
{{- range .Values.quobyte.datadisks }}
- metadata:
name: {{ .name }}
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: "faster"
resources:
requests:
storage: {{ .size }}
{{- end }}