From 45508aebe690a878350353156460278e28fa9c43 Mon Sep 17 00:00:00 2001 From: Xavier Coulon Date: Mon, 24 Jun 2024 15:47:01 +0200 Subject: [PATCH] registration-service: new Service for metrics new k8s Service to scrape the HTTP metrics from the registration service, but without exposing them to the current Route (the metrics will be exposed in a separate port in the registration service pods) see https://github.com/codeready-toolchain/registration-service/pull/436 Signed-off-by: Xavier Coulon --- .../registration-service.yaml | 81 +++++++++++++------ 1 file changed, 56 insertions(+), 25 deletions(-) diff --git a/deploy/registration-service/registration-service.yaml b/deploy/registration-service/registration-service.yaml index f6cf8c3a8..8122fc512 100644 --- a/deploy/registration-service/registration-service.yaml +++ b/deploy/registration-service/registration-service.yaml @@ -96,10 +96,12 @@ objects: - name: registration-service image: ${IMAGE} ports: - - containerPort: 8080 - - containerPort: 8081 - - containerPort: 8082 + - containerPort: 8080 # registration service + - containerPort: 8081 # proxy + - containerPort: 8082 # proxy metrics name: metrics + - containerPort: 8083 # registration service metrics + name: registration-service-metrics command: - registration-service imagePullPolicy: IfNotPresent @@ -140,24 +142,8 @@ objects: requests: cpu: "50m" memory: "100M" - - kind: Service - apiVersion: v1 - metadata: - name: registration-service - namespace: ${NAMESPACE} - labels: - provider: codeready-toolchain - run: registration-service - spec: - ports: - - name: "8080" - protocol: TCP - port: 80 - targetPort: 8080 - selector: - run: registration-service - type: ClusterIP - sessionAffinity: null + + # route for the registration service - kind: Route apiVersion: v1 metadata: @@ -177,24 +163,48 @@ objects: tls: termination: edge wildcardPolicy: None + + # service associated with the registration service route - kind: Service apiVersion: v1 metadata: - name: api + name: registration-service namespace: ${NAMESPACE} labels: provider: codeready-toolchain run: registration-service spec: ports: - - name: "8081" + - name: "8080" protocol: TCP port: 80 - targetPort: 8081 + targetPort: 8080 + selector: + run: registration-service + type: ClusterIP + sessionAffinity: null + + # internal service for the registration service, used by Prometheus to scrape the metrics + - kind: Service + apiVersion: v1 + metadata: + name: registration-service-metrics + namespace: ${NAMESPACE} + labels: + provider: codeready-toolchain + run: registration-service + spec: + ports: + - name: registration-service-metrics + protocol: TCP + port: 80 + targetPort: registration-service-metrics selector: run: registration-service type: ClusterIP sessionAffinity: null + + # route for the proxy - kind: Route apiVersion: v1 metadata: @@ -206,7 +216,6 @@ objects: name: api namespace: ${NAMESPACE} spec: - host: '' port: targetPort: "8081" to: @@ -216,6 +225,28 @@ objects: tls: termination: edge wildcardPolicy: None + + # service associated with the proxy route + - kind: Service + apiVersion: v1 + metadata: + name: api + namespace: ${NAMESPACE} + labels: + provider: codeready-toolchain + run: registration-service + spec: + ports: + - name: "8081" + protocol: TCP + port: 80 + targetPort: 8081 + selector: + run: registration-service + type: ClusterIP + sessionAffinity: null + + # internal service for the proxy, used by Prometheus to scrape the metrics - kind: Service apiVersion: v1 metadata: