openstack-helm-addons/kafka/templates/deployment.yaml

125 lines
4.4 KiB
YAML

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: {{ template "fullname" . }}
labels:
app: {{ template "fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
component: kafka
spec:
replicas: 1
template:
metadata:
labels:
app: {{ template "fullname" . }}
{{- if .Values.watcher.enabled }}
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "{{ .Values.watcher.port }}"
monasca.io/usek8slabels: "false"
monasca.io/whitelist: |
- kafka_dropped_message_count
- kafka_max_round_trip_time
- kafka_min_round_trip_time
- kafka_read_failure_count
- kafka_watcher_status
- kafka_write_failure_count
- go_memstats_heap_objects
- go_memstats_heap_inuse_bytes
{{- end }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
resources:
{{ toYaml .Values.resources | indent 12 }}
ports:
- name: kafka
containerPort: 9092
volumeMounts:
- name: kafka
mountPath: /data
env:
- name: KAFKA_DELETE_TOPIC_ENABLE
value: "true"
- name: KAFKA_AUTO_CREATE_TOPICS
value: "false"
- name: KAFKA_JMX
value: "true"
- name: JVM_MAX_RATIO
value: {{ .Values.memory_ratio | quote }}
- name: KAFKA_STACK_SIZE
value: {{ .Values.stack_size | quote }}
- name: ZOOKEEPER_CONNECTION_STRING
{{- if .Values.zookeeper.overrideUri }}
value: "{{ .Values.zookeeper.overrideUri }}"
{{- else }}
value: {{ .Release.Name }}-zookeeper:2181
{{- end }}
- name: STAY_ALIVE_ON_FAILURE
value: {{ .Values.stay_alive_on_failure | quote }}
{{- if .Values.exporter.enabled }}
- name: {{ .Chart.Name }}-exporter
image: "{{ .Values.exporter.image.repository }}:{{ .Values.exporter.image.tag }}"
imagePullPolicy: {{ .Values.exporter.image.pullPolicy }}
ports:
- name: exporter
containerPort: {{ .Values.exporter.port }}
volumeMounts:
- name: kafka-exporter
mountPath: /prometheus-config
{{- end }}
{{- if .Values.watcher.enabled }}
- name: watcher
image: "{{ .Values.watcher.image.repository }}:{{ .Values.watcher.image.tag }}"
imagePullPolicy: {{ .Values.watcher.image.pullPolicy }}
resources:
{{ toYaml .Values.watcher.resources | indent 12 }}
env:
- name: HEALTH_CHECK_TOPIC
value: {{ .Values.watcher.health_check_topic | quote }}
- name: BOOT_STRAP_SERVERS
value: "localhost:9092"
- name: GROUP_ID
value: {{ .Values.watcher.group_id | quote }}
- name: PROMETHEUS_ENDPOINT
value: "0.0.0.0:{{ .Values.watcher.port }}"
- name: WATCHER_PERIOD
value: {{ .Values.watcher.watcher_period | quote }}
- name: WATCHER_TIMEOUT
value: {{ .Values.watcher.watcher_timeout | quote }}
- name: STAY_ALIVE_ON_FAILURE
value: {{ .Values.watcher.stay_alive_on_failure | quote }}
ports:
- name: metrics
containerPort: {{ .Values.watcher.port }}
{{- end }}
volumes:
- name: kafka
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ template "fullname" . }}
{{- else }}
emptyDir: {}
{{- end -}}
{{- if .Values.exporter.enabled }}
- name: kafka-exporter
configMap:
name: {{ template "fullname" . }}-exporter
{{- end }}
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 1
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- "{{ .Release.Name }}-influxdb"
topologyKey: "kubernetes.io/hostname"