From 169dfe861187553430d2e4cf8ab2629f06272b0a Mon Sep 17 00:00:00 2001 From: Sven Ketelsen Date: Fri, 3 Jun 2022 08:42:44 +0200 Subject: [PATCH] feat: prometheus --- smardigo/templates/uba-export/_helpers.tpl | 7 +++++++ smardigo/templates/uba-export/deployment.yml | 12 ++++++------ smardigo/templates/uba-export/monitoring.yml | 6 +++--- smardigo/templates/uba-export/secret.yml | 2 +- smardigo/templates/uba-export/service.yml | 6 +++--- 5 files changed, 20 insertions(+), 13 deletions(-) create mode 100644 smardigo/templates/uba-export/_helpers.tpl diff --git a/smardigo/templates/uba-export/_helpers.tpl b/smardigo/templates/uba-export/_helpers.tpl new file mode 100644 index 0000000..b6b22b7 --- /dev/null +++ b/smardigo/templates/uba-export/_helpers.tpl @@ -0,0 +1,7 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Create name for the service. +*/}} +{{- define "service.name" -}} +{{- default "uba-exporter" -}} +{{- end -}} \ No newline at end of file diff --git a/smardigo/templates/uba-export/deployment.yml b/smardigo/templates/uba-export/deployment.yml index 0139b74..8f3a625 100644 --- a/smardigo/templates/uba-export/deployment.yml +++ b/smardigo/templates/uba-export/deployment.yml @@ -2,20 +2,20 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: "uba-export" + name: "{{ include "service.name" $ }}" spec: replicas: 1 selector: matchLabels: - app: "uba-export" + app: "{{ include "service.name" $ }}" template: metadata: labels: - app: "uba-export" + app: "{{ include "service.name" $ }}" spec: spec: containers: - - name: "uba-export" + - name: "{{ include "service.name" $ }}" image: "{{ .Values.harbor.host.name }}/{{ .Values.ubaExporter.image.name }}:{{ .Values.ubaExporter.image.version }}" imagePullPolicy: Always env: @@ -35,7 +35,7 @@ spec: - name: SMA_WORKFLOW_REST_AUTH_TOKEN valueFrom: secretKeyRef: - name: "uba-export-secrets" + name: "{{ include "service.name" $ }}-secrets" key: SMA_WORKFLOW_AUTH_TOKEN - name: SMA_DOCUMENT_REST_BASE_PATH value: "{{ .Values.smardigo.document.host }}" @@ -46,7 +46,7 @@ spec: - name: SMA_DOCUMENT_REST_AUTH_TOKEN valueFrom: secretKeyRef: - name: "uba-export-secrets" + name: "{{ include "service.name" $ }}-secrets" key: SMA_DOCUMENT_AUTH_TOKEN ports: - containerPort: 8080 diff --git a/smardigo/templates/uba-export/monitoring.yml b/smardigo/templates/uba-export/monitoring.yml index 7c7bdc6..0c0252a 100644 --- a/smardigo/templates/uba-export/monitoring.yml +++ b/smardigo/templates/uba-export/monitoring.yml @@ -2,13 +2,13 @@ apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: - name: uba-export + name: "{{ include "service.name" $ }}" labels: - release: prometheus + release: "prometheus" spec: selector: matchLabels: - app: uba-export + app: "{{ include "service.name" $ }}" namespaceSelector: matchNames: - "{{ .Release.Namespace }}" diff --git a/smardigo/templates/uba-export/secret.yml b/smardigo/templates/uba-export/secret.yml index 3d77862..c8f812a 100644 --- a/smardigo/templates/uba-export/secret.yml +++ b/smardigo/templates/uba-export/secret.yml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Secret metadata: - name: "uba-export-secrets" + name: "{{ include "service.name" $ }}-secrets" data: SMA_WORKFLOW_AUTH_TOKEN: "{{ .Values.ubaExporter.workflow.api_token | b64enc }}" SMA_DOCUMENT_AUTH_TOKEN: "{{ .Values.ubaExporter.document.api_token | b64enc }}" diff --git a/smardigo/templates/uba-export/service.yml b/smardigo/templates/uba-export/service.yml index 68f5aab..32c3dfa 100644 --- a/smardigo/templates/uba-export/service.yml +++ b/smardigo/templates/uba-export/service.yml @@ -2,12 +2,12 @@ apiVersion: v1 kind: Service metadata: - name: "uba-export" + name: "{{ include "service.name" $ }}" labels: - app: "uba-exporter" + app: "{{ include "service.name" $ }}" spec: selector: - app: "uba-export" + app: "{{ include "service.name" $ }}" ports: - port: 8080 targetPort: 8080