From 61a3cd834f5336b1784c9a013e008ebaf368850d Mon Sep 17 00:00:00 2001 From: David Kornel Date: Thu, 24 Aug 2023 10:15:54 +0200 Subject: [PATCH 1/3] Update pipeline: Sent thor data to metrics collector --- .../pipelines/test-suite/thor-test-suite.yaml.j2 | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/install/roles/tealc/templates/tekton/pipelines/test-suite/thor-test-suite.yaml.j2 b/install/roles/tealc/templates/tekton/pipelines/test-suite/thor-test-suite.yaml.j2 index 59610627..dee3b32e 100644 --- a/install/roles/tealc/templates/tekton/pipelines/test-suite/thor-test-suite.yaml.j2 +++ b/install/roles/tealc/templates/tekton/pipelines/test-suite/thor-test-suite.yaml.j2 @@ -67,8 +67,7 @@ spec: name: worker-03-tekton key: server script: | - mkdir -p /opt/thor - cd /opt/thor + cd $(workspaces.pipeline-ws.path) git clone https://github.com/ExcelentProject/thor.git @@ -76,6 +75,19 @@ spec: export JAVA_HOME=/usr/lib/jvm/java-17-openjdk mvn test --no-transfer-progress finally: + - name: sent-results + workspaces: + - name: pipeline-ws + workspace: pipeline-ws + taskSpec: + workspaces: + - name: pipeline-ws + steps: + - name: sent-results + image: quay.io/mk-ci-cd/mas-ci-tools:latest + script: | + cd $(workspaces.pipeline-ws.path)/thor/target/surefire-reports + for file in *.xml; do curl -X POST -H "X-Run-ID: $(context.pipelineRun.name)" -d @$file tealc-metrics-collector.tealc-pipelines.cluster.local:8080/data; done - name: notify-slack when: - input: $(tasks.status) From 9b23c67576b98df96735ebc546d3aeccbcbe66bc Mon Sep 17 00:00:00 2001 From: David Kornel Date: Thu, 24 Aug 2023 11:05:42 +0200 Subject: [PATCH 2/3] Add deployment for metric collector --- .../tekton/strimzi-infra-tkn-pipelines.yaml | 9 +++ .../test-suite/metrics-collector.yaml | 73 +++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 install/roles/tealc/templates/tekton/pipelines/test-suite/metrics-collector.yaml diff --git a/install/roles/tealc/tasks/scenario-deployment/tekton/strimzi-infra-tkn-pipelines.yaml b/install/roles/tealc/tasks/scenario-deployment/tekton/strimzi-infra-tkn-pipelines.yaml index c81e52bc..1b022d91 100644 --- a/install/roles/tealc/tasks/scenario-deployment/tekton/strimzi-infra-tkn-pipelines.yaml +++ b/install/roles/tealc/tasks/scenario-deployment/tekton/strimzi-infra-tkn-pipelines.yaml @@ -56,6 +56,15 @@ vars: name: "{{ workers.main_cluster.name }}" +- name: Create collector metrics for test suites + kubernetes.core.k8s: + kubeconfig: "{{ kubeconfig_path }}/{{ infra_context_name }}" + namespace: "{{ infra_ci_namespace }}" + state: present + verify_ssl: no + apply: true + src: "templates/tekton/pipelines/test-suite/metrics-collector.yaml" + - name: Create Tekton pipelines from jinja templates for release_cluster and downstream_cluster kubernetes.core.k8s: kubeconfig: "{{ kubeconfig_path }}/{{ infra_context_name }}" diff --git a/install/roles/tealc/templates/tekton/pipelines/test-suite/metrics-collector.yaml b/install/roles/tealc/templates/tekton/pipelines/test-suite/metrics-collector.yaml new file mode 100644 index 00000000..ee76143b --- /dev/null +++ b/install/roles/tealc/templates/tekton/pipelines/test-suite/metrics-collector.yaml @@ -0,0 +1,73 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: tealc-metrics-collector + labels: + app: tealc-metrics-collector +--- +kind: Service +apiVersion: v1 +metadata: + name: tealc-metrics-collector + labels: + app: tealc-metrics-collector +spec: + ports: + - port: 8080 + name: http + protocol: TCP + targetPort: 8080 + selector: + app: tealc-metrics-collector +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: tealc-metrics-collector + labels: + app: tealc-metrics-collector +spec: + replicas: 1 + selector: + matchLabels: + app: tealc-metrics-collector + template: + metadata: + labels: + app: tealc-metrics-collector + tealc/kind: thor-exporter + spec: + serviceAccountName: tealc-metrics-collector + containers: + - name: tealc-metrics-collector + image: quay.io/tealc/metrics-collector:latest + resources: + limits: + memory: "128Mi" + cpu: "1000m" + requests: + memory: "128Mi" + cpu: "1000m" + ports: + - containerPort: 8080 + name: metrics + protocol: TCP + - containerPort: 8080 + name: data + protocol: TCP + strategy: + type: Recreate +--- +apiVersion: monitoring.coreos.com/v1 +kind: PodMonitor +metadata: + labels: + app: tealc + name: thor-metrics +spec: + podMetricsEndpoints: + - path: /data + port: http + selector: + matchLabels: + tealc/kind: thor-exporter From 9e493dc96213d6c84250af98a26cc27eabb08ca9 Mon Sep 17 00:00:00 2001 From: David Kornel Date: Thu, 24 Aug 2023 11:08:27 +0200 Subject: [PATCH 3/3] Fix --- .../pipelines/test-suite/metrics-collector.yaml | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/install/roles/tealc/templates/tekton/pipelines/test-suite/metrics-collector.yaml b/install/roles/tealc/templates/tekton/pipelines/test-suite/metrics-collector.yaml index ee76143b..85420b51 100644 --- a/install/roles/tealc/templates/tekton/pipelines/test-suite/metrics-collector.yaml +++ b/install/roles/tealc/templates/tekton/pipelines/test-suite/metrics-collector.yaml @@ -14,7 +14,7 @@ metadata: spec: ports: - port: 8080 - name: http + name: metrics protocol: TCP targetPort: 8080 selector: @@ -44,17 +44,11 @@ spec: resources: limits: memory: "128Mi" - cpu: "1000m" - requests: - memory: "128Mi" - cpu: "1000m" + cpu: "100m" ports: - containerPort: 8080 name: metrics protocol: TCP - - containerPort: 8080 - name: data - protocol: TCP strategy: type: Recreate --- @@ -66,8 +60,8 @@ metadata: name: thor-metrics spec: podMetricsEndpoints: - - path: /data - port: http + - path: /metrics + port: metrics selector: matchLabels: tealc/kind: thor-exporter