From e2988614bf611699e54d2c87a64dc5459cc725f5 Mon Sep 17 00:00:00 2001 From: Ilia Medvedev Date: Tue, 2 Jul 2024 09:28:21 +0300 Subject: [PATCH] add release drafter workflow and add badge to readme, add tests --- .e2e/chainsaw-tests.yaml | 26 +++++++++++++++++++ .e2e/vcluster-resources.yaml | 15 +++++++++++ .github/release-drafter.yaml | 38 ++++++++++++++++++++++++++++ .github/workflows/draft-release.yaml | 19 ++++++++++++++ README.md | 4 ++- 5 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 .github/release-drafter.yaml create mode 100644 .github/workflows/draft-release.yaml diff --git a/.e2e/chainsaw-tests.yaml b/.e2e/chainsaw-tests.yaml index c3897ed..64530d4 100644 --- a/.e2e/chainsaw-tests.yaml +++ b/.e2e/chainsaw-tests.yaml @@ -25,6 +25,32 @@ spec: --- apiVersion: chainsaw.kyverno.io/v1alpha1 kind: Test +metadata: + name: sm-without-ns-selector +spec: + steps: + - try: + - assert: + resource: + apiVersion: monitoring.coreos.com/v1 + kind: ServiceMonitor + metadata: + name: sm-without-ns-selector-x-default-x-vcluster + namespace: default + spec: + namespaceSelector: {} + selector: + # Resources are deployed to default namespace of vcluster + matchExpressions: + - key: vcluster.loft.sh/namespace + operator: In + values: + - default + matchLabels: + vcluster.loft.sh/label-vcluster-x-a172cedcae: example-app +--- +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test metadata: name: pm-with-ns-selector spec: diff --git a/.e2e/vcluster-resources.yaml b/.e2e/vcluster-resources.yaml index b46b344..ec9e708 100644 --- a/.e2e/vcluster-resources.yaml +++ b/.e2e/vcluster-resources.yaml @@ -17,6 +17,21 @@ spec: - port: web --- apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: sm-without-ns-selector + namespace: default + labels: + team: frontend +spec: + namespaceSelector: {} + selector: + matchLabels: + app: example-app + endpoints: + - port: web +--- +apiVersion: monitoring.coreos.com/v1 kind: PodMonitor metadata: name: pm-with-ns-selector diff --git a/.github/release-drafter.yaml b/.github/release-drafter.yaml new file mode 100644 index 0000000..7563f5e --- /dev/null +++ b/.github/release-drafter.yaml @@ -0,0 +1,38 @@ +name-template: "v$RESOLVED_VERSION" +tag-template: "v$RESOLVED_VERSION" +categories: + - title: "🚀 Features" + labels: + - "feature" + - "enhancement" + - title: "🐛 Bug Fixes" + labels: + - "fix" + - "bugfix" + - "bug" + - title: "🧰 Maintenance" + label: "chore" +change-template: "- $TITLE @$AUTHOR (#$NUMBER)" +change-title-escapes: '\<*_&' +exclude-labels: + - "no-release" +version-resolver: + major: + labels: + - "major" + minor: + labels: + - "minor" + - "feature" + - "enhancement" + patch: + labels: + - "patch" + - "fix" + - "bugfix" + - "bug" + - "dependencies" + default: patch +template: | + ## Changes + $CHANGES diff --git a/.github/workflows/draft-release.yaml b/.github/workflows/draft-release.yaml new file mode 100644 index 0000000..a03879c --- /dev/null +++ b/.github/workflows/draft-release.yaml @@ -0,0 +1,19 @@ +name: Draft Release + +on: + push: + branches: + - main + pull_request: + types: [opened, reopened, synchronize] + +jobs: + update_release_draft: + runs-on: ubuntu-latest + steps: + - uses: release-drafter/release-drafter@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + publish: false + config-name: release-drafter.yaml diff --git a/README.md b/README.md index 0d79ca9..07d6303 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # vCluster Prometheus operator plugin +[![Codefresh build status]( https://g.codefresh.io/api/badges/pipeline/codefresh-inc/codefresh-contrib%2Fvcluster-prometheus-operator-plugin%2Fci?type=cf-1)]( https://g.codefresh.io/public/accounts/codefresh-inc/pipelines/new/667d09d7db9387f8b1294868) + This repository contains a [vCluster plugin](https://www.vcluster.com/docs/v0.19/advanced-topics/plugins-overview) that syncs [Prometheus operator](https://github.com/prometheus-operator/prometheus-operator) resources from virtual clusters to the host cluster. Currently only the very basic functionality is implemented so the plugin only supports syncing of `PodMonitor` and `ServiceMonitor` resources. This is to allow scraping of metrics from workloads running on virtual clusters from a signle Prometheus or Open Telemetry collector on the host (with [target allocator](https://github.com/open-telemetry/opentelemetry-operator/blob/main/cmd/otel-allocator/README.md) that supports Prometheus operator CRDs). @@ -9,4 +11,4 @@ This compatibility is required as Syncer arhitecture was overhauled by loft.sh i `v1` - Compatible with older versions of vCluster - latest confirmed & tested version is `0.16.4` -`v2` - Compatibe with vCluster version 0.20.0 which was the highest version at the time of writing. +`v2` - Compatibe with vCluster version `0.20.0-beta.9` which was the latest version at the time of writing.