1
0
mirror of synced 2026-03-01 11:16:56 +00:00

Compare commits

..

12 Commits

Author SHA1 Message Date
Stefan Prodan
9b3162495c Merge pull request #4069 from fluxcd/backport-4068-to-release/v2.0.x
[release/v2.0.x] Update dependencies
2023-07-11 15:05:53 +03:00
Stefan Prodan
61d85ff30e Update dependencies
- bump the APIs packages in tests
- bump golang crypto and term to latest

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
(cherry picked from commit bca1fa0968)
2023-07-11 11:51:37 +00:00
Stefan Prodan
2c199c66be Merge pull request #4067 from fluxcd/backport-4062-to-release/v2.0.x
[release/v2.0.x] diff: Take into account the server-side inventory for local Flux Kustomizations
2023-07-11 14:31:58 +03:00
Soule BA
5875aac92e Take into account the server-side inventory for local diff
If implemented users will be able to use a local kustomization file while
retrieving status from the live kustomization file.

Signed-off-by: Soule BA <soule@weave.works>
(cherry picked from commit 90d95988aa)
2023-07-11 11:09:48 +00:00
Stefan Prodan
dab51524be Merge pull request #4058 from fluxcd/backport-4057-to-release/v2.0.x
[release/v2.0.x] Update toolkit components
2023-07-10 15:46:02 +03:00
fluxcdbot
fb07dfee85 Update toolkit components
- kustomize-controller to v1.0.1
  https://github.com/fluxcd/kustomize-controller/blob/v1.0.1/CHANGELOG.md
- source-controller to v1.0.1
  https://github.com/fluxcd/source-controller/blob/v1.0.1/CHANGELOG.md
- image-reflector-controller to v0.29.1
  https://github.com/fluxcd/image-reflector-controller/blob/v0.29.1/CHANGELOG.md

Signed-off-by: GitHub <noreply@github.com>
(cherry picked from commit cfd4d285da)
2023-07-10 12:32:33 +00:00
Stefan Prodan
7842c7f2d6 Merge pull request #4048 from fluxcd/backport-4043-to-release/v2.0.x
[release/v2.0.x] ci: release: extract the image tag from GITHUB_REF
2023-07-06 11:36:31 +03:00
Stefan Prodan
b385c248b0 ci: release: extract the image tag from GITHUB_REF
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
(cherry picked from commit 36b39a50a4)
2023-07-06 08:11:20 +00:00
Stefan Prodan
a0929969ef Merge pull request #4047 from fluxcd/backport-4046-to-release/v2.0.x
[release/v2.0.x] ci: backport: set write permissions
2023-07-06 11:10:40 +03:00
Stefan Prodan
6b3580e16c ci: backport: set write permissions
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
(cherry picked from commit 625d865625)
2023-07-06 07:35:52 +00:00
Hidde Beydals
6cd7722539 Merge pull request #4042 from fluxcd/backport-4041-to-release/v2.0.x
[release/v2.0.x] ci: release: disable interpretation backslash esc
2023-07-05 17:40:42 +02:00
Hidde Beydals
71ea90524b ci: release: disable interpretation backslash esc
This ensures `jq` can properly parse the given `ARTIFACTS` JSON blob,
as it contains escaped newlines in for example the Brew formula.

This should address the issue with the generation of SLSA metadata.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
(cherry picked from commit 506da2466b)
2023-07-05 17:35:34 +02:00
8 changed files with 381 additions and 613 deletions

View File

@@ -1,29 +0,0 @@
name: test-gh-action
on:
pull_request:
paths:
- 'action/**'
push:
paths:
- 'action/**'
branches:
- 'main'
- 'release/**'
permissions: read-all
jobs:
actions:
strategy:
fail-fast: false
matrix:
version: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.version }}
name: action on ${{ matrix.version }}
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Setup flux
uses: ./action

View File

@@ -26,7 +26,7 @@ jobs:
**/go.sum
**/go.mod
- name: Setup Kubernetes
uses: helm/kind-action@dda0770415bac9fc20092cacbc54aa298604d140 # v1.8.0
uses: helm/kind-action@fa81e57adff234b2908110485695db0f181f3c67 # v1.7.0
with:
version: v0.20.0
cluster_name: kind

View File

@@ -30,7 +30,7 @@ jobs:
**/go.sum
**/go.mod
- name: Setup Kubernetes
uses: helm/kind-action@dda0770415bac9fc20092cacbc54aa298604d140 # v1.8.0
uses: helm/kind-action@fa81e57adff234b2908110485695db0f181f3c67 # v1.7.0
with:
version: v0.20.0
cluster_name: kind

View File

@@ -32,7 +32,7 @@ jobs:
uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2.2.0
- name: Setup Docker Buildx
id: buildx
uses: docker/setup-buildx-action@4c0219f9ac95b02789c1075625400b2acbff50b1 # v2.9.1
uses: docker/setup-buildx-action@16c0bc4a6e6ada2cfd8afd41d22d95379cf7c32a # v2.8.0
- name: Setup Syft
uses: anchore/sbom-action/download-syft@78fc58e266e87a38d4194b2137a3d4e9bcaf7ca1 # v0.14.3
- name: Setup Cosign

