From 70466e8a8219413c98f118ce3ab37e2a91ccf266 Mon Sep 17 00:00:00 2001 From: josephbarnett Date: Wed, 11 Dec 2024 22:28:51 -0300 Subject: [PATCH 1/9] CP-24028: add scrape target for insights container --- charts/cloudzero-agent/templates/cm.yaml | 29 ++++++++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/charts/cloudzero-agent/templates/cm.yaml b/charts/cloudzero-agent/templates/cm.yaml index 3b063962..6fc2ab34 100644 --- a/charts/cloudzero-agent/templates/cm.yaml +++ b/charts/cloudzero-agent/templates/cm.yaml @@ -118,11 +118,30 @@ data: kubeconfig_file: "" follow_redirects: true enable_http2: true - {{- end }} - {{- if .Values.prometheusConfig.scrapeJobs.additionalScrapeJobs -}} - {{ toYaml .Values.prometheusConfig.scrapeJobs.additionalScrapeJobs | toString | nindent 6 }} - {{- end}} - {{- end}} + {{- end }} + {{- if .Values.insightsController.enabled }} + - job_name: '{{ include "cloudzero-agent.insightsController.server.webhookFullname" . }}' + metrics_path: /metrics + scheme: https + enable_compression: true + tls_config: + insecure_skip_verify: true + follow_redirects: true + enable_http2: true + kubernetes_sd_configs: + - role: endpoints + kubeconfig_file: "" + follow_redirects: true + enable_http2: true + relabel_configs: + - source_labels: [__meta_kubernetes_endpoints_name] + action: keep + regex: {{ include "cloudzero-agent.insightsController.server.webhookFullname" . }}-svc + {{- end }} + {{- if .Values.prometheusConfig.scrapeJobs.additionalScrapeJobs -}} + {{ toYaml .Values.prometheusConfig.scrapeJobs.additionalScrapeJobs | toString | nindent 6 }} + {{- end}} + {{- end}} remote_write: - url: 'https://{{ include "cloudzero-agent.cleanString" .Values.host }}/v1/container-metrics?cluster_name={{ include "cloudzero-agent.cleanString" .Values.clusterName | urlquery }}&cloud_account_id={{ include "cloudzero-agent.cleanString" .Values.cloudAccountId | urlquery }}®ion={{ include "cloudzero-agent.cleanString" .Values.region | urlquery }}' authorization: From 7d3952c5ffe55e475129828735ff599e8f934656 Mon Sep 17 00:00:00 2001 From: josephbarnett Date: Wed, 11 Dec 2024 22:31:41 -0300 Subject: [PATCH 2/9] update insights release version --- charts/cloudzero-agent/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/cloudzero-agent/values.yaml b/charts/cloudzero-agent/values.yaml index ed9b49ba..ba3719fd 100644 --- a/charts/cloudzero-agent/values.yaml +++ b/charts/cloudzero-agent/values.yaml @@ -159,7 +159,7 @@ insightsController: replicaCount: 3 image: repository: ghcr.io/cloudzero/cloudzero-insights-controller/cloudzero-insights-controller - tag: 0.0.2 + tag: 0.0.3 pullPolicy: Always tls: enabled: true From 09e501686041777d14603b8a661fb056056ec28b Mon Sep 17 00:00:00 2001 From: josephbarnett Date: Thu, 12 Dec 2024 12:10:22 -0300 Subject: [PATCH 3/9] add additional instructions for helm update --- charts/cloudzero-agent/README.md | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/charts/cloudzero-agent/README.md b/charts/cloudzero-agent/README.md index 63084c53..402969aa 100644 --- a/charts/cloudzero-agent/README.md +++ b/charts/cloudzero-agent/README.md @@ -17,14 +17,36 @@ For the latest release, see [Releases](https://github.com/Cloudzero/cloudzero-ch ## Installation -### Get Helm Repository Info +### Adding Helm Repository Information + +To use the chart or a beta version, you must add the repository to Helm. Refer to the [`helm repo`](https://helm.sh/docs/helm/helm_repo/) documentation for command details. + +#### 1. Add the Helm Chart Repository ```console helm repo add cloudzero https://cloudzero.github.io/cloudzero-charts -helm repo update ``` +> Note: If you intend to use a beta version, refer to the [beta installation document](./BETA-INSTALLATION.md) for the appropriate channel. + +#### 2. Add Repository Dependencies + +**Cert Manager** +```console +helm repo add cert-manager https://charts.jetstack.io +``` + +**Metrics Exporter** +```console +helm repo add prometheus-community https://prometheus-community.github.io/helm-charts +``` + +#### 3. Update the Helm Repositories + +Ensure that the most recent chart versions are available: -_See [`helm repo`](https://helm.sh/docs/helm/helm_repo/) for command documentation._ +```console +helm repo update +``` ### Install Helm Chart @@ -53,7 +75,7 @@ Alternatively, [install the cert-manager CRDs directly](https://cert-manager.io/ ```console kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.16.2/cert-manager.yaml ``` -Alternatively, [install the cert-manager CRDs directly](https://cert-manager.io/docs/installation/helm/). + 3. Fill out all required fields in the `configuration.example.yaml` file in this directory. Rename the file as necessary. Below is an example of a completed configuration file: ```yaml From 196981f2423cef443da2eadd11ef79d8bbdb40cd Mon Sep 17 00:00:00 2001 From: josephbarnett Date: Thu, 12 Dec 2024 12:19:58 -0300 Subject: [PATCH 4/9] add next release note --- charts/cloudzero-agent/docs/releases/1.0.4-beta.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 charts/cloudzero-agent/docs/releases/1.0.4-beta.md diff --git a/charts/cloudzero-agent/docs/releases/1.0.4-beta.md b/charts/cloudzero-agent/docs/releases/1.0.4-beta.md new file mode 100644 index 00000000..b2ffc01d --- /dev/null +++ b/charts/cloudzero-agent/docs/releases/1.0.4-beta.md @@ -0,0 +1,13 @@ +## [1.0.4-beta](https://github.com/Cloudzero/cloudzero-agent/compare/v1.0.1-beta...v1.0.4-beta) (2024-12-12) + +The Insights controller now exposes a Prometheus Metrics endpoint to enable monitoring of the insights controller operations by CloudZero. + +### Upgrade Steps +* Upgrade with: +```sh +helm upgrade --install cloudzero-beta/cloudzero-agent -n --create-namespace -f configuration.example.yaml --version 1.0.4-beta +``` +See the [beta installation instructions](https://github.com/Cloudzero/cloudzero-charts/blob/develop/charts/cloudzero-agent/BETA-INSTALLATION.md) for further detail + +### Improvements +* Add insights controller scrape configuration enabling operational monitoring. More information on [available statistics in the insights controller documentation](https://github.com/Cloudzero/cloudzero-insights-controller/blob/develop/docs/statistics.md). From fcde3b943758fd07bfe2e95e84ed6778f77733e4 Mon Sep 17 00:00:00 2001 From: josephbarnett Date: Thu, 12 Dec 2024 12:29:01 -0300 Subject: [PATCH 5/9] improve rel note language --- charts/cloudzero-agent/docs/releases/1.0.4-beta.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/charts/cloudzero-agent/docs/releases/1.0.4-beta.md b/charts/cloudzero-agent/docs/releases/1.0.4-beta.md index b2ffc01d..72690d6b 100644 --- a/charts/cloudzero-agent/docs/releases/1.0.4-beta.md +++ b/charts/cloudzero-agent/docs/releases/1.0.4-beta.md @@ -1,13 +1,13 @@ ## [1.0.4-beta](https://github.com/Cloudzero/cloudzero-agent/compare/v1.0.1-beta...v1.0.4-beta) (2024-12-12) -The Insights controller now exposes a Prometheus Metrics endpoint to enable monitoring of the insights controller operations by CloudZero. +The Insights controller now exposes a Prometheus Metrics endpoint, enabling CloudZero to monitor its operations. ### Upgrade Steps * Upgrade with: ```sh helm upgrade --install cloudzero-beta/cloudzero-agent -n --create-namespace -f configuration.example.yaml --version 1.0.4-beta ``` -See the [beta installation instructions](https://github.com/Cloudzero/cloudzero-charts/blob/develop/charts/cloudzero-agent/BETA-INSTALLATION.md) for further detail +For more details, see the [beta installation instructions](https://github.com/Cloudzero/cloudzero-charts/blob/develop/charts/cloudzero-agent/BETA-INSTALLATION.md). ### Improvements -* Add insights controller scrape configuration enabling operational monitoring. More information on [available statistics in the insights controller documentation](https://github.com/Cloudzero/cloudzero-insights-controller/blob/develop/docs/statistics.md). +* Added insights controller scrape configuration for operational monitoring. More information is available in the [insights controller documentation](https://github.com/Cloudzero/cloudzero-insights-controller/blob/develop/docs/statistics.md). From 1ed333369a42704354ac724feb610c6fd56296af Mon Sep 17 00:00:00 2001 From: josephbarnett Date: Thu, 12 Dec 2024 12:40:49 -0300 Subject: [PATCH 6/9] allow for specific naming instead of auto-incrementing versions --- .../build-and-publish-beta-chart.yml | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build-and-publish-beta-chart.yml b/.github/workflows/build-and-publish-beta-chart.yml index f7833384..e100445b 100644 --- a/.github/workflows/build-and-publish-beta-chart.yml +++ b/.github/workflows/build-and-publish-beta-chart.yml @@ -5,9 +5,8 @@ on: workflow_dispatch: inputs: version: - description: 'Version to use for the release (beta suffix will be automatically appended (e.g. "0.0.1" + "-beta"))' - required: false - default: '' + description: 'Version to use for the release. Must contain "beta" (e.g. "0.0.1-beta").' + required: true branch: description: 'Branch to use for the release' required: true @@ -54,18 +53,18 @@ jobs: - name: Package Cloudzero Agent Chart run: helm package charts/cloudzero-agent/ --destination .deploy - # Step 3: Determine Version - - name: Get Github Tag Version - id: version - uses: flatherskevin/semver-action@v1 - with: - incrementLevel: patch - source: tags - - - name: Determine Chart Version + # Step 3: Validate and Set Version + - name: Validate Input Version run: | - NEW_VERSION=${{ github.event.inputs.version || steps.version.outputs.nextVersion }} - echo "NEW_VERSION=$NEW_VERSION-beta" >> $GITHUB_ENV + if [[ -z "${{ github.event.inputs.version }}" ]]; then + echo "Version input is required." + exit 1 + fi + if [[ "${{ github.event.inputs.version }}" != *"beta"* ]]; then + echo "Version must contain 'beta'. Provided version: ${{ github.event.inputs.version }}" + exit 1 + fi + echo "NEW_VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV - name: Update Chart Version run: | @@ -128,7 +127,6 @@ jobs: - name: Save Index in GH Pages run: | - # copy the new chart and index.yaml git add beta git commit -m "Updating ${{ env.NEW_VERSION }} Index" git push origin gh-pages From 936550d8c38e0e79863e7c18f5b10f3f05939c1f Mon Sep 17 00:00:00 2001 From: josephbarnett Date: Thu, 12 Dec 2024 12:44:15 -0300 Subject: [PATCH 7/9] fix release notes --- charts/cloudzero-agent/README.md | 1 + .../docs/releases/{1.0.4-beta.md => 1.0.0-beta-4.md} | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) rename charts/cloudzero-agent/docs/releases/{1.0.4-beta.md => 1.0.0-beta-4.md} (83%) diff --git a/charts/cloudzero-agent/README.md b/charts/cloudzero-agent/README.md index 402969aa..32ae5a1d 100644 --- a/charts/cloudzero-agent/README.md +++ b/charts/cloudzero-agent/README.md @@ -76,6 +76,7 @@ Alternatively, [install the cert-manager CRDs directly](https://cert-manager.io/ kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.16.2/cert-manager.yaml ``` +Alternatively, [install the cert-manager CRDs directly](https://cert-manager.io/docs/installation/helm/). 3. Fill out all required fields in the `configuration.example.yaml` file in this directory. Rename the file as necessary. Below is an example of a completed configuration file: ```yaml diff --git a/charts/cloudzero-agent/docs/releases/1.0.4-beta.md b/charts/cloudzero-agent/docs/releases/1.0.0-beta-4.md similarity index 83% rename from charts/cloudzero-agent/docs/releases/1.0.4-beta.md rename to charts/cloudzero-agent/docs/releases/1.0.0-beta-4.md index 72690d6b..ce5dd0d5 100644 --- a/charts/cloudzero-agent/docs/releases/1.0.4-beta.md +++ b/charts/cloudzero-agent/docs/releases/1.0.0-beta-4.md @@ -1,11 +1,11 @@ -## [1.0.4-beta](https://github.com/Cloudzero/cloudzero-agent/compare/v1.0.1-beta...v1.0.4-beta) (2024-12-12) +## [1.0.0-beta-4](https://github.com/Cloudzero/cloudzero-agent/compare/v1.0.1-beta...v1.0.0-beta-4) (2024-12-12) The Insights controller now exposes a Prometheus Metrics endpoint, enabling CloudZero to monitor its operations. ### Upgrade Steps * Upgrade with: ```sh -helm upgrade --install cloudzero-beta/cloudzero-agent -n --create-namespace -f configuration.example.yaml --version 1.0.4-beta +helm upgrade --install cloudzero-beta/cloudzero-agent -n --create-namespace -f configuration.example.yaml --version 1.0.0-beta-1 ``` For more details, see the [beta installation instructions](https://github.com/Cloudzero/cloudzero-charts/blob/develop/charts/cloudzero-agent/BETA-INSTALLATION.md). From b4cb56968b76fd0ac47193c5b7c8623ed0cab46d Mon Sep 17 00:00:00 2001 From: josephbarnett Date: Thu, 12 Dec 2024 12:46:40 -0300 Subject: [PATCH 8/9] give job a static name --- charts/cloudzero-agent/templates/cm.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/cloudzero-agent/templates/cm.yaml b/charts/cloudzero-agent/templates/cm.yaml index 6fc2ab34..35f93d00 100644 --- a/charts/cloudzero-agent/templates/cm.yaml +++ b/charts/cloudzero-agent/templates/cm.yaml @@ -120,7 +120,7 @@ data: enable_http2: true {{- end }} {{- if .Values.insightsController.enabled }} - - job_name: '{{ include "cloudzero-agent.insightsController.server.webhookFullname" . }}' + - job_name: cloudzero-insights-controller-job metrics_path: /metrics scheme: https enable_compression: true From d287cd9822856ace005983ec0f0f844a54c3c6ae Mon Sep 17 00:00:00 2001 From: josephbarnett Date: Thu, 12 Dec 2024 12:48:20 -0300 Subject: [PATCH 9/9] remove duplicate line --- charts/cloudzero-agent/README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/charts/cloudzero-agent/README.md b/charts/cloudzero-agent/README.md index 32ae5a1d..8881458d 100644 --- a/charts/cloudzero-agent/README.md +++ b/charts/cloudzero-agent/README.md @@ -76,8 +76,6 @@ Alternatively, [install the cert-manager CRDs directly](https://cert-manager.io/ kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.16.2/cert-manager.yaml ``` -Alternatively, [install the cert-manager CRDs directly](https://cert-manager.io/docs/installation/helm/). - 3. Fill out all required fields in the `configuration.example.yaml` file in this directory. Rename the file as necessary. Below is an example of a completed configuration file: ```yaml # -- Account ID of the account the cluster is running in. This must be a string - even if it is a number in your system.