blob: 26b259c72935ebac678c3bbf0672163f50dd5698 [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.audit }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ template "inlong.fullname" . }}-{{ .Values.audit.component }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "inlong.commonLabels" . | nindent 4 }}
component: {{ .Values.audit.component }}
spec:
serviceName: {{ template "inlong.fullname" . }}-{{ .Values.audit.component }}
replicas: {{ .Values.audit.replicas }}
selector:
matchLabels:
{{- include "inlong.matchLabels" . | nindent 6 }}
component: {{ .Values.audit.component }}
updateStrategy:
type: {{ .Values.audit.updateStrategy.type | quote }}
podManagementPolicy: {{ .Values.audit.podManagementPolicy | quote }}
template:
metadata:
labels:
{{- include "inlong.template.labels" . | nindent 8 }}
component: {{ .Values.audit.component }}
{{- if .Values.audit.annotations }}
annotations:
{{- toYaml .Values.audit.annotations | nindent 8 }}
{{- end }}
spec:
{{- if .Values.audit.tolerations }}
tolerations:
{{- toYaml .Values.audit.tolerations | nindent 8 }}
{{- end }}
{{- if .Values.audit.nodeSelector }}
nodeSelector:
{{- toYaml .Values.audit.nodeSelector | nindent 8 }}
{{- end }}
{{- if .Values.audit.affinity }}
affinity:
{{- toYaml .Values.audit.affinity | nindent 8 }}
{{- end }}
terminationGracePeriodSeconds: {{ .Values.audit.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.manager.component }}-ready
image: {{ .Values.images.initContainer.repository }}:{{ .Values.images.initContainer.tag }}
imagePullPolicy: {{ .Values.images.pullPolicy }}
command: [ "/bin/sh", "-c" ]
args:
- |
count={{ .Values.manager.replicas }}
for i in $(seq 0 $(expr $count - 1))
do
replica="{{ template "inlong.fullname" . }}-{{ .Values.manager.component }}-$i"
host="$replica.{{ template "inlong.manager.hostname" . }}"
port={{ .Values.manager.port }}
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.audit.component }}
image: {{ .Values.images.audit.repository }}:{{ .Values.images.audit.tag }}
imagePullPolicy: {{ .Values.images.pullPolicy }}
{{- if .Values.audit.resources }}
resources:
{{- toYaml .Values.audit.resources | nindent 12 }}
{{- end }}
env:
- name: JDBC_URL
value: "{{ template "inlong.mysql.hostname" . }}:{{ .Values.mysql.port }}"
- name: USERNAME
value: {{ include "inlong.mysql.username" . | quote }}
- name: PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "inlong.fullname" . }}-{{ .Values.mysql.component }}
key: mysql-password
- name: MANAGER_OPENAPI_IP
value: {{ include "inlong.manager.hostname" . | quote }}
- name: MANAGER_OPENAPI_PORT
value: {{ .Values.manager.port | quote }}
- name: PULSAR_BROKER_LIST
value: {{ .Values.external.pulsar.serviceUrl | quote }}
- name: TUBE_MASTER_LIST
value: "{{ template "inlong.tubemqMaster.hostname" . }}:{{ .Values.tubemqMaster.ports.rpcPort }}"
{{- range $key, $value := .Values.audit.env }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }}
- name: TZ
value: {{ .Values.timezone }}
ports:
- name: {{ .Values.audit.component }}-port
containerPort: 10081
volumeMounts:
- name: data
mountPath: /data/collect-data
volumes:
- name: data
emptyDir: {}
restartPolicy: Always
{{- end }}