From f62eb7f4fca63b882850f8ed19631ecdf72d7661 Mon Sep 17 00:00:00 2001 From: Muhammad Salman Date: Tue, 25 Oct 2022 15:10:58 +0200 Subject: [PATCH 1/4] feat: support for prometheus metrics --- .../boundary-chart/templates/configmap.yaml | 7 ++++++ .../boundary-chart/templates/deployment.yaml | 7 +++++- charts/boundary-chart/templates/service.yaml | 24 +++++++++++++++++++ charts/boundary-chart/values.yaml | 7 ++++++ 4 files changed, 44 insertions(+), 1 deletion(-) diff --git a/charts/boundary-chart/templates/configmap.yaml b/charts/boundary-chart/templates/configmap.yaml index ad3c6be..5b4b4a6 100644 --- a/charts/boundary-chart/templates/configmap.yaml +++ b/charts/boundary-chart/templates/configmap.yaml @@ -111,6 +111,13 @@ data: purpose = "proxy" tls_disable = true } + {{- if .Values.metrics.enabled }} + listener "tcp" { + address = "0.0.0.0" + purpose = "ops" + tls_disable = true + } + {{- end }} {{- if .Values.vault.enabled }} {{- $fqdn := .Values.vault.fqdn }} {{- $mountPath := .Values.vault.mountPath }} diff --git a/charts/boundary-chart/templates/deployment.yaml b/charts/boundary-chart/templates/deployment.yaml index 0dc88ce..b755ba0 100644 --- a/charts/boundary-chart/templates/deployment.yaml +++ b/charts/boundary-chart/templates/deployment.yaml @@ -102,13 +102,18 @@ spec: image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} ports: - {{- range .Values.service }} + {{- range concat .Values.service }} {{- range .ports }} - name: {{ .name }} containerPort: {{ .number }} protocol: TCP {{- end }} {{- end }} + {{- if .Values.metrics.enabled }} + - name: {{ .Values.metrics.name }} + containerPort: {{ .Values.metrics.port }} + protocol: TCP + {{- end }} livenessProbe: httpGet: path: / diff --git a/charts/boundary-chart/templates/service.yaml b/charts/boundary-chart/templates/service.yaml index aff69d0..b0dfd76 100644 --- a/charts/boundary-chart/templates/service.yaml +++ b/charts/boundary-chart/templates/service.yaml @@ -36,3 +36,27 @@ spec: selector: {{- $selectorLabels | nindent 4 }} {{- end }} + +--- + +{{ if .Values.metrics.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ $fullName }}-metrics + labels: + {{- $labels | nindent 4 }} + annotations: + prometheus.io/path: {{ .Values.metrics.path }} + prometheus.io/port: {{ .Values.metrics.port | quote }} + prometheus.io/scrape: "true" +spec: + type: ClusterIP + ports: + - port: {{ .Values.metrics.port }} + targetPort: {{ .Values.metrics.name }} + protocol: TCP + name: {{ .Values.metrics.name }} + selector: + {{- $selectorLabels | nindent 4 }} +{{- end }} diff --git a/charts/boundary-chart/values.yaml b/charts/boundary-chart/values.yaml index ecf3c9f..946a579 100644 --- a/charts/boundary-chart/values.yaml +++ b/charts/boundary-chart/values.yaml @@ -52,6 +52,13 @@ vault: vaultCredPath: postgres/creds/boundary-db vaultDbRole: boundary +# set true to enable prometheus metrics +metrics: + enabled: false + name: metrics + port: 9203 + path: /metrics + serviceAccount: # Specifies whether a service account should be created create: true From dd46c2db49bee3f718d5a3bbc1b30c99401e1e1d Mon Sep 17 00:00:00 2001 From: Muhammad Salman Date: Tue, 25 Oct 2022 15:11:56 +0200 Subject: [PATCH 2/4] fix: reverting change --- charts/boundary-chart/templates/deployment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/boundary-chart/templates/deployment.yaml b/charts/boundary-chart/templates/deployment.yaml index b755ba0..060bd6e 100644 --- a/charts/boundary-chart/templates/deployment.yaml +++ b/charts/boundary-chart/templates/deployment.yaml @@ -102,7 +102,7 @@ spec: image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} ports: - {{- range concat .Values.service }} + {{- range .Values.service }} {{- range .ports }} - name: {{ .name }} containerPort: {{ .number }} From 6c172050c8e2534b184051923227daa8cca9af5b Mon Sep 17 00:00:00 2001 From: Muhammad Salman Date: Tue, 25 Oct 2022 16:54:20 +0200 Subject: [PATCH 3/4] fix: adding prometheus annotations to deployment --- charts/boundary-chart/templates/deployment.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/charts/boundary-chart/templates/deployment.yaml b/charts/boundary-chart/templates/deployment.yaml index 060bd6e..ff554f9 100644 --- a/charts/boundary-chart/templates/deployment.yaml +++ b/charts/boundary-chart/templates/deployment.yaml @@ -17,6 +17,11 @@ spec: {{- with .Values.podAnnotations }} {{- toYaml . | nindent 8 }} {{- end }} + {{- if .Values.metrics.enabled }} + prometheus.io/path: {{ .Values.metrics.path }} + prometheus.io/port: {{ .Values.metrics.port | quote }} + prometheus.io/scrape: "true" + {{- end }} {{- if .Values.vault.enabled }} {{- $credPath := .Values.vault.database.vaultCredPath }} {{- $adminCredPath := .Values.vault.database.vaultAdminCredPath }} From fcfed782196612346bc3c8510e88a2c886ba708a Mon Sep 17 00:00:00 2001 From: "J. Garcia" Date: Tue, 25 Oct 2022 19:16:27 -0700 Subject: [PATCH 4/4] bump version --- charts/boundary-chart/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/boundary-chart/Chart.yaml b/charts/boundary-chart/Chart.yaml index 8f25676..9be1709 100644 --- a/charts/boundary-chart/Chart.yaml +++ b/charts/boundary-chart/Chart.yaml @@ -15,7 +15,7 @@ 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. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.2.4 +version: 0.2.5 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to