View File

@@ -1,22 +1,216 @@
# Flux GitHub Action
To install the latest Flux CLI on Linux, macOS or Windows GitHub runners:
Usage:
```yaml
steps:
- name: Setup Flux CLI
uses: fluxcd/flux2/action@main
with:
version: 'latest'
- name: Run Flux CLI
run: flux version --client
steps:
- name: Setup Flux CLI
uses: fluxcd/flux2/action@main
- name: Run Flux commands
run: flux -v
```
The Flux GitHub Action can be used to automate various tasks in CI, such as:
The latest stable version of the `flux` binary is downloaded from
GitHub [releases](https://github.com/fluxcd/flux2/releases)
and placed at `/usr/local/bin/flux`.
- [Automate Flux upgrades on clusters via Pull Requests](https://fluxcd.io/flux/flux-gh-action/#automate-flux-updates)
- [Push Kubernetes manifests to container registries](https://fluxcd.io/flux/flux-gh-action/#push-kubernetes-manifests-to-container-registries)
- [Run end-to-end testing with Flux and Kubernetes Kind](https://fluxcd.io/flux/flux-gh-action/#end-to-end-testing)
Note that this action can only be used on GitHub **Linux** runners.
You can change the arch (defaults to `amd64`) with:
For more information, please see the [Flux GitHub Action documentation](/flux/flux-gh-action.md).
```yaml
steps:
- name: Setup Flux CLI
uses: fluxcd/flux2/action@main
with:
arch: arm64 # can be amd64, arm64 or arm
```
You can download a specific version with:
```yaml
steps:
- name: Setup Flux CLI
uses: fluxcd/flux2/action@main
with:
version: 0.32.0
```
You can also authenticate against the GitHub API using GitHub Actions' `GITHUB_TOKEN` secret.
For more information, please [read about the GitHub token secret](https://docs.github.com/en/actions/security-guides/automatic-token-authentication#about-the-github_token-secret).
```yaml
steps:
- name: Setup Flux CLI
uses: fluxcd/flux2/action@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
```
This is useful if you are seeing failures on shared runners, those failures are usually API limits being hit.
### Automate Flux updates
Example workflow for updating Flux's components generated with `flux bootstrap --path=clusters/production`:
```yaml
name: update-flux
on:
workflow_dispatch:
schedule:
- cron: "0 * * * *"
permissions:
contents: write
pull-requests: write
jobs:
components:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Setup Flux CLI
uses: fluxcd/flux2/action@main
- name: Check for updates
id: update
run: |
flux install \
--export > ./clusters/production/flux-system/gotk-components.yaml
VERSION="$(flux -v)"
echo "flux_version=$VERSION" >> $GITHUB_OUTPUT
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: update-flux
commit-message: Update to ${{ steps.update.outputs.flux_version }}
title: Update to ${{ steps.update.outputs.flux_version }}
body: |
${{ steps.update.outputs.flux_version }}
```
### Push Kubernetes manifests to container registries
Example workflow for publishing Kubernetes manifests bundled as OCI artifacts to GitHub Container Registry:
```yaml
name: push-artifact-staging
on:
push:
branches:
- 'main'
permissions:
packages: write # needed for ghcr.io access
env:
OCI_REPO: "oci://ghcr.io/my-org/manifests/${{ github.event.repository.name }}"
jobs:
kubernetes:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Flux CLI
uses: fluxcd/flux2/action@main
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate manifests
run: |
kustomize build ./manifests/staging > ./deploy/app.yaml
- name: Push manifests
run: |
flux push artifact $OCI_REPO:$(git rev-parse --short HEAD) \
--path="./deploy" \
--source="$(git config --get remote.origin.url)" \
--revision="$(git branch --show-current)@sha1:$(git rev-parse HEAD)"
- name: Deploy manifests to staging
run: |
flux tag artifact $OCI_REPO:$(git rev-parse --short HEAD) --tag staging
```
### Push and sign Kubernetes manifests to container registries
Example workflow for publishing Kubernetes manifests bundled as OCI artifacts
which are signed with Cosign and GitHub OIDC:
```yaml
name: push-sign-artifact
on:
push:
branches:
- 'main'
permissions:
packages: write # needed for ghcr.io access
id-token: write # needed for keyless signing
env:
OCI_REPO: "oci://ghcr.io/my-org/manifests/${{ github.event.repository.name }}"
jobs:
kubernetes:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Flux CLI
uses: fluxcd/flux2/action@main
- name: Setup Cosign
uses: sigstore/cosign-installer@main
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push and sign manifests
run: |
digest_url=$(flux push artifact \
$OCI_REPO:$(git rev-parse --short HEAD) \
--path="./manifests" \
--source="$(git config --get remote.origin.url)" \
--revision="$(git branch --show-current)@sha1:$(git rev-parse HEAD)" |\
jq -r '. | .repository + "@" + .digest')
cosign sign $digest_url
```
### End-to-end testing
Example workflow for running Flux in Kubernetes Kind:
```yaml
name: e2e
on:
push:
branches:
- '*'
jobs:
kubernetes:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Flux CLI
uses: fluxcd/flux2/action@main
- name: Setup Kubernetes Kind
uses: engineerd/setup-kind@v0.5.0
- name: Install Flux in Kubernetes Kind
run: flux install
```
A complete e2e testing workflow is available here
[flux2-kustomize-helm-example](https://github.com/fluxcd/flux2-kustomize-helm-example/blob/main/.github/workflows/e2e.yaml)

View File

@@ -1,120 +1,64 @@
name: Setup Flux CLI
description: A GitHub Action for installing the Flux CLI
author: Flux project
description: A GitHub Action for running Flux commands
author: Stefan Prodan
branding:
color: blue
icon: command
inputs:
version:
description: "Flux version e.g. 2.0.0 (defaults to latest stable release)"
description: "Flux version e.g. 0.8.0 (defaults to latest stable release)"
required: false
arch:
description: "arch can be amd64, arm64 or arm"
required: false
deprecationMessage: "No longer required, action will now detect runner arch."
required: true
default: "amd64"
bindir:
description: "Alternative location for the Flux binary, defaults to path relative to $RUNNER_TOOL_CACHE."
description: "Optional location of the Flux binary. Will not use sudo if set. Updates System Path."
required: false
token:
description: "Token used to authentication against the GitHub.com API. Defaults to the token from the GitHub context of the workflow."
description: "GitHub Token used to authentication against the API (generally only needed to prevent quota limit errors)"
required: false
runs:
using: composite
steps:
- name: "Download the binary to the runner's cache dir"
- name: "Download flux binary to tmp"
shell: bash
run: |
ARCH=${{ inputs.arch }}
VERSION=${{ inputs.version }}
TOKEN=${{ inputs.token }}
if [[ -z "$TOKEN" ]]; then
TOKEN=${{ github.token }}
fi
if [[ -z "$VERSION" ]] || [[ "$VERSION" = "latest" ]]; then
VERSION=$(curl -fsSL -H "Authorization: token ${TOKEN}" https://api.github.com/repos/fluxcd/flux2/releases/latest | grep tag_name | cut -d '"' -f 4)
fi
if [[ -z "$VERSION" ]]; then
echo "Unable to determine Flux CLI version"
exit 1
fi
if [[ $VERSION = v* ]]; then
VERSION="${VERSION:1}"
fi
OS=$(echo "${RUNNER_OS}" | tr '[:upper:]' '[:lower:]')
if [[ "$OS" == "macos" ]]; then
OS="darwin"
fi
ARCH=$(echo "${RUNNER_ARCH}" | tr '[:upper:]' '[:lower:]')
if [[ "$ARCH" == "x64" ]]; then
ARCH="amd64"
elif [[ "$ARCH" == "x86" ]]; then
ARCH="386"
fi
FLUX_EXEC_FILE="flux"
if [[ "$OS" == "windows" ]]; then
FLUX_EXEC_FILE="${FLUX_EXEC_FILE}.exe"
fi
FLUX_TOOL_DIR=${{ inputs.bindir }}
if [[ -z "$FLUX_TOOL_DIR" ]]; then
FLUX_TOOL_DIR="${RUNNER_TOOL_CACHE}/flux2/${VERSION}/${OS}/${ARCH}"
fi
if [[ ! -x "$FLUX_TOOL_DIR/FLUX_EXEC_FILE" ]]; then
DL_DIR="$(mktemp -dt flux2-XXXXXX)"
trap 'rm -rf $DL_DIR' EXIT
echo "Downloading flux ${VERSION} for ${OS}/${ARCH}"
FLUX_TARGET_FILE="flux_${VERSION}_${OS}_${ARCH}.tar.gz"
if [[ "$OS" == "windows" ]]; then
FLUX_TARGET_FILE="flux_${VERSION}_${OS}_${ARCH}.zip"
fi
FLUX_CHECKSUMS_FILE="flux_${VERSION}_checksums.txt"
FLUX_DOWNLOAD_URL="https://github.com/fluxcd/flux2/releases/download/v${VERSION}/"
curl -fsSL -o "$DL_DIR/$FLUX_TARGET_FILE" "$FLUX_DOWNLOAD_URL/$FLUX_TARGET_FILE"
curl -fsSL -o "$DL_DIR/$FLUX_CHECKSUMS_FILE" "$FLUX_DOWNLOAD_URL/$FLUX_CHECKSUMS_FILE"
echo "Verifying checksum"
sum=""
if command -v openssl > /dev/null; then
sum=$(openssl sha256 "$DL_DIR/$FLUX_TARGET_FILE" | awk '{print $2}')
elif command -v sha256sum > /dev/null; then
sum=$(sha256sum "$DL_DIR/$FLUX_TARGET_FILE" | awk '{print $1}')
fi
if [[ -z "$sum" ]]; then
echo "Neither openssl nor sha256sum found. Cannot calculate checksum."
exit 1
fi
expected_sum=$(grep " $FLUX_TARGET_FILE\$" "$DL_DIR/$FLUX_CHECKSUMS_FILE" | awk '{print $1}')
if [ "$sum" != "$expected_sum" ]; then
echo "SHA sum of ${FLUX_TARGET_FILE} does not match. Aborting."
exit 1
fi
echo "Installing flux to ${FLUX_TOOL_DIR}"
mkdir -p "$FLUX_TOOL_DIR"
if [[ "$OS" == "windows" ]]; then
unzip "$DL_DIR/$FLUX_TARGET_FILE" "$FLUX_EXEC_FILE" -d "$FLUX_TOOL_DIR"
if [ -z "${VERSION}" ]; then
if [ -n "${TOKEN}" ]; then
VERSION_SLUG=$(curl https://api.github.com/repos/fluxcd/flux2/releases/latest --silent --location --header "Authorization: token ${TOKEN}" | grep tag_name)
else
tar xzf "$DL_DIR/$FLUX_TARGET_FILE" -C "$FLUX_TOOL_DIR" $FLUX_EXEC_FILE
# With no GITHUB_TOKEN you will experience occasional failures due to rate limiting
# Ref: https://github.com/fluxcd/flux2/issues/3509#issuecomment-1400820992
VERSION_SLUG=$(curl https://api.github.com/repos/fluxcd/flux2/releases/latest --silent --location | grep tag_name)
fi
chmod +x "$FLUX_TOOL_DIR/$FLUX_EXEC_FILE"
VERSION=$(echo "${VERSION_SLUG}" | sed -E 's/.*"([^"]+)".*/\1/' | cut -c 2-)
fi
echo "Adding flux to path"
echo "$FLUX_TOOL_DIR" >> "$GITHUB_PATH"
- name: "Print installed flux version"
BIN_URL="https://github.com/fluxcd/flux2/releases/download/v${VERSION}/flux_${VERSION}_linux_${ARCH}.tar.gz"
curl --silent --fail --location "${BIN_URL}" --output /tmp/flux.tar.gz
mkdir -p /tmp/flux
tar -C /tmp/flux/ -zxvf /tmp/flux.tar.gz
- name: "Copy Flux binary to execute location"
shell: bash
run: |
BINDIR=${{ inputs.bindir }}
if [ -z "${BINDIR}" ]; then
sudo cp /tmp/flux/flux /usr/local/bin
else
cp /tmp/flux/flux "${BINDIR}"
echo "${BINDIR}" >> $GITHUB_PATH
fi
- name: "Cleanup tmp"
shell: bash
run: |
rm -rf /tmp/flux/ /tmp/flux.tar.gz
- name: "Verify correct installation of binary"
shell: bash
run: |
flux -v

View File

@@ -6,7 +6,7 @@ spec:
interval: 5m
chart:
spec:
version: "48.x"
version: "45.x"
chart: kube-prometheus-stack
sourceRef:
kind: HelmRepository
@@ -31,249 +31,6 @@ spec:
podMonitorSelector:
matchLabels:
app.kubernetes.io/component: monitoring
grafana:
defaultDashboardsEnabled: false
kube-state-metrics:
collectors: []
extraArgs:
- --custom-resource-state-only=true
rbac:
extraRules:
- apiGroups:
- source.toolkit.fluxcd.io
- kustomize.toolkit.fluxcd.io
- helm.toolkit.fluxcd.io
- image.toolkit.fluxcd.io
- notification.toolkit.fluxcd.io
resources:
- gitrepositories
- buckets
- helmrepositories
- helmcharts
- ocirepositories
- kustomizations
- helmreleases
- imagerepositories
- imagepolicies
- imageupdateautomations
- alerts
- providers
- receivers
verbs: ["list", "watch"]
customResourceState:
enabled: true
config:
spec:
resources:
- groupVersionKind:
group: source.toolkit.fluxcd.io
version: "v1"
kind: GitRepository
metricNamePrefix: gotk
metrics:
- name: "resource_info"
help: "The current state of a GitOps Toolkit resource."
each:
type: Info
info:
labelsFromPath:
name: [metadata, name]
labelsFromPath:
exported_namespace: [metadata, namespace]
ready: [status, conditions, "[type=Ready]", status]
- groupVersionKind:
group: source.toolkit.fluxcd.io
version: "v1beta2"
kind: Bucket
metricNamePrefix: gotk
metrics:
- name: "resource_info"
help: "The current state of a GitOps Toolkit resource."
each:
type: Info
info:
labelsFromPath:
name: [metadata, name]
labelsFromPath:
exported_namespace: [metadata, namespace]
ready: [status, conditions, "[type=Ready]", status]
- groupVersionKind:
group: source.toolkit.fluxcd.io
version: "v1beta2"
kind: HelmRepository
metricNamePrefix: gotk
metrics:
- name: "resource_info"
help: "The current state of a GitOps Toolkit resource."
each:
type: Info
info:
labelsFromPath:
name: [metadata, name]
labelsFromPath:
exported_namespace: [metadata, namespace]
type: [spec, type]
ready: [status, conditions, "[type=Ready]", status]
- groupVersionKind:
group: source.toolkit.fluxcd.io
version: "v1beta2"
kind: HelmChart
metricNamePrefix: gotk
metrics:
- name: "resource_info"
help: "The current state of a GitOps Toolkit resource."
each:
type: Info
info:
labelsFromPath:
name: [metadata, name]
labelsFromPath:
exported_namespace: [metadata, namespace]
ready: [status, conditions, "[type=Ready]", status]
- groupVersionKind:
group: source.toolkit.fluxcd.io
version: "v1beta2"
kind: OCIRepository
metricNamePrefix: gotk
metrics:
- name: "resource_info"
help: "The current state of a GitOps Toolkit resource."
each:
type: Info
info:
labelsFromPath:
name: [metadata, name]
labelsFromPath:
exported_namespace: [metadata, namespace]
ready: [status, conditions, "[type=Ready]", status]
- groupVersionKind:
group: kustomize.toolkit.fluxcd.io
version: "v1"
kind: Kustomization
metricNamePrefix: gotk
metrics:
- name: "resource_info"
help: "The current state of a GitOps Toolkit resource."
each:
type: Info
info:
labelsFromPath:
name: [metadata, name]
labelsFromPath:
exported_namespace: [metadata, namespace]
ready: [status, conditions, "[type=Ready]", status]
- groupVersionKind:
group: helm.toolkit.fluxcd.io
version: "v2beta1"
kind: HelmRelease
metricNamePrefix: gotk
metrics:
- name: "resource_info"
help: "The current state of a GitOps Toolkit resource."
each:
type: Info
info:
labelsFromPath:
name: [metadata, name]
labelsFromPath:
exported_namespace: [metadata, namespace]
ready: [status, conditions, "[type=Ready]", status]
- groupVersionKind:
group: image.toolkit.fluxcd.io
version: "v1beta2"
kind: ImageRepository
metricNamePrefix: gotk
metrics:
- name: "resource_info"
help: "The current state of a GitOps Toolkit resource."
each:
type: Info
info:
labelsFromPath:
name: [metadata, name]
labelsFromPath:
exported_namespace: [metadata, namespace]
ready: [status, conditions, "[type=Ready]", status]
- groupVersionKind:
group: image.toolkit.fluxcd.io
version: "v1beta2"
kind: ImagePolicy
metricNamePrefix: gotk
metrics:
- name: "resource_info"
help: "The current state of a GitOps Toolkit resource."
each:
type: Info
info:
labelsFromPath:
name: [metadata, name]
labelsFromPath:
exported_namespace: [metadata, namespace]
ready: [status, conditions, "[type=Ready]", status]
- groupVersionKind:
group: image.toolkit.fluxcd.io
version: "v1beta1"
kind: ImageUpdateAutomation
metricNamePrefix: gotk
metrics:
- name: "resource_info"
help: "The current state of a GitOps Toolkit resource."
each:
type: Info
info:
labelsFromPath:
name: [metadata, name]
labelsFromPath:
exported_namespace: [metadata, namespace]
ready: [status, conditions, "[type=Ready]", status]
- groupVersionKind:
group: notification.toolkit.fluxcd.io
version: "v1beta2"
kind: Alert
metricNamePrefix: gotk
metrics:
- name: "resource_info"
help: "The current state of a GitOps Toolkit resource."
each:
type: Info
info:
labelsFromPath:
name: [metadata, name]
labelsFromPath:
exported_namespace: [metadata, namespace]
ready: [status, conditions, "[type=Ready]", status]
- groupVersionKind:
group: notification.toolkit.fluxcd.io
version: "v1beta2"
kind: Provider
metricNamePrefix: gotk
metrics:
- name: "resource_info"
help: "The current state of a GitOps Toolkit resource."
each:
type: Info
info:
labelsFromPath:
name: [metadata, name]
labelsFromPath:
exported_namespace: [metadata, namespace]
ready: [status, conditions, "[type=Ready]", status]
- groupVersionKind:
group: notification.toolkit.fluxcd.io
version: "v1"
kind: Receiver
metricNamePrefix: gotk
metrics:
- name: "resource_info"
help: "The current state of a GitOps Toolkit resource."
each:
type: Info
info:
labelsFromPath:
name: [metadata, name]
labelsFromPath:
exported_namespace: [metadata, namespace]
ready: [status, conditions, "[type=Ready]", status]
postRenderers:
- kustomize:
patches:

View File

@@ -30,23 +30,18 @@
]
},
"editable": true,
"fiscalYearStartMonth": 0,
"gnetId": null,
"graphTooltip": 0,
"id": 5,
"iteration": 1652337714814,
"links": [],
"liveNow": false,
"panels": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"datasource": "${DS_PROMETHEUS}",
"description": "",
"fieldConfig": {
"defaults": {
"decimals": 0,
"mappings": [],
"noValue": "0",
"thresholds": {
"mode": "absolute",
"steps": [
@@ -86,37 +81,28 @@
"text": {},
"textMode": "value"
},
"pluginVersion": "10.0.2",
"pluginVersion": "7.5.5",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code",
"exemplar": false,
"expr": "count(gotk_resource_info{exported_namespace=~\"$namespace\", customresource_kind=~\"Kustomization|HelmRelease\"})",
"instant": true,
"exemplar": true,
"expr": "count(gotk_reconcile_condition{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",type=\"Ready\",status=\"True\",kind=~\"Kustomization|HelmRelease\"})\n-\nsum(gotk_reconcile_condition{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",type=\"Ready\",status=\"Deleted\",kind=~\"Kustomization|HelmRelease\"})",
"interval": "",
"legendFormat": "",
"range": false,
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Cluster Reconcilers",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"datasource": "${DS_PROMETHEUS}",
"description": "",
"fieldConfig": {
"defaults": {
"decimals": 0,
"mappings": [],
"noValue": "0",
"thresholds": {
"mode": "absolute",
"steps": [
@@ -152,37 +138,28 @@
"text": {},
"textMode": "value"
},
"pluginVersion": "10.0.2",
"pluginVersion": "7.5.5",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code",
"exemplar": false,
"expr": "count(gotk_resource_info{exported_namespace=~\"$namespace\", customresource_kind=~\"Kustomization|HelmRelease\", ready=\"False\"})",
"instant": true,
"exemplar": true,
"expr": "sum(gotk_reconcile_condition{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",type=\"Ready\",status=\"False\",kind=~\"Kustomization|HelmRelease\"})",
"interval": "",
"legendFormat": "",
"range": false,
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Failing Reconcilers",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"datasource": "${DS_PROMETHEUS}",
"description": "",
"fieldConfig": {
"defaults": {
"decimals": 0,
"mappings": [],
"noValue": "0",
"thresholds": {
"mode": "absolute",
"steps": [
@@ -222,37 +199,28 @@
"text": {},
"textMode": "value"
},
"pluginVersion": "10.0.2",
"pluginVersion": "7.5.5",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code",
"exemplar": false,
"expr": "count(gotk_resource_info{exported_namespace=~\"$namespace\", customresource_kind=~\"GitRepository|HelmRepository|Bucket|OCIRepository\"})",
"instant": true,
"exemplar": true,
"expr": "count(gotk_reconcile_condition{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",type=\"Ready\",status=\"True\",kind=~\"GitRepository|HelmRepository|Bucket\"})\n-\nsum(gotk_reconcile_condition{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",type=\"Ready\",status=\"Deleted\",kind=~\"GitRepository|HelmRepository|Bucket\"})",
"interval": "",
"legendFormat": "",
"range": false,
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Kubernetes Manifests Sources",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"datasource": "${DS_PROMETHEUS}",
"description": "",
"fieldConfig": {
"defaults": {
"decimals": 0,
"mappings": [],
"noValue": "0",
"thresholds": {
"mode": "absolute",
"steps": [
@@ -288,23 +256,18 @@
"text": {},
"textMode": "value"
},
"pluginVersion": "10.0.2",
"pluginVersion": "7.5.5",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code",
"exemplar": false,
"expr": "count(gotk_resource_info{exported_namespace=~\"$namespace\", customresource_kind=~\"GitRepository|HelmRepository|Bucket|OCIRepository\", ready=\"False\"})",
"instant": true,
"exemplar": true,
"expr": "sum(gotk_reconcile_condition{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",type=\"Ready\",status=\"False\",kind=~\"GitRepository|HelmRepository|Bucket\"})",
"interval": "",
"legendFormat": "",
"range": false,
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Failing Sources",
"type": "stat"
},
@@ -355,10 +318,9 @@
"values": false
},
"showUnfilled": true,
"text": {},
"valueMode": "color"
"text": {}
},
"pluginVersion": "10.0.2",
"pluginVersion": "7.5.5",
"targets": [
{
"exemplar": true,
@@ -368,6 +330,8 @@
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Reconciler ops avg. duration",
"type": "bargauge"
},
@@ -418,19 +382,20 @@
"values": false
},
"showUnfilled": true,
"text": {},
"valueMode": "color"
"text": {}
},
"pluginVersion": "10.0.2",
"pluginVersion": "7.5.5",
"targets": [
{
"exemplar": true,
"expr": " sum(rate(gotk_reconcile_duration_seconds_sum{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",kind=~\"GitRepository|HelmRepository|Bucket|OCIRepository\"}[5m])) by (kind)\n/\n sum(rate(gotk_reconcile_duration_seconds_count{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",kind=~\"GitRepository|HelmRepository|Bucket|OCIRepository\"}[5m])) by (kind)",
"expr": " sum(rate(gotk_reconcile_duration_seconds_sum{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",kind=~\"GitRepository|HelmRepository|Bucket\"}[5m])) by (kind)\n/\n sum(rate(gotk_reconcile_duration_seconds_count{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",kind=~\"GitRepository|HelmRepository|Bucket\"}[5m])) by (kind)",
"interval": "",
"legendFormat": "{{kind}}",
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Source ops avg. duration",
"type": "bargauge"
},
@@ -449,33 +414,23 @@
"type": "row"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"datasource": "${DS_PROMETHEUS}",
"description": "",
"fieldConfig": {
"defaults": {
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"displayMode": "auto",
"filterable": true,
"inspect": false
},
"mappings": [
{
"options": {
"False": {
"color": "red",
"index": 1,
"text": "Not Ready"
},
"True": {
"color": "blue",
"index": 0,
"0": {
"text": "Ready"
},
"1": {
"text": "Not Ready"
}
},
"type": "value"
@@ -485,8 +440,16 @@
"mode": "absolute",
"steps": [
{
"color": "transparent",
"color": "blue",
"value": null
},
{
"color": "blue",
"value": 0
},
{
"color": "red",
"value": 1
}
]
}
@@ -494,16 +457,13 @@
"overrides": [
{
"matcher": {
"id": "byType",
"options": "string"
"id": "byName",
"options": "Status"
},
"properties": [
{
"id": "custom.cellOptions",
"value": {
"mode": "basic",
"type": "color-background"
}
"id": "custom.displayMode",
"value": "color-background"
}
]
}
@@ -517,9 +477,7 @@
},
"id": 33,
"options": {
"cellHeight": "sm",
"footer": {
"countRows": false,
"fields": "",
"reducer": [
"sum"
@@ -534,16 +492,11 @@
}
]
},
"pluginVersion": "10.0.2",
"pluginVersion": "7.5.5",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code",
"exemplar": true,
"expr": "gotk_resource_info{exported_namespace=~\"$namespace\", customresource_kind=~\"Kustomization|HelmRelease\"}",
"expr": "gotk_reconcile_condition{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",type=\"Ready\",status=\"False\",kind=~\"Kustomization|HelmRelease\"}",
"format": "table",
"instant": true,
"interval": "",
@@ -551,6 +504,8 @@
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Cluster reconciliation readiness ",
"transformations": [
{
@@ -558,16 +513,11 @@
"options": {
"excludeByName": {
"Time": true,
"Value": true,
"__name__": true,
"app": true,
"container": true,
"customresource_group": true,
"customresource_kind": false,
"customresource_version": true,
"endpoint": true,
"exported_namespace": false,
"gotk_type": true,
"instance": true,
"job": true,
"kubernetes_namespace": true,
@@ -575,36 +525,16 @@
"namespace": true,
"pod": true,
"pod_template_hash": true,
"service": true,
"status": true,
"type": true
},
"indexByName": {
"Time": 0,
"Value": 15,
"__name__": 1,
"container": 2,
"customresource_group": 4,
"customresource_kind": 5,
"customresource_version": 6,
"endpoint": 7,
"exported_namespace": 3,
"instance": 8,
"job": 9,
"name": 10,
"namespace": 11,
"pod": 12,
"ready": 13,
"service": 14
},
"indexByName": {},
"renameByName": {
"Value": "",
"customresource_kind": "Kind",
"Value": "Status",
"exported_namespace": "Namespace",
"kind": "Kind",
"name": "Name",
"namespace": "Operator Namespace",
"ready": "Status"
"namespace": "Operator Namespace"
}
}
}
@@ -612,36 +542,23 @@
"type": "table"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"datasource": "${DS_PROMETHEUS}",
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"displayMode": "auto",
"filterable": true,
"inspect": false
},
"mappings": [
{
"options": {
"False": {
"color": "red",
"index": 1,
"text": "Not Ready"
},
"True": {
"color": "blue",
"index": 0,
"0": {
"text": "Ready"
},
"1": {
"text": "Not Ready"
}
},
"type": "value"
@@ -651,28 +568,21 @@
"mode": "absolute",
"steps": [
{
"color": "transparent",
"color": "blue",
"value": null
},
{
"color": "blue",
"value": 0
},
{
"color": "red",
"value": 1
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byType",
"options": "string"
},
"properties": [
{
"id": "custom.cellOptions",
"value": {
"mode": "basic",
"type": "color-background"
}
}
]
},
{
"matcher": {
"id": "byName",
@@ -680,15 +590,8 @@
},
"properties": [
{
"id": "noValue",
"value": "Ready"
},
{
"id": "color",
"value": {
"fixedColor": "blue",
"mode": "fixed"
}
"id": "custom.displayMode",
"value": "color-background"
}
]
}
@@ -702,9 +605,7 @@
},
"id": 34,
"options": {
"cellHeight": "sm",
"footer": {
"countRows": false,
"fields": "",
"reducer": [
"sum"
@@ -719,16 +620,11 @@
}
]
},
"pluginVersion": "10.0.2",
"pluginVersion": "7.5.5",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code",
"exemplar": true,
"expr": "gotk_resource_info{exported_namespace=~\"$namespace\", customresource_kind=~\"GitRepository|HelmRepository|Bucket|OCIRepository\"}",
"expr": "gotk_reconcile_condition{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",type=\"Ready\",status=\"False\",kind=~\"GitRepository|HelmRepository|Bucket\"}",
"format": "table",
"instant": true,
"interval": "",
@@ -736,6 +632,8 @@
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Source acquisition readiness ",
"transformations": [
{
@@ -743,16 +641,11 @@
"options": {
"excludeByName": {
"Time": true,
"Value": true,
"__name__": true,
"app": true,
"container": true,
"customresource_group": true,
"customresource_kind": false,
"customresource_version": true,
"endpoint": true,
"exported_namespace": false,
"gotk_type": true,
"instance": true,
"job": true,
"kubernetes_namespace": true,
@@ -760,37 +653,16 @@
"namespace": true,
"pod": true,
"pod_template_hash": true,
"ready": false,
"service": true,
"status": true,
"type": true
},
"indexByName": {
"Time": 0,
"Value": 15,
"__name__": 1,
"container": 2,
"customresource_group": 5,
"customresource_kind": 6,
"customresource_version": 7,
"endpoint": 8,
"exported_namespace": 4,
"instance": 9,
"job": 10,
"name": 11,
"namespace": 3,
"pod": 12,
"ready": 13,
"service": 14
},
"indexByName": {},
"renameByName": {
"Value": "",
"customresource_kind": "Kind",
"Value": "Status",
"exported_namespace": "Namespace",
"kind": "Kind",
"name": "Name",
"namespace": "Operator Namespace",
"ready": "Status"
"namespace": "Operator Namespace"
}
}
}
@@ -818,6 +690,10 @@
"dashes": false,
"datasource": "${DS_PROMETHEUS}",
"description": "",
"fieldConfig": {
"defaults": {},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
@@ -848,7 +724,7 @@
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "10.0.2",
"pluginVersion": "7.5.5",
"pointradius": 2,
"points": false,
"renderer": "flot",
@@ -867,7 +743,9 @@
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Cluster reconciliation duration",
"tooltip": {
"shared": true,
@@ -876,24 +754,33 @@
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "s",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false
"align": false,
"alignLevel": null
}
},
{
@@ -903,6 +790,10 @@
"dashes": false,
"datasource": "${DS_PROMETHEUS}",
"description": "",
"fieldConfig": {
"defaults": {},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
@@ -933,7 +824,7 @@
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "10.0.2",
"pluginVersion": "7.5.5",
"pointradius": 2,
"points": false,
"renderer": "flot",
@@ -944,7 +835,7 @@
"targets": [
{
"exemplar": true,
"expr": " sum(rate(gotk_reconcile_duration_seconds_sum{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",kind=~\"GitRepository|HelmRepository|Bucket|OCIRepository\"}[5m])) by (kind, name)\n/\n sum(rate(gotk_reconcile_duration_seconds_count{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",kind=~\"GitRepository|HelmRepository|Bucket|OCIRepository\"}[5m])) by (kind, name)",
"expr": " sum(rate(gotk_reconcile_duration_seconds_sum{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",kind=~\"GitRepository|HelmRepository|Bucket\"}[5m])) by (kind, name)\n/\n sum(rate(gotk_reconcile_duration_seconds_count{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",kind=~\"GitRepository|HelmRepository|Bucket\"}[5m])) by (kind, name)",
"hide": false,
"interval": "",
"legendFormat": "{{kind}}/{{name}}",
@@ -952,7 +843,9 @@
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Source acquisition duration",
"tooltip": {
"shared": true,
@@ -961,29 +854,38 @@
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "s",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false
"align": false,
"alignLevel": null
}
}
],
"refresh": "30s",
"schemaVersion": 38,
"schemaVersion": 36,
"style": "light",
"tags": [
"flux"
@@ -1001,13 +903,13 @@
"$__all"
]
},
"datasource": {
"type": "prometheus",
"uid": "$DS_PROMETHEUS"
},
"datasource": "$DS_PROMETHEUS",
"definition": "label_values(gotk_reconcile_condition, namespace)",
"description": null,
"error": null,
"hide": 0,
"includeAll": true,
"label": null,
"multi": true,
"name": "operator_namespace",
"options": [],
@@ -1026,8 +928,10 @@
"useTags": false
},
{
"allValue": null,
"current": {
"selected": true,
"tags": [],
"text": [
"All"
],
@@ -1035,19 +939,19 @@
"$__all"
]
},
"datasource": {
"type": "prometheus",
"uid": "$DS_PROMETHEUS"
},
"definition": "label_values(gotk_resource_info,exported_namespace)",
"datasource": "$DS_PROMETHEUS",
"definition": "label_values(gotk_reconcile_condition, exported_namespace)",
"description": null,
"error": null,
"hide": 0,
"includeAll": true,
"label": null,
"multi": true,
"name": "namespace",
"options": [],
"query": {
"query": "label_values(gotk_resource_info,exported_namespace)",
"refId": "PrometheusVariableQueryEditor-VariableQuery"
"query": "label_values(gotk_reconcile_condition, exported_namespace)",
"refId": "StandardVariableQuery"
},
"refresh": 2,
"regex": "",
@@ -1096,9 +1000,7 @@
"1d"
]
},
"timezone": "",
"title": "Flux Cluster Stats",
"uid": "flux-cluster",
"version": 4,
"weekStart": ""
"version": 3
}