deployment.yaml 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. {{- if .Values.exporter.enabled }}
  2. {{- $thisValues := .Values.exporter }}
  3. {{- $brokerServicePort := .Values.broker.service.port | default .Values.containerPort.broker | int }}
  4. {{- $componet := "kafka-exporter" }}
  5. apiVersion: apps/v1
  6. kind: Deployment
  7. metadata:
  8. name: {{ include "kafka.exporter.fullname" . }}
  9. labels:
  10. {{- include "kafka.labels" . | nindent 4 }}
  11. component: {{ $componet | quote }}
  12. spec:
  13. {{- if $thisValues.replicaCount }}
  14. replicas: {{ $thisValues.replicaCount }}
  15. {{- end }}
  16. selector:
  17. matchLabels:
  18. {{- include "kafka.selectorLabels" . | nindent 6 }}
  19. component: {{ $componet | quote }}
  20. template:
  21. metadata:
  22. annotations:
  23. {{- if $thisValues.podAnnotations }}
  24. {{- with $thisValues.podAnnotations }}
  25. {{- toYaml . | nindent 8 }}
  26. {{- end }}
  27. {{- else }}
  28. prometheus.io/path: /metrics
  29. prometheus.io/port: "9308"
  30. prometheus.io/scrape: "true"
  31. {{- end }}
  32. labels:
  33. {{- include "kafka.selectorLabels" . | nindent 8 }}
  34. component: {{ $componet | quote }}
  35. {{- with $thisValues.podLabels }}
  36. {{- toYaml . | nindent 8 }}
  37. {{- end }}
  38. spec:
  39. {{- with .Values.imagePullSecrets }}
  40. imagePullSecrets:
  41. {{- toYaml . | nindent 8 }}
  42. {{- end }}
  43. serviceAccountName: {{ include "kafka.serviceAccountName" . }}
  44. securityContext:
  45. {{- toYaml $thisValues.podSecurityContext | nindent 8 }}
  46. containers:
  47. - name: exporter
  48. args:
  49. - {{ printf "--kafka.server=%s:%d" (include "kafka.broker.fullname" .) $brokerServicePort }}
  50. securityContext:
  51. {{- toYaml .Values.securityContext | nindent 12 }}
  52. image: "{{ $thisValues.image.repository }}:{{ $thisValues.image.tag }}"
  53. imagePullPolicy: {{ $thisValues.image.pullPolicy }}
  54. ports:
  55. - containerPort: 9308
  56. name: {{ $thisValues.containerPortName | default "http-metrics"}}
  57. protocol: TCP
  58. {{- with $thisValues.resources }}
  59. resources:
  60. {{- toYaml . | nindent 12 }}
  61. {{- end }}
  62. {{- with $thisValues.nodeSelector }}
  63. nodeSelector:
  64. {{- toYaml . | nindent 8 }}
  65. {{- end }}
  66. {{- with $thisValues.affinity }}
  67. affinity:
  68. {{- toYaml . | nindent 8 }}
  69. {{- end }}
  70. {{- with $thisValues.tolerations }}
  71. tolerations:
  72. {{- toYaml . | nindent 8 }}
  73. {{- end }}
  74. {{- end }}