Skip to content

Commit

Permalink
Merge branch 'main' into add-override-exporter-deployment
Browse files Browse the repository at this point in the history
Signed-off-by: MH <zanhsieh@gmail.com>
  • Loading branch information
zanhsieh authored Dec 19, 2024
2 parents b6a4bae + e4329f8 commit 4814cc6
Show file tree
Hide file tree
Showing 162 changed files with 3,139 additions and 470 deletions.
7 changes: 4 additions & 3 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
# Unless a later match takes precedence, they will be requested for review when someone opens a pull request.
* @grafana/helm-charts-admins

/charts/grafana/ @maorfr @torstenwalter @Xtigyro @zanhsieh
/charts/grafana/ @jkroepke @maorfr @torstenwalter @Xtigyro @zanhsieh
/charts/loki-distributed/ @grafana/loki-squad @unguiculus @Whyeasy
/charts/loki-canary/ @grafana/loki-squad @unguiculus @Whyeasy
/charts/promtail/ @grafana/loki-squad @unguiculus @Whyeasy
/charts/tempo/ @grafana/tempo @dgzlopes @swartz-k @BitProcessor @faustodavid
/charts/tempo-distributed/ @grafana/tempo @mapno @swartz-k @BitProcessor @faustodavid
/charts/tempo/ @grafana/tempo @Sheikh-Abubaker @dgzlopes @swartz-k @BitProcessor @faustodavid
/charts/tempo-distributed/ @grafana/tempo @Sheikh-Abubaker @mapno @swartz-k @BitProcessor @faustodavid
/charts/enterprise-metrics/ @grafana/mimir-maintainers
/charts/rollout-operator/ @grafana/mimir-maintainers
/charts/enterprise-logs/ @grafana/loki-squad
/charts/tempo-vulture/ @grafana/tempo @Whyeasy @dgzlopes
/charts/synthetic-monitoring-agent/ @torstenwalter @zanhsieh
/charts/agent-operator/ @grafana/grafana-agent-maintainers
2 changes: 1 addition & 1 deletion .github/workflows/check-codeowners.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: install yq
run: |
sudo snap install yq
Expand Down
27 changes: 22 additions & 5 deletions .github/workflows/lint-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v1
uses: azure/setup-helm@v4
with:
version: ${{ inputs.helm_version }}

# Python is required because `ct lint` runs Yamale (https://github.com/23andMe/Yamale) and
# yamllint (https://github.com/adrienverge/yamllint) which require Python
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: 3.7
python-version: 3.12

- name: Set up chart-testing
uses: helm/chart-testing-action@v2.1.0
Expand All @@ -59,7 +59,7 @@ jobs:
run: |
changed=$(ct list-changed --config "${CT_CONFIGFILE}")
if [[ -n "$changed" ]]; then
echo "::set-output name=changed::true"
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Run chart-testing (lint)
Expand All @@ -72,6 +72,23 @@ jobs:
kubectl_version: ${{ inputs.kind_kubectl_version }}
node_image: ${{ inputs.kind_node_image }}

- name: Check Kubernetes version and apply Gateway API CRDs
if: steps.list-changed.outputs.changed == 'true'
run: |
# Get Kubernetes version and extract the major.minor version
version=$(kubectl version -o json | jq -r '.serverVersion.major + "." + .serverVersion.minor' | tr -d '+')
major_version=$(echo $version | cut -d. -f1)
minor_version=$(echo $version | cut -d. -f2)
# Compare version with 1.23. The gateway CRDs use x-kubernetes-validations, which is only supported from 1.23 onwards.
if [ "$major_version" -eq 1 ] && [ "$minor_version" -ge 23 ] || [ "$major_version" -gt 1 ]; then
echo "Kubernetes version $version >= 1.23, applying Gateway API CRDs"
kubectl apply -k https://github.com/kubernetes-sigs/gateway-api/config/crd
else
echo "Kubernetes version $version < 1.23, skipping Gateway API CRDs installation"
echo "Please use an older version of Gateway API CRDs or upgrade your Kubernetes version"
fi
- name: Run chart-testing (install)
run: |
changed=$(ct list-changed --config "${CT_CONFIGFILE}")
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Check Docs
run: |
Expand Down
17 changes: 11 additions & 6 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -25,7 +25,7 @@ jobs:
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Set up Helm
uses: azure/setup-helm@v3.5
uses: azure/setup-helm@v4
with:
version: v3.12.0

Expand All @@ -47,14 +47,19 @@ jobs:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
CR_SKIP_EXISTING: "true"

