From bb9d61ae7362eaa6a0f5d0f18902d555c8b26578 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 20 Jun 2025 19:01:15 +0000 Subject: [PATCH] feat: Update Helm chart and CI for exporter enhancements This commit introduces updates to the Helm chart to support log level configuration for the iperf3 exporter, and modifies the CI workflow to improve image tagging for pull requests. Helm Chart Changes (`charts/iperf3-monitor`): - Added `exporter.logLevel` to `values.yaml` (default: "INFO") to allow you to set the exporter's log level. - Updated `templates/exporter-deployment.yaml` to use the `exporter.logLevel` value to set the `LOG_LEVEL` environment variable in the exporter container. CI Workflow Changes (`.github/workflows/ci.yaml`): - Modified the Docker image build process to tag images built from pull requests with `pr-`. - Ensured that these PR-specific images are pushed to the container registry. - Preserved existing tagging mechanisms (e.g., SHA-based tags). --- .github/workflows/ci.yaml | 11 ++++++++++- .../iperf3-monitor/templates/exporter-deployment.yaml | 2 ++ charts/iperf3-monitor/values.yaml | 3 +++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 38251e6..3cde71c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -42,12 +42,21 @@ jobs: uses: docker/metadata-action@v4 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + # Tag with the PR number if it's a pull request event + type=match,pattern=pull_request,value=pr-{{number}} + # Tag with the git SHA + type=sha,prefix= + # Tag with 'latest' if on the main branch (though this workflow only runs on PRs to main) + type=ref,event=branch,pattern=main,value=latest - name: Build Docker image uses: docker/build-push-action@v4 with: context: ./exporter - push: false # Do not push on PRs + # Push the image if the event is a pull request. + # The workflow currently only triggers on pull_request events. + push: ${{ github.event_name == 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} platforms: linux/amd64,linux/arm64 diff --git a/charts/iperf3-monitor/templates/exporter-deployment.yaml b/charts/iperf3-monitor/templates/exporter-deployment.yaml index b6d4df3..e58bd7b 100644 --- a/charts/iperf3-monitor/templates/exporter-deployment.yaml +++ b/charts/iperf3-monitor/templates/exporter-deployment.yaml @@ -34,6 +34,8 @@ spec: value: "{{ .Values.exporter.testInterval }}" - name: IPERF_TEST_PROTOCOL value: "{{ .Values.exporter.testProtocol }}" + - name: LOG_LEVEL + value: "{{ .Values.exporter.logLevel }}" - name: IPERF_SERVER_PORT value: "5201" # Hardcoded as per server DaemonSet - name: IPERF_SERVER_NAMESPACE diff --git a/charts/iperf3-monitor/values.yaml b/charts/iperf3-monitor/values.yaml index d2de952..2d31853 100644 --- a/charts/iperf3-monitor/values.yaml +++ b/charts/iperf3-monitor/values.yaml @@ -24,6 +24,9 @@ exporter: # -- Interval in seconds between complete test cycles (i.e., testing all server nodes). testInterval: 300 + # -- Log level for the iperf3 exporter (e.g., DEBUG, INFO, WARNING, ERROR, CRITICAL). + logLevel: INFO + # -- Timeout in seconds for a single iperf3 test run. testTimeout: 10