All checks were successful
continuous-integration/drone/push Build is passing
* Added Behave BDD Tests for User Service * Added Swagger Docs for User Service * Added Vault, Redpanda helm config (not yet being used) * Added frontend config for host / port when running locally
223 lines
9.3 KiB
YAML
223 lines
9.3 KiB
YAML
{{/*
|
|
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.
|
|
*/}}
|
|
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: {{ template "redpanda.fullname" . }}
|
|
namespace: {{ .Release.Namespace | quote }}
|
|
labels:
|
|
helm.sh/chart: {{ template "redpanda.chart" . }}
|
|
app.kubernetes.io/name: {{ template "redpanda.name" . }}
|
|
app.kubernetes.io/instance: {{ .Release.Name | quote }}
|
|
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
|
|
app.kubernetes.io/component: {{ template "redpanda.name" . }}
|
|
{{- with .Values.labels }}
|
|
{{- toYaml . | nindent 4 }}
|
|
{{- end }}
|
|
spec:
|
|
selector:
|
|
matchLabels:
|
|
app.kubernetes.io/name: {{ template "redpanda.name" . }}
|
|
app.kubernetes.io/instance: {{ .Release.Name | quote }}
|
|
serviceName: {{ template "redpanda.fullname" . }}
|
|
replicas: {{ .Values.statefulset.replicas | int64 }}
|
|
updateStrategy: {{- toYaml .Values.statefulset.updateStrategy | nindent 4 }}
|
|
podManagementPolicy: {{ .Values.statefulset.podManagementPolicy | quote }}
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/name: {{ template "redpanda.name" . }}
|
|
app.kubernetes.io/instance: {{ .Release.Name | quote }}
|
|
app.kubernetes.io/component: {{ template "redpanda.name" . }}
|
|
{{- with .Values.labels }}
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.statefulset.annotations }}
|
|
annotations: {{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
spec:
|
|
securityContext:
|
|
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
|
# TODO:
|
|
# * Figure out what to do about node_id / seeds here - the operator will fix this separately
|
|
# * Once that's done, this initContainer can be removed
|
|
initContainers:
|
|
- name: {{ template "redpanda.name" . }}-configurator
|
|
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
|
|
command: ["/bin/sh", "-c"]
|
|
env:
|
|
- name: SERVICE_NAME
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: metadata.name
|
|
args:
|
|
- >
|
|
CONFIG=/etc/redpanda/redpanda.yaml;
|
|
NODE_ID=${SERVICE_NAME##*-};
|
|
cp /tmp/base-config/redpanda.yaml "$CONFIG";
|
|
rpk --config "$CONFIG" config set redpanda.node_id $NODE_ID;
|
|
if [ "$NODE_ID" = "0" ]; then
|
|
rpk --config "$CONFIG" config set redpanda.seed_servers '[]' --format yaml;
|
|
fi;
|
|
volumeMounts:
|
|
- name: {{ template "redpanda.fullname" . }}
|
|
mountPath: /tmp/base-config
|
|
- name: config
|
|
mountPath: /etc/redpanda
|
|
resources:
|
|
{{- toYaml .Values.statefulset.resources | nindent 12 }}
|
|
containers:
|
|
- name: {{ template "redpanda.name" . }}
|
|
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
|
|
env:
|
|
- name: SERVICE_NAME
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: metadata.name
|
|
- name: POD_IP
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: status.podIP
|
|
args:
|
|
- >
|
|
redpanda
|
|
start
|
|
--smp={{ .Values.statefulset.resources.limits.cpu }}
|
|
--memory={{ template "redpanda.parseMemory" . }}
|
|
--reserve-memory=0M
|
|
--advertise-kafka-addr=internal://{{ template "redpanda.kafka.internal.advertise.address" . }}:{{ template "redpanda.kafka.internal.advertise.port" . }}
|
|
--kafka-addr=internal://{{ template "redpanda.kafka.internal.listen.address" . }}:{{ template "redpanda.kafka.internal.listen.port" . }}
|
|
--advertise-rpc-addr={{ template "redpanda.rpc.advertise.address" . }}:{{ template "redpanda.rpc.advertise.port" . }}
|
|
--rpc-addr={{ template "redpanda.rpc.listen.address" . }}:{{ template "redpanda.rpc.listen.port" . }}
|
|
--
|
|
--default-log-level={{ .Values.config.seastar.default_log_level }}
|
|
ports:
|
|
- containerPort: {{ .Values.config.redpanda.admin.port }}
|
|
name: admin
|
|
- containerPort: {{ template "redpanda.kafka.internal.listen.port" . }}
|
|
name: kafka
|
|
- containerPort: {{ template "redpanda.rpc.listen.port" $ }}
|
|
name: rpc
|
|
volumeMounts:
|
|
- name: datadir
|
|
mountPath: /var/lib/redpanda/data
|
|
- name: config
|
|
mountPath: /etc/redpanda
|
|
resources:
|
|
{{- toYaml .Values.statefulset.resources | nindent 12 }}
|
|
volumes:
|
|
- name: datadir
|
|
{{- if .Values.storage.persistentVolume.enabled }}
|
|
persistentVolumeClaim:
|
|
claimName: datadir
|
|
{{- else if .Values.storage.hostPath }}
|
|
hostPath:
|
|
path: {{ .Values.storage.hostPath | quote }}
|
|
{{- else }}
|
|
emptyDir: {}
|
|
{{- end }}
|
|
- name: {{ template "redpanda.fullname" . }}
|
|
configMap:
|
|
name: {{ template "redpanda.fullname" . }}
|
|
- name: config
|
|
emptyDir: {}
|
|
{{- if or .Values.statefulset.nodeAffinity .Values.statefulset.podAffinity .Values.statefulset.podAntiAffinity }}
|
|
affinity:
|
|
{{- with .Values.statefulset.nodeAffinity }}
|
|
nodeAffinity: {{- toYaml . | nindent 10 }}
|
|
{{- end }}
|
|
{{- with .Values.statefulset.podAffinity }}
|
|
podAffinity: {{- toYaml . | nindent 10 }}
|
|
{{- end }}
|
|
{{- if .Values.statefulset.podAntiAffinity }}
|
|
podAntiAffinity:
|
|
{{- if .Values.statefulset.podAntiAffinity.type }}
|
|
{{- if eq .Values.statefulset.podAntiAffinity.type "hard" }}
|
|
requiredDuringSchedulingIgnoredDuringExecution:
|
|
- topologyKey: {{ .Values.statefulset.podAntiAffinity.topologyKey }}
|
|
labelSelector:
|
|
matchLabels:
|
|
app.kubernetes.io/name: {{ template "redpanda.name" . }}
|
|
app.kubernetes.io/instance: {{ .Release.Name | quote }}
|
|
{{- else if eq .Values.statefulset.podAntiAffinity.type "soft" }}
|
|
preferredDuringSchedulingIgnoredDuringExecution:
|
|
- weight: {{ .Values.statefulset.podAntiAffinity.weight | int64 }}
|
|
podAffinityTerm:
|
|
topologyKey: {{ .Values.statefulset.podAntiAffinity.topologyKey }}
|
|
labelSelector:
|
|
matchLabels:
|
|
app.kubernetes.io/name: {{ template "redpanda.name" . }}
|
|
app.kubernetes.io/instance: {{ .Release.Name | quote }}
|
|
{{- end }}
|
|
{{- else }}
|
|
{{- toYaml .Values.statefulset.podAntiAffinity | nindent 10 }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- if semverCompare ">=1.16-0" .Capabilities.KubeVersion.GitVersion }}
|
|
topologySpreadConstraints:
|
|
- labelSelector:
|
|
matchLabels:
|
|
app.kubernetes.io/name: {{ template "redpanda.name" . }}
|
|
app.kubernetes.io/instance: {{ .Release.Name | quote }}
|
|
{{- with .Values.statefulset.topologySpreadConstraints }}
|
|
maxSkew: {{ .maxSkew }}
|
|
topologyKey: {{ .topologyKey }}
|
|
whenUnsatisfiable: {{ .whenUnsatisfiable }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- with .Values.statefulset.nodeSelector }}
|
|
nodeSelector: {{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.statefulset.priorityClassName }}
|
|
priorityClassName: {{ .Values.statefulset.priorityClassName }}
|
|
{{- end }}
|
|
{{- with .Values.statefulset.tolerations }}
|
|
tolerations: {{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.storage.persistentVolume.enabled }}
|
|
volumeClaimTemplates:
|
|
- metadata:
|
|
name: datadir
|
|
labels:
|
|
app.kubernetes.io/name: {{ template "redpanda.name" . }}
|
|
app.kubernetes.io/instance: {{ .Release.Name | quote }}
|
|
app.kubernetes.io/component: {{ template "redpanda.name" . }}
|
|
{{- with .Values.storage.persistentVolume.labels }}
|
|
{{- toYaml . | nindent 10 }}
|
|
{{- end }}
|
|
{{- with .Values.labels }}
|
|
{{- toYaml . | nindent 10 }}
|
|
{{- end }}
|
|
{{- with .Values.storage.persistentVolume.annotations }}
|
|
annotations: {{- toYaml . | nindent 10 }}
|
|
{{- end }}
|
|
spec:
|
|
accessModes: ["ReadWriteOnce"]
|
|
{{- if .Values.storage.persistentVolume.storageClass }}
|
|
{{- if (eq "-" .Values.storage.persistentVolume.storageClass) }}
|
|
storageClassName: ""
|
|
{{- else }}
|
|
storageClassName: {{ .Values.storage.persistentVolume.storageClass | quote}}
|
|
{{- end }}
|
|
{{- end }}
|
|
resources:
|
|
requests:
|
|
storage: {{ .Values.storage.persistentVolume.size | quote }}
|
|
{{- end }}
|