From f07af055225b77d0a99dca927346276fa1b6c540 Mon Sep 17 00:00:00 2001 From: Masterchen09 <13187726+Masterchen09@users.noreply.github.com> Date: Sun, 26 May 2024 15:20:07 +0200 Subject: [PATCH] feat: add monitoring configuration to acryl-datahub-actions subchart --- charts/datahub/Chart.yaml | 4 +-- .../acryl-datahub-actions/Chart.yaml | 2 +- .../subcharts/acryl-datahub-actions/README.md | 8 ++++-- .../templates/deployment.yaml | 11 ++++++++ .../templates/service.yaml | 6 ++++ .../templates/servicemonitor.yaml | 28 +++++++++++++++++++ .../acryl-datahub-actions/values.yaml | 7 +++++ 7 files changed, 60 insertions(+), 6 deletions(-) create mode 100644 charts/datahub/subcharts/acryl-datahub-actions/templates/servicemonitor.yaml diff --git a/charts/datahub/Chart.yaml b/charts/datahub/Chart.yaml index 280489b27..95706bce4 100644 --- a/charts/datahub/Chart.yaml +++ b/charts/datahub/Chart.yaml @@ -4,7 +4,7 @@ description: A Helm chart for DataHub type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. -version: 0.5.1 +version: 0.5.2 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. appVersion: 0.15.0 @@ -30,7 +30,7 @@ dependencies: repository: file://./subcharts/datahub-ingestion-cron condition: datahub-ingestion-cron.enabled - name: acryl-datahub-actions - version: 0.2.149 + version: 0.2.150 repository: file://./subcharts/acryl-datahub-actions condition: acryl-datahub-actions.enabled maintainers: diff --git a/charts/datahub/subcharts/acryl-datahub-actions/Chart.yaml b/charts/datahub/subcharts/acryl-datahub-actions/Chart.yaml index dffeee4fb..eaa9024a0 100644 --- a/charts/datahub/subcharts/acryl-datahub-actions/Chart.yaml +++ b/charts/datahub/subcharts/acryl-datahub-actions/Chart.yaml @@ -12,7 +12,7 @@ description: A Helm chart for Kubernetes type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. -version: 0.2.149 +version: 0.2.150 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. appVersion: 0.1.1 diff --git a/charts/datahub/subcharts/acryl-datahub-actions/README.md b/charts/datahub/subcharts/acryl-datahub-actions/README.md index 65c1aa94d..fc572e776 100644 --- a/charts/datahub/subcharts/acryl-datahub-actions/README.md +++ b/charts/datahub/subcharts/acryl-datahub-actions/README.md @@ -10,10 +10,10 @@ Current chart version is `0.0.3` |-----------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------|-------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | affinity | object | `{}` | | | extraLabels | object | `{}` | Extra labels for deployment configuration | -| extraEnvs | Extra [environment variables][] which will be appended to the `env:` definition for the container | `[]` | +| extraEnvs | Extra [environment variables][] which will be appended to the `env:` definition for the container | `[]` | | | extraSidecars | list | `[]` | Add additional sidecar containers to the deployment pod(s) | -| extraVolumes | Templatable string of additional `volumes` to be passed to the `tpl` function | "" | -| extraVolumeMounts | Templatable string of additional `volumeMounts` to be passed to the `tpl` function | "" | +| extraVolumes | Templatable string of additional `volumes` to be passed to the `tpl` function | "" | | +| extraVolumeMounts | Templatable string of additional `volumeMounts` to be passed to the `tpl` function | "" | | | fullnameOverride | string | `"acryl-datahub-actions"` | | | global.datahub.gms.port | string | `"8080"` | | | image.args | list | `[]` | Override the image's args. Used to configure custom startup or shutdown behavior | @@ -36,6 +36,8 @@ Current chart version is `0.0.3` | serviceAccount.annotations | object | `{}` | | | serviceAccount.create | bool | `false` | | | serviceAccount.name | string | `nil` | | +| serviceMonitor.create | bool | `false` | If set true and `global.datahub.monitoring.enablePrometheus` is set `true` it will create a ServiceMonitor resource | +| serviceMonitor.extraLabels | object | `{}` | | | tolerations | list | `[]` | | | global.kafka.bootstrap.server | string | `nil` | | | global.kafka.schemaregistry.url | string | `nil` | | diff --git a/charts/datahub/subcharts/acryl-datahub-actions/templates/deployment.yaml b/charts/datahub/subcharts/acryl-datahub-actions/templates/deployment.yaml index ee00a06a5..457a6c14f 100644 --- a/charts/datahub/subcharts/acryl-datahub-actions/templates/deployment.yaml +++ b/charts/datahub/subcharts/acryl-datahub-actions/templates/deployment.yaml @@ -70,6 +70,11 @@ spec: - name: http containerPort: 9093 protocol: TCP + {{- if .Values.global.datahub.monitoring.enablePrometheus }} + - name: {{ .Values.global.datahub.monitoring.portName }} + containerPort: 8000 + protocol: TCP + {{- end }} {{- if .Values.image.command }} command: {{ .Values.image.command | toRawJson }} {{- end }} @@ -159,6 +164,12 @@ spec: name: {{ .Values.global.datahub.metadata_service_authentication.systemClientSecret.secretRef }} key: {{ .Values.global.datahub.metadata_service_authentication.systemClientSecret.secretKey }} {{- end }} + {{- if .Values.global.datahub.monitoring.enablePrometheus }} + - name: DATAHUB_ACTIONS_MONITORING_ENABLED + value: "true" + - name: DATAHUB_ACTIONS_MONITORING_PORT + value: "8000" + {{- end }} {{- if .Values.extraEnvs }} {{ toYaml .Values.extraEnvs | nindent 12 }} {{- end }} diff --git a/charts/datahub/subcharts/acryl-datahub-actions/templates/service.yaml b/charts/datahub/subcharts/acryl-datahub-actions/templates/service.yaml index 1a1f3b072..7d53bc3da 100644 --- a/charts/datahub/subcharts/acryl-datahub-actions/templates/service.yaml +++ b/charts/datahub/subcharts/acryl-datahub-actions/templates/service.yaml @@ -15,5 +15,11 @@ spec: targetPort: http protocol: TCP name: http + {{- if .Values.global.datahub.monitoring.enablePrometheus }} + - name: {{ .Values.global.datahub.monitoring.portName }} + port: 8000 + targetPort: {{ .Values.global.datahub.monitoring.portName }} + protocol: TCP + {{- end }} selector: {{- include "acryl-datahub-actions.selectorLabels" . | nindent 4 }} diff --git a/charts/datahub/subcharts/acryl-datahub-actions/templates/servicemonitor.yaml b/charts/datahub/subcharts/acryl-datahub-actions/templates/servicemonitor.yaml new file mode 100644 index 000000000..1e9cc31af --- /dev/null +++ b/charts/datahub/subcharts/acryl-datahub-actions/templates/servicemonitor.yaml @@ -0,0 +1,28 @@ +{{- if and .Values.serviceMonitor.create .Values.global.datahub.monitoring.enablePrometheus -}} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "acryl-datahub-actions.fullname" . }} + labels: + {{- include "acryl-datahub-actions.labels" . | nindent 4 }} + {{- range $key, $val := .Values.serviceMonitor.extraLabels }} + {{ $key }}: {{ $val | quote }} + {{- end }} + {{- with .Values.serviceMonitor.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + endpoints: + - port: {{ .Values.global.datahub.monitoring.portName }} + relabelings: + - separator: / + sourceLabels: + - namespace + - pod + targetLabel: instance + selector: + matchLabels: + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: acryl-datahub-actions +{{- end -}} \ No newline at end of file diff --git a/charts/datahub/subcharts/acryl-datahub-actions/values.yaml b/charts/datahub/subcharts/acryl-datahub-actions/values.yaml index 80cdeb3b0..28c2fd6a3 100644 --- a/charts/datahub/subcharts/acryl-datahub-actions/values.yaml +++ b/charts/datahub/subcharts/acryl-datahub-actions/values.yaml @@ -27,6 +27,10 @@ serviceAccount: # If not set and create is true, a name is generated using the fullname template name: +serviceMonitor: + create: false + extraLabels: {} + podAnnotations: {} podSecurityContext: {} @@ -98,6 +102,9 @@ global: datahub: gms: port: "8080" + monitoring: + enablePrometheus: true + portName: "jmx" metadata_service_authentication: enabled: true systemClientId: "__datahub_system"