From 420408b1dd902dd924491ff38f606dfc0e6b7951 Mon Sep 17 00:00:00 2001 From: Samuel Lucidi Date: Thu, 1 Jun 2023 11:33:06 -0400 Subject: [PATCH] :sparkles: Expose Hub metrics (#240) This exposes the Hub's prometheus metrics via an additional port on the existing Hub service. This is necessary to properly implement https://issues.redhat.com/projects/MTA/issues/MTA-402. Related to https://github.com/konveyor/tackle2-hub/pull/335 Signed-off-by: Sam Lucidi --- roles/tackle/defaults/main.yml | 2 ++ roles/tackle/templates/deployment-hub.yml.j2 | 4 ++++ roles/tackle/templates/service-hub.yml.j2 | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/roles/tackle/defaults/main.yml b/roles/tackle/defaults/main.yml index 76613c4..e80245f 100644 --- a/roles/tackle/defaults/main.yml +++ b/roles/tackle/defaults/main.yml @@ -48,6 +48,8 @@ hub_port: "{{ '8443' if hub_tls_enabled | bool else '8080' }}" hub_proto: "{{ 'https' if hub_tls_enabled | bool else 'http' }}" hub_url: "{{ hub_proto }}://{{ hub_service_name }}.{{ app_namespace }}.svc:{{ hub_port }}" hub_log_level: 3 +hub_metrics_enabled: true +hub_metrics_port: "2112" pathfinder_database_image_fqin: "{{ lookup('env', 'RELATED_IMAGE_PATHFINDER_DATABASE') }}" pathfinder_database_name: "pathfinder" diff --git a/roles/tackle/templates/deployment-hub.yml.j2 b/roles/tackle/templates/deployment-hub.yml.j2 index 49ca6d6..1806a7c 100644 --- a/roles/tackle/templates/deployment-hub.yml.j2 +++ b/roles/tackle/templates/deployment-hub.yml.j2 @@ -97,6 +97,10 @@ spec: secretKeyRef: name: "{{ hub_secret_name }}" key: addon_token + - name: METRICS_ENABLED + value: "{{ hub_metrics_enabled }}" + - name: METRICS_PORT + value: "{{ hub_metrics_port }}" {% if feature_auth_required|bool and feature_auth_type == "keycloak" %} - name: AUTH_REQUIRED value: "true" diff --git a/roles/tackle/templates/service-hub.yml.j2 b/roles/tackle/templates/service-hub.yml.j2 index 18d5163..bd52b90 100644 --- a/roles/tackle/templates/service-hub.yml.j2 +++ b/roles/tackle/templates/service-hub.yml.j2 @@ -18,6 +18,10 @@ spec: port: {{ hub_port }} targetPort: {{ hub_port }} protocol: TCP + - name: metrics + port: {{ hub_metrics_port }} + targetPort: {{ hub_metrics_port }} + protocol: TCP selector: app.kubernetes.io/name: {{ hub_service_name }} app.kubernetes.io/component: {{ hub_component_name }}