- name: Login to GHCR
uses: docker/login-action@v3.0.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push charts to GHCR
run: |
shopt -s nullglob
for pkg in .cr-release-packages/*; do
for pkg in .cr-release-packages/*.tgz; do
if [ -z "${pkg:-}" ]; then
break
fi
if ! helm push "${pkg}" "oci://ghcr.io/${GITHUB_REPOSITORY_OWNER}/charts"; then
echo '::warning:: helm push failed!'
fi
helm push "${pkg}" "oci://ghcr.io/${GITHUB_REPOSITORY_OWNER}/helm-charts"
done
4 changes: 2 additions & 2 deletions .github/workflows/sync-readme.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- run: |
cp -f README.md ${{ runner.temp }}/README.md
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
ref: gh-pages
- run: |
Expand Down
74 changes: 46 additions & 28 deletions .github/workflows/update-helm-repo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
chartpath: ${{ steps.list-changed.outputs.chartpath }}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
path: source
Expand Down Expand Up @@ -79,20 +79,23 @@ jobs:
if [ $(git tag -l "${name}-${version}") ]; then
echo "Tag ${tagname} already exists, skipping release"
echo "::set-output name=changed::false"
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "Releasing ${changed}"
echo "::set-output name=changed::true"
echo "::set-output name=chartpath::${changed}"
echo "changed=true" >> $GITHUB_OUTPUT
echo "chartpath=${changed}" >> $GITHUB_OUTPUT
fi
else
echo "No charts have changed, skipping release"
echo "::set-output name=changed::false"
echo "changed=false" >> $GITHUB_OUTPUT
fi
release:
needs: [ setup ]
needs: [setup]
runs-on: ubuntu-latest
permissions:
contents: write # allows GITHUB_TOKEN to push chart release, create release, and push tags to github
packages: write # allows GITHUB_TOKEN to push package to ghcr
env:
github_app_id: ${{ secrets.github_app_id }}
if: needs.setup.outputs.changed == 'true'
Expand All @@ -114,7 +117,7 @@ jobs:
fi
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
path: source
Expand All @@ -127,7 +130,7 @@ jobs:
- name: Checkout helm-charts
# The cr tool only works if the target repository is already checked out
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
repository: grafana/helm-charts
Expand All @@ -141,22 +144,9 @@ jobs:
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Install Helm
uses: azure/setup-helm@v1
uses: azure/setup-helm@v4
with:
version: v3.5.2

- name: Add dependency chart repos
# Todo replace this by https://github.com/grafana/helm-charts/issues/1534
run: |
helm repo add elastic https://helm.elastic.co
helm repo add grafana https://grafana.github.io/helm-charts
helm repo add prometheus https://prometheus-community.github.io/helm-charts
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo add bitnami-pre-2022 https://raw.githubusercontent.com/bitnami/charts/eb5f9a9513d987b519f0ecd732e7031241c50328/bitnami
helm repo add hashicorp https://helm.releases.hashicorp.com
helm repo add minio-new https://charts.min.io
helm repo add jetstack https://charts.jetstack.io
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
version: v3.16.2

- name: Parse Chart.yaml
id: parse-chart
Expand All @@ -166,14 +156,29 @@ jobs:
description=$(yq ".description" < ${changed}/Chart.yaml)
name=$(yq ".name" < ${changed}/Chart.yaml)
version=$(yq ".version" < ${changed}/Chart.yaml)
echo "::set-output name=chartpath::${changed}"
echo "::set-output name=desc::${description}"
echo "chartpath=${changed}" >> $GITHUB_OUTPUT
echo "desc=${description}" >> $GITHUB_OUTPUT
if [[ -n "${HELM_TAG_PREFIX}" ]]; then
echo "::set-output name=tagname::${HELM_TAG_PREFIX}-${name}-${version}"
echo "tagname=${HELM_TAG_PREFIX}-${name}-${version}" >> $GITHUB_OUTPUT
else
echo "::set-output name=tagname::${name}-${version}"
echo "tagname=${name}-${version}" >> $GITHUB_OUTPUT
fi
echo "::set-output name=packagename::${name}-${version}"
echo "packagename=${name}-${version}" >> $GITHUB_OUTPUT
- name: Add dependency chart repos
run: |
cd source
# Skip the header line and make sure that tabs are expanded into spaces
deps=$(helm dependency list "${{ steps.parse-chart.outputs.chartpath }}" | tail +2 | expand)
while read -r row; do
IFS=' ' read -ra parts <<< "$row"
name="${parts[0]}"
repo="${parts[2]}"
case "$repo" in
"https://"*) helm repo add "$name" "$repo" ;;
*) echo >&2 "Skipping dependency $name: unsupported schema for \"$repo\"" ;;
esac
done <<< "$deps"
- name: Install CR tool
run: |
Expand Down Expand Up @@ -223,3 +228,16 @@ jobs:
run: |
cd helm-charts
"${CR_TOOL_PATH}/cr" index --config "${CR_CONFIGFILE}" --token "${{ env.AUTHTOKEN }}" --index-path "${CR_INDEX_PATH}" --package-path "${CR_PACKAGE_PATH}" --push
- name: Login to GHCR
uses: docker/login-action@v3.0.0
with:
registry: ghcr.io
username: ${{ github.actor }}
# GitHub App installation token cannot push package to the org's package registry;
# using GITHUB_TOKEN here instead to avoid using PAT.
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push charts to GHCR
run: |
helm push "${{ env.CR_PACKAGE_PATH }}/${{ steps.parse-chart.outputs.packagename }}.tgz" "oci://ghcr.io/${GITHUB_REPOSITORY_OWNER}/helm-charts"
2 changes: 1 addition & 1 deletion .github/workflows/validate-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
10 changes: 5 additions & 5 deletions charts/agent-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ apiVersion: v2
name: grafana-agent-operator
description: A Helm chart for Grafana Agent Operator
type: application
version: 0.3.19
appVersion: "0.40.3"
home: https://grafana.com/docs/agent/v0.40/
icon: https://raw.githubusercontent.com/grafana/agent/v0.40.3/docs/sources/assets/logo_and_name.png
version: 0.5.0
appVersion: "0.43.3"
home: https://grafana.com/docs/agent/v0.43/
icon: https://raw.githubusercontent.com/grafana/agent/v0.43.3/docs/sources/assets/logo_and_name.png
sources:
- https://github.com/grafana/agent/tree/v0.40.3/pkg/operator
- https://github.com/grafana/agent/tree/v0.43.3/static/operator
maintainers:
- name: Grafana Agent Team
email: grafana-agent-team@googlegroups.com
10 changes: 7 additions & 3 deletions charts/agent-operator/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# grafana-agent-operator

![Version: 0.3.19](https://img.shields.io/badge/Version-0.3.19-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.40.3](https://img.shields.io/badge/AppVersion-0.40.3-informational?style=flat-square)
![Version: 0.5.0](https://img.shields.io/badge/Version-0.5.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.43.3](https://img.shields.io/badge/AppVersion-0.43.3-informational?style=flat-square)

A Helm chart for Grafana Agent Operator

⚠️ **Please create issues relating to this Helm chart in the [Agent](https://github.com/grafana/agent/issues) repo.**

## Source Code

* <https://github.com/grafana/agent/tree/v0.40.3/pkg/operator>
* <https://github.com/grafana/agent/tree/v0.43.3/static/operator>

Note that this chart does not provision custom resources like `GrafanaAgent` and `MetricsInstance` (formerly `PrometheusInstance`) or any `*Monitor` resources.

Expand Down Expand Up @@ -58,12 +58,13 @@ A major chart version change (like v1.2.3 -> v2.0.0) indicates that there is an
| containerSecurityContext | object | `{}` | Container security context (allowPrivilegeEscalation, etc.) |
| extraArgs | list | `[]` | List of additional cli arguments to configure agent-operator (example: `--log.level`) |
| fullnameOverride | string | `""` | Overrides the chart's computed fullname |
| global.commonLabels | object | `{}` | Common labels for all object directly managed by this chart. |
| hostAliases | list | `[]` | hostAliases to add |
| image.pullPolicy | string | `"IfNotPresent"` | Image pull policy |
| image.pullSecrets | list | `[]` | Image pull secrets |
| image.registry | string | `"docker.io"` | Image registry |
| image.repository | string | `"grafana/agent-operator"` | Image repo |
| image.tag | string | `"v0.40.3"` | Image tag |
| image.tag | string | `"v0.43.3"` | Image tag |
| kubeletService | object | `{"namespace":"default","serviceName":"kubelet"}` | If both are set, Agent Operator will create and maintain a service for scraping kubelets https://grafana.com/docs/agent/latest/operator/getting-started/#monitor-kubelets |
| nameOverride | string | `""` | Overrides the chart's name |
| nodeSelector | object | `{}` | nodeSelector configuration |
Expand All @@ -75,4 +76,7 @@ A major chart version change (like v1.2.3 -> v2.0.0) indicates that there is an
| resources | object | `{}` | Resource limits and requests config |
| serviceAccount.create | bool | `true` | Toggle to create ServiceAccount |
| serviceAccount.name | string | `nil` | Service account name |
| test.image.registry | string | `"docker.io"` | Test image registry |
| test.image.repository | string | `"library/busybox"` | Test image repo |
| test.image.tag | string | `"latest"` | Test image tag |
| tolerations | list | `[]` | Tolerations applied to Pods |
3 changes: 3 additions & 0 deletions charts/agent-operator/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- if .Values.customLabels }}
{{ toYaml .Values.customLabels }}
{{- end }}
{{- with .Values.global.commonLabels }}
{{ toYaml . }}
{{- end }}
{{- end }}

{{/*
Expand Down
1 change: 1 addition & 0 deletions charts/agent-operator/templates/operator-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "ga-operator.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{ include "ga-operator.labels" . | indent 4 }}
{{- with .Values.annotations }}
Expand Down
4 changes: 2 additions & 2 deletions charts/agent-operator/templates/tests/test-grafanaagent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@ metadata:
spec:
containers:
- name: busybox
image: busybox
image: "{{ .Values.test.image.registry }}/{{ .Values.test.image.repository }}:{{ .Values.test.image.tag }}"
command: ['wget']
args: ['grafana-agent-test-operated:8080/-/healthy']
# Wait for GrafanaAgent CR
initContainers:
- name: sleep
image: busybox
image: "{{ .Values.test.image.registry }}/{{ .Values.test.image.repository }}:{{ .Values.test.image.tag }}"
command: ['sleep', '60']
restartPolicy: Never
Loading

0 comments on commit 4814cc6

Please sign in to comment.