blob: 2042622fcf412229caa1d41deac0874dfb828a79 [file] [log] [blame]
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
{{- if .Values.components.tubemqManager }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ template "inlong.fullname" . }}-{{ .Values.tubemqManager.component }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "inlong.commonLabels" . | nindent 4 }}
component: {{ .Values.tubemqManager.component }}
spec:
serviceName: {{ template "inlong.fullname" . }}-{{ .Values.tubemqManager.component }}
replicas: {{ .Values.tubemqManager.replicas }}
selector:
matchLabels:
{{- include "inlong.matchLabels" . | nindent 6 }}
component: {{ .Values.tubemqManager.component }}
updateStrategy:
type: {{ .Values.tubemqManager.updateStrategy.type | quote }}
podManagementPolicy: {{ .Values.tubemqManager.podManagementPolicy | quote }}
template:
metadata:
labels:
{{- include "inlong.template.labels" . | nindent 8 }}
component: {{ .Values.tubemqManager.component }}
{{- if .Values.tubemqManager.annotations }}
annotations:
{{- toYaml .Values.tubemqManager.annotations | nindent 8 }}
{{- end }}
spec:
{{- if .Values.tubemqManager.tolerations }}
tolerations:
{{- toYaml .Values.tubemqManager.tolerations | nindent 8 }}
{{- end }}
{{- if .Values.tubemqManager.nodeSelector }}
nodeSelector:
{{- toYaml .Values.tubemqManager.nodeSelector | nindent 8 }}
{{- end }}
{{- if .Values.tubemqManager.affinity }}
affinity:
{{- toYaml .Values.tubemqManager.affinity | nindent 8 }}
{{- end }}
terminationGracePeriodSeconds: {{ .Values.tubemqManager.terminationGracePeriodSeconds }}
initContainers:
- name: wait-{{ .Values.mysql.component }}-ready
image: {{ .Values.images.initContainer.repository }}:{{ .Values.images.initContainer.tag }}
imagePullPolicy: {{ .Values.images.pullPolicy }}
command: [ "/bin/sh", "-c" ]
args:
- |
count={{ template "inlong.mysql.count" . }}
for i in $(seq 0 $(expr $count - 1))
do
{{- if .Values.external.mysql.enabled }}
host="{{ template "inlong.mysql.hostname" . }}"
{{- else }}
replica="{{ template "inlong.fullname" . }}-{{ .Values.mysql.component }}-$i"
host="$replica.{{ template "inlong.mysql.hostname" . }}"
{{- end }}
port={{ template "inlong.mysql.port" . }}
until nc -z $host $port 2>/dev/null
do
echo "waiting for host:$host port:$port to be ready"
sleep 3
done
done
- name: wait-{{ .Values.tubemqMaster.component }}-ready
image: {{ .Values.images.initContainer.repository }}:{{ .Values.images.initContainer.tag }}
imagePullPolicy: {{ .Values.images.pullPolicy }}
command: [ "/bin/sh", "-c" ]
args:
- |
count={{ .Values.tubemqMaster.replicas }}
for i in $(seq 0 $(expr $count - 1))
do
replica="{{ template "inlong.fullname" . }}-{{ .Values.tubemqMaster.component }}-$i"
host="$replica.{{ template "inlong.tubemqMaster.hostname" . }}"
port={{ .Values.tubemqMaster.ports.webPort }}
until nc -z $host $port 2>/dev/null
do
echo "waiting for $replica to be ready"
sleep 3
done
done
containers:
- name: {{ template "inlong.fullname" . }}-{{ .Values.tubemqManager.component }}
image: {{ .Values.images.tubemqManager.repository }}:{{ .Values.images.tubemqManager.tag }}
imagePullPolicy: {{ .Values.images.pullPolicy }}
{{- if .Values.tubemqManager.resources }}
resources:
{{- toYaml .Values.tubemqManager.resources | nindent 12 }}
{{- end }}
env:
- name: MYSQL_HOST
value: {{ include "inlong.mysql.hostname" . | quote }}
- name: MYSQL_USER
value: {{ include "inlong.mysql.username" . | quote }}
- name: MYSQL_PASSWD
valueFrom:
secretKeyRef:
name: {{ template "inlong.fullname" . }}-{{ .Values.mysql.component }}
key: mysql-password
- name: TUBE_MASTER_IP
value: "{{ template "inlong.tubemqMaster.hostname" . }}:{{ .Values.tubemqMaster.ports.rpcPort }}"
{{- range $key, $value := .Values.tubemqManager.env }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }}
- name: TZ
value: {{ .Values.timezone }}
ports:
- name: tubemq-mgr-port
containerPort: 8089
restartPolicy: Always
{{- end }}