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

Dev argo cd metrics extension #1166

Merged
merged 8 commits into from
Oct 15, 2024
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
3 changes: 3 additions & 0 deletions .github/config/labeler.yml → .github/config/labeler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ ci-cd:
ansible-semaphore:
- changed-files:
- any-glob-to-any-file: 'charts/ansible-semaphore/*'
argocd-metrics-server:
- changed-files:
- any-glob-to-any-file: 'charts/argocd-metrics-server/*'
baserow:
- changed-files:
- any-glob-to-any-file: 'charts/baserow/*'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/chart-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
run : helm lint charts/*

chart-testing:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: checkout git repository
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ jobs:
- uses: actions/labeler@v5
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
configuration-path: ".github/config/labeler.yml"
configuration-path: ".github/config/labeler.yaml"
2 changes: 1 addition & 1 deletion .github/workflows/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
pre-commit:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand Down
59 changes: 30 additions & 29 deletions README.md

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions charts/argocd-metrics-server/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
20 changes: 20 additions & 0 deletions charts/argocd-metrics-server/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: v2
name: argocd-metrics-server
description: A Helm chart for installing the Argo CD Metrics Server, which connects to Prometheus and can be used to display Metrics in the Argo CD UI
type: application
version: 1.0.0
appVersion: "v1.0.3"
home: https://github.com/christianhuth/helm-charts
icon: https://icon.icepanel.io/Technology/svg/Argo-CD.svg
maintainers:
- name: christianhuth
email: [email protected]
sources:
- https://github.com/argoproj-labs/argocd-extension-metrics
annotations:
artifacthub.io/changes: |
- kind: added
description: Initial Commit
artifacthub.io/signKey: |
fingerprint: EE24F8BB6D099E78FD704F83B5ECDBCDDD485D0E
url: https://charts.christianhuth.de/public.key
130 changes: 130 additions & 0 deletions charts/argocd-metrics-server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# argocd-metrics-server

A Helm chart for installing the Argo CD Metrics Server, which connects to Prometheus and can be used to display Metrics in the Argo CD UI

## TL;DR;

```console
helm repo add christianhuth https://charts.christianhuth.de
helm repo update
helm install my-release christianhuth/argocd-metrics-server
```

## Introduction

This chart bootstraps the [ArgoCD Metrics Server](https://github.com/argoproj-labs/argocd-extension-metrics) on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.

## Prerequisites

- Kubernetes 1.19+
- Argo CD version 2.6+
- Prometheus

## Installing the Chart

To install the chart with the release name `my-release`:

```console
helm repo add christianhuth https://charts.christianhuth.de
helm repo update
helm install my-release christianhuth/argocd-metrics-server
```

These commands deploy the ArgoCD Metrics Server on the Kubernetes cluster in the default configuration. The [Values](#values) section lists the values that can be configured during installation.

> **Tip**: List all releases using `helm list`

## Uninstalling the Chart

To uninstall the `my-release` deployment:

```console
helm uninstall my-release
```

The command removes all the Kubernetes components associated with the chart and deletes the release.

## Values

| Key | Type | Default | Description |
| -------------------------------------- | ------ | ----------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| affinity | object | `{}` | Affinity settings for pod assignment |
| extraEnv | list | `[]` | additional environment variables to be added to the pods |
| fullnameOverride | string | `""` | String to fully override `"argocd-extension-metrics.fullname"` |
| image.pullPolicy | string | `"Always"` | image pull policy |
| image.registry | string | `"quay.io"` | image registory |
| image.repository | string | `"argoprojlabs/argocd-extension-metrics"` | image repository |
| image.tag | string | `"v1.0.3"` | Overrides the image tag |
| imagePullSecrets | list | `[]` | If defined, uses a Secret to pull an image from a private Docker registry or repository. |
| nameOverride | string | `""` | Provide a name in place of `argocd-extension-metrics` |
| networkPolicy.additionalAnnotations | object | `{}` | Annotations to be added to the NetworkPolicies |
| networkPolicy.additionalLabels | object | `{}` | Labels to be added to the NetworkPolicies |
| networkPolicy.argocd.enabled | bool | `true` | - allow incoming traffic from Argo CD |
| networkPolicy.argocd.namespaceSelector | object | `{}` | The labels of the namespace where Argo CD is running |
| networkPolicy.argocd.podSelector | object | `{}` | The labels of the Argo CD Pods |
| networkPolicy.dns.enabled | bool | `true` | allow outgoing traffic to the Kubernetes DNS |
| networkPolicy.dns.namespaceSelector | object | `{"kubernetes.io/metadata.name":"kube-system"}` | The labels of the namespace where the Kubernetes DNS is running |
| networkPolicy.dns.podSelector | object | `{"k8s-app":"kube-dns"}` | The labels of the Kubernetes DNS Pods |
| networkPolicy.enabled | bool | `false` | - create a NetworkPolicy resource to limit the allowed traffic |
| networkPolicy.prometheus.enabled | bool | `true` | - allow outgoing traffic to Prometheus |
| networkPolicy.prometheus.podSelector | object | `{"app.kubernetes.io/name":"prometheus"}` | The labels of the Prometheus Pods |
| nodeSelector | object | `{}` | Node labels for pod assignment |
| podSecurityContext | object | `{}` | pod-level security context |
| prometheus.namespace | string | `"monitoring"` | The namespace where Prometheus is running |
| prometheus.port | int | `9090` | The port on which the Prometheus service is listening for traffic |
| prometheus.service | string | `"prometheus-operated"` | The name of the Prometheus service |
| replicaCount | int | `1` | Number of replicas |
| resources | object | `{"requests":{"cpu":"100m","memory":"100Mi"}}` | Resource limits and requests for the controller pods. |
| revisionHistoryLimit | int | `0` | The number of old ReplicaSets to retain |
| securityContext | object | `{}` | container-level security context |
| service.port | int | `9003` | Kubernetes port where service is exposed |
| service.type | string | `"ClusterIP"` | Kubernetes service type |
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account |
| serviceAccount.create | bool | `true` | Specifies whether a service account should be created |
| serviceAccount.name | string | `""` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template |
| tolerations | list | `[]` | Toleration labels for pod assignment |

Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`.

Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,

```console
helm install my-release -f values.yaml christianhuth/argocd-metrics-server
```

# Configuring Argo CD

After a successful installation of the Argo CD Metrics Server you need to configure Argo CD to display Metrics in the UI.

Assuming you are using the official Argo CD Helm Chart, this can be achieved with the following values:

```yaml
configs:
# this part configures the UI extension to use the Argo CD Metrics Server
# make sure to adjust the URL to your installation
cm:
extension.config: |-
extensions:
- name: metrics
backend:
services:
- url: http://argocd-metrics-server.argo.svc:9003
# this part enables the proxy extension feature of Argo CD
params:
server.enable.proxy.extension: true
# this part authorizes users to use the Metrics extension
rbac:
policy.csv: |
p, role:readonly, extensions, invoke, metrics, allow
server:
# this part downloads the UI extension and integrates it into the Argo CD UI
extensions:
enabled: true
extensionList:
- name: extension-metrics
env:
- name: EXTENSION_URL
value: https://github.com/argoproj-labs/argocd-extension-metrics/releases/download/v1.0.3/extension.tar.gz
- name: EXTENSION_CHECKSUM_URL
value: https://github.com/argoproj-labs/argocd-extension-metrics/releases/download/v1.0.3/extension_checksums.txt
```
91 changes: 91 additions & 0 deletions charts/argocd-metrics-server/README.md.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{{ template "chart.header" . }}
{{ template "chart.description" . }}

## TL;DR;

```console
helm repo add christianhuth https://charts.christianhuth.de
helm repo update
helm install my-release christianhuth/argocd-metrics-server
```

## Introduction

This chart bootstraps the [ArgoCD Metrics Server](https://github.com/argoproj-labs/argocd-extension-metrics) on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.

## Prerequisites

- Kubernetes 1.19+
- Argo CD version 2.6+
- Prometheus

## Installing the Chart

To install the chart with the release name `my-release`:

```console
helm repo add christianhuth https://charts.christianhuth.de
helm repo update
helm install my-release christianhuth/argocd-metrics-server
```

These commands deploy the ArgoCD Metrics Server on the Kubernetes cluster in the default configuration. The [Values](#values) section lists the values that can be configured during installation.

> **Tip**: List all releases using `helm list`

## Uninstalling the Chart

To uninstall the `my-release` deployment:

```console
helm uninstall my-release
```

The command removes all the Kubernetes components associated with the chart and deletes the release.

{{ template "chart.valuesSection" . }}

Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`.

Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,

```console
helm install my-release -f values.yaml christianhuth/argocd-metrics-server
```

# Configuring Argo CD

After a successful installation of the Argo CD Metrics Server you need to configure Argo CD to display Metrics in the UI.

Assuming you are using the official Argo CD Helm Chart, this can be achieved with the following values:

```yaml
configs:
# this part configures the UI extension to use the Argo CD Metrics Server
# make sure to adjust the URL to your installation
cm:
extension.config: |-
extensions:
- name: metrics
backend:
services:
- url: http://argocd-metrics-server.argo.svc:9003
# this part enables the proxy extension feature of Argo CD
params:
server.enable.proxy.extension: true
# this part authorizes users to use the Metrics extension
rbac:
policy.csv: |
p, role:readonly, extensions, invoke, metrics, allow
server:
# this part downloads the UI extension and integrates it into the Argo CD UI
extensions:
enabled: true
extensionList:
- name: extension-metrics
env:
- name: EXTENSION_URL
value: https://github.com/argoproj-labs/argocd-extension-metrics/releases/download/v1.0.3/extension.tar.gz
- name: EXTENSION_CHECKSUM_URL
value: https://github.com/argoproj-labs/argocd-extension-metrics/releases/download/v1.0.3/extension_checksums.txt
```
62 changes: 62 additions & 0 deletions charts/argocd-metrics-server/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "argocd-metrics-server.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "argocd-metrics-server.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "argocd-metrics-server.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "argocd-metrics-server.labels" -}}
helm.sh/chart: {{ include "argocd-metrics-server.chart" . }}
{{ include "argocd-metrics-server.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "argocd-metrics-server.selectorLabels" -}}
app.kubernetes.io/name: {{ include "argocd-metrics-server.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "argocd-metrics-server.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "argocd-metrics-server.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
Loading
Loading