Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CP 24028 add insights controller scape config #120

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 13 additions & 15 deletions .github/workflows/build-and-publish-beta-chart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: |
Expand Down Expand Up @@ -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
Expand Down
29 changes: 25 additions & 4 deletions charts/cloudzero-agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

_See [`helm repo`](https://helm.sh/docs/helm/helm_repo/) for command documentation._
**Metrics Exporter**
```console
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
josephbarnett marked this conversation as resolved.
Show resolved Hide resolved
```

#### 3. Update the Helm Repositories

Ensure that the most recent chart versions are available:

```console
helm repo update
```

### Install Helm Chart

Expand Down Expand Up @@ -53,7 +75,6 @@ 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/).

josephbarnett marked this conversation as resolved.
Show resolved Hide resolved
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
Expand Down
13 changes: 13 additions & 0 deletions charts/cloudzero-agent/docs/releases/1.0.0-beta-4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## [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 <RELEASE_NAME> cloudzero-beta/cloudzero-agent -n <NAMESPACE> --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).

### Improvements
* 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).
29 changes: 24 additions & 5 deletions charts/cloudzero-agent/templates/cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: cloudzero-insights-controller-job
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 }}&region={{ include "cloudzero-agent.cleanString" .Values.region | urlquery }}'
authorization:
Expand Down
2 changes: 1 addition & 1 deletion charts/cloudzero-agent/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading