From 12d8a0641e1dd17c8cc77f8453f8fd76221ac794 Mon Sep 17 00:00:00 2001 From: Pete Wall Date: Thu, 3 Oct 2024 14:16:09 -0500 Subject: [PATCH 01/10] Make a script to create updatecli config files based on Chart.yaml files Signed-off-by: Pete Wall --- .../.updatecli-kepler.yaml | 31 ++++++++ .../.updatecli-kube-state-metrics.yaml | 31 ++++++++ .../.updatecli-prometheus-node-exporter.yaml | 31 ++++++++ ...updatecli-prometheus-windows-exporter.yaml | 31 ++++++++ .../.updatecli-prometheus-operator-crds.yaml | 31 ++++++++ charts/k8s-monitoring/.updatecli-alloy.yaml | 67 +++++++++++++++++ scripts/charts-to-updatecli.sh | 72 +++++++++++++++++++ 7 files changed, 294 insertions(+) create mode 100644 charts/feature-cluster-metrics/.updatecli-kepler.yaml create mode 100644 charts/feature-cluster-metrics/.updatecli-kube-state-metrics.yaml create mode 100644 charts/feature-cluster-metrics/.updatecli-prometheus-node-exporter.yaml create mode 100644 charts/feature-cluster-metrics/.updatecli-prometheus-windows-exporter.yaml create mode 100644 charts/feature-prometheus-operator-objects/.updatecli-prometheus-operator-crds.yaml create mode 100644 charts/k8s-monitoring/.updatecli-alloy.yaml create mode 100755 scripts/charts-to-updatecli.sh diff --git a/charts/feature-cluster-metrics/.updatecli-kepler.yaml b/charts/feature-cluster-metrics/.updatecli-kepler.yaml new file mode 100644 index 000000000..72eab3f10 --- /dev/null +++ b/charts/feature-cluster-metrics/.updatecli-kepler.yaml @@ -0,0 +1,31 @@ +--- +name: Bump dependency "kepler" for Helm chart "k8s-monitoring-feature-cluster-metrics" +sources: + kepler: + name: Get latest "kepler" Helm chart version + kind: helmchart + spec: + name: kepler + url: https://sustainable-computing-io.github.io/kepler-helm-chart + versionfilter: + kind: semver + pattern: '*' +conditions: + kepler: + name: Ensure Helm chart dependency "kepler" is specified + kind: yaml + spec: + file: charts/k8s-monitoring-feature-cluster-metrics/Chart.yaml + key: $.dependencies[3].name + value: kepler + disablesourceinput: true +targets: + kepler: + name: Bump Helm chart dependency "kepler" for Helm chart "k8s-monitoring-feature-cluster-metrics" + kind: helmchart + spec: + file: Chart.yaml + key: $.dependencies[3].version + name: charts/k8s-monitoring-feature-cluster-metrics + versionincrement: none + sourceid: kepler diff --git a/charts/feature-cluster-metrics/.updatecli-kube-state-metrics.yaml b/charts/feature-cluster-metrics/.updatecli-kube-state-metrics.yaml new file mode 100644 index 000000000..8aabe1315 --- /dev/null +++ b/charts/feature-cluster-metrics/.updatecli-kube-state-metrics.yaml @@ -0,0 +1,31 @@ +--- +name: Bump dependency "kube-state-metrics" for Helm chart "k8s-monitoring-feature-cluster-metrics" +sources: + kube-state-metrics: + name: Get latest "kube-state-metrics" Helm chart version + kind: helmchart + spec: + name: kube-state-metrics + url: https://prometheus-community.github.io/helm-charts + versionfilter: + kind: semver + pattern: '*' +conditions: + kube-state-metrics: + name: Ensure Helm chart dependency "kube-state-metrics" is specified + kind: yaml + spec: + file: charts/k8s-monitoring-feature-cluster-metrics/Chart.yaml + key: $.dependencies[0].name + value: kube-state-metrics + disablesourceinput: true +targets: + kube-state-metrics: + name: Bump Helm chart dependency "kube-state-metrics" for Helm chart "k8s-monitoring-feature-cluster-metrics" + kind: helmchart + spec: + file: Chart.yaml + key: $.dependencies[0].version + name: charts/k8s-monitoring-feature-cluster-metrics + versionincrement: none + sourceid: kube-state-metrics diff --git a/charts/feature-cluster-metrics/.updatecli-prometheus-node-exporter.yaml b/charts/feature-cluster-metrics/.updatecli-prometheus-node-exporter.yaml new file mode 100644 index 000000000..79c2c7816 --- /dev/null +++ b/charts/feature-cluster-metrics/.updatecli-prometheus-node-exporter.yaml @@ -0,0 +1,31 @@ +--- +name: Bump dependency "prometheus-node-exporter" for Helm chart "k8s-monitoring-feature-cluster-metrics" +sources: + prometheus-node-exporter: + name: Get latest "prometheus-node-exporter" Helm chart version + kind: helmchart + spec: + name: prometheus-node-exporter + url: https://prometheus-community.github.io/helm-charts + versionfilter: + kind: semver + pattern: '*' +conditions: + prometheus-node-exporter: + name: Ensure Helm chart dependency "prometheus-node-exporter" is specified + kind: yaml + spec: + file: charts/k8s-monitoring-feature-cluster-metrics/Chart.yaml + key: $.dependencies[1].name + value: prometheus-node-exporter + disablesourceinput: true +targets: + node-exporter: + name: Bump Helm chart dependency "node-exporter" for Helm chart "k8s-monitoring-feature-cluster-metrics" + kind: helmchart + spec: + file: Chart.yaml + key: $.dependencies[1].version + name: charts/k8s-monitoring-feature-cluster-metrics + versionincrement: none + sourceid: prometheus-node-exporter diff --git a/charts/feature-cluster-metrics/.updatecli-prometheus-windows-exporter.yaml b/charts/feature-cluster-metrics/.updatecli-prometheus-windows-exporter.yaml new file mode 100644 index 000000000..cef387e62 --- /dev/null +++ b/charts/feature-cluster-metrics/.updatecli-prometheus-windows-exporter.yaml @@ -0,0 +1,31 @@ +--- +name: Bump dependency "prometheus-windows-exporter" for Helm chart "k8s-monitoring-feature-cluster-metrics" +sources: + prometheus-windows-exporter: + name: Get latest "prometheus-windows-exporter" Helm chart version + kind: helmchart + spec: + name: prometheus-windows-exporter + url: https://prometheus-community.github.io/helm-charts + versionfilter: + kind: semver + pattern: '*' +conditions: + prometheus-windows-exporter: + name: Ensure Helm chart dependency "prometheus-windows-exporter" is specified + kind: yaml + spec: + file: charts/k8s-monitoring-feature-cluster-metrics/Chart.yaml + key: $.dependencies[2].name + value: prometheus-windows-exporter + disablesourceinput: true +targets: + windows-exporter: + name: Bump Helm chart dependency "windows-exporter" for Helm chart "k8s-monitoring-feature-cluster-metrics" + kind: helmchart + spec: + file: Chart.yaml + key: $.dependencies[2].version + name: charts/k8s-monitoring-feature-cluster-metrics + versionincrement: none + sourceid: prometheus-windows-exporter diff --git a/charts/feature-prometheus-operator-objects/.updatecli-prometheus-operator-crds.yaml b/charts/feature-prometheus-operator-objects/.updatecli-prometheus-operator-crds.yaml new file mode 100644 index 000000000..4125b2703 --- /dev/null +++ b/charts/feature-prometheus-operator-objects/.updatecli-prometheus-operator-crds.yaml @@ -0,0 +1,31 @@ +--- +name: Bump dependency "prometheus-operator-crds" for Helm chart "k8s-monitoring-feature-prometheus-operator-objects" +sources: + prometheus-operator-crds: + name: Get latest "prometheus-operator-crds" Helm chart version + kind: helmchart + spec: + name: prometheus-operator-crds + url: https://prometheus-community.github.io/helm-charts + versionfilter: + kind: semver + pattern: '*' +conditions: + prometheus-operator-crds: + name: Ensure Helm chart dependency "prometheus-operator-crds" is specified + kind: yaml + spec: + file: charts/k8s-monitoring-feature-prometheus-operator-objects/Chart.yaml + key: $.dependencies[0].name + value: prometheus-operator-crds + disablesourceinput: true +targets: + crds: + name: Bump Helm chart dependency "crds" for Helm chart "k8s-monitoring-feature-prometheus-operator-objects" + kind: helmchart + spec: + file: Chart.yaml + key: $.dependencies[0].version + name: charts/k8s-monitoring-feature-prometheus-operator-objects + versionincrement: none + sourceid: prometheus-operator-crds diff --git a/charts/k8s-monitoring/.updatecli-alloy.yaml b/charts/k8s-monitoring/.updatecli-alloy.yaml new file mode 100644 index 000000000..b594dc947 --- /dev/null +++ b/charts/k8s-monitoring/.updatecli-alloy.yaml @@ -0,0 +1,67 @@ +--- +name: Bump dependency "alloy" for Helm chart "k8s-monitoring" +sources: + alloy: + name: Get latest "alloy" Helm chart version + kind: helmchart + spec: + name: alloy + url: https://grafana.github.io/helm-charts + versionfilter: + kind: semver + pattern: '*' +conditions: + alloy: + name: Ensure Helm chart dependency "alloy" is specified + kind: yaml + spec: + file: charts/k8s-monitoring/Chart.yaml + key: $.dependencies[9].name + value: alloy + disablesourceinput: true +targets: + alloy-metrics: + name: Bump Helm chart dependency "alloy-metrics" for Helm chart "k8s-monitoring" + kind: helmchart + spec: + file: Chart.yaml + key: $.dependencies[9].version + name: charts/k8s-monitoring + versionincrement: none + sourceid: alloy + alloy-singleton: + name: Bump Helm chart dependency "alloy-singleton" for Helm chart "k8s-monitoring" + kind: helmchart + spec: + file: Chart.yaml + key: $.dependencies[10].version + name: charts/k8s-monitoring + versionincrement: none + sourceid: alloy + alloy-logs: + name: Bump Helm chart dependency "alloy-logs" for Helm chart "k8s-monitoring" + kind: helmchart + spec: + file: Chart.yaml + key: $.dependencies[11].version + name: charts/k8s-monitoring + versionincrement: none + sourceid: alloy + alloy-receiver: + name: Bump Helm chart dependency "alloy-receiver" for Helm chart "k8s-monitoring" + kind: helmchart + spec: + file: Chart.yaml + key: $.dependencies[12].version + name: charts/k8s-monitoring + versionincrement: none + sourceid: alloy + alloy-profiles: + name: Bump Helm chart dependency "alloy-profiles" for Helm chart "k8s-monitoring" + kind: helmchart + spec: + file: Chart.yaml + key: $.dependencies[13].version + name: charts/k8s-monitoring + versionincrement: none + sourceid: alloy diff --git a/scripts/charts-to-updatecli.sh b/scripts/charts-to-updatecli.sh new file mode 100755 index 000000000..e8075ff19 --- /dev/null +++ b/scripts/charts-to-updatecli.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash + +CHART_YAML=$1 +if [ -z "$CHART_YAML" ]; then + echo "Usage: $0 " + exit 1 +fi +if [ ! -f "$CHART_YAML" ]; then + echo "File not found: $CHART_YAML" + exit 1 +fi + +rm -f .updatecli-*.yaml +chartName=$(yq eval '.name' "$CHART_YAML") +dependencyCount=$(yq eval '.dependencies | length' "$CHART_YAML") +for ((i=0; i ".updatecli-${chart}.yaml" + yq eval --null-input "{ + \"name\": \"Bump dependency \\\"$chart\\\" for Helm chart \\\"$chartName\\\"\", + \"sources\": { + \"$chart\": { + \"name\": \"Get latest \\\"$chart\\\" Helm chart version\", + \"kind\": \"helmchart\", + \"spec\": { + \"name\": \"$chart\", + \"url\": \"$repository\", + \"versionfilter\": { + \"kind\": \"semver\", + \"pattern\": \"*\" + } + } + } + }, + \"conditions\": { + \"$chart\": { + \"name\": \"Ensure Helm chart dependency \\\"$chart\\\" is specified\", + \"kind\": \"yaml\", + \"spec\": { + \"file\": \"charts/$chartName/Chart.yaml\", + \"key\": \"$.dependencies[$i].name\", + \"value\": \"$chart\" + }, + \"disablesourceinput\": true + } + }, + \"targets\": {} +}" >> ".updatecli-${chart}.yaml" + fi + yq eval ".targets += { +\"$name\": { + \"name\": \"Bump Helm chart dependency \\\"$name\\\" for Helm chart \\\"$chartName\\\"\", + \"kind\": \"helmchart\", + \"spec\": { + \"file\": \"Chart.yaml\", + \"key\": \"$.dependencies[$i].version\", + \"name\": \"charts/$chartName\", + \"versionincrement\": \"none\" + }, + \"sourceid\": \"$chart\" +} +}" ".updatecli-${chart}.yaml" > ".updatecli-${chart}.yaml-new" + mv ".updatecli-${chart}.yaml-new" ".updatecli-${chart}.yaml" + fi +done + + From b8f2bbb0a775560edd7be0ccc3ebea3aab216bc7 Mon Sep 17 00:00:00 2001 From: Pete Wall Date: Fri, 11 Oct 2024 15:13:02 -0500 Subject: [PATCH 02/10] Updatecli configs put inside each chart dir. Make the GitHub action find all files and execute Signed-off-by: Pete Wall --- .../check-for-dependency-updates.yaml | 331 ++---------------- .github/workflows/integration-test.yml | 4 +- .github/workflows/unit-test.yml | 10 +- .../feature-annotation-autodiscovery/Makefile | 6 +- .../Makefile | 6 +- charts/feature-cluster-events/Makefile | 6 +- charts/feature-cluster-metrics/Makefile | 6 +- .../feature-frontend-observability/Makefile | 6 +- charts/feature-integrations/Makefile | 6 +- charts/feature-pod-logs/Makefile | 6 +- charts/feature-profiling/Makefile | 6 +- .../Makefile | 6 +- charts/k8s-monitoring-test/Makefile | 7 +- .../k8s-monitoring-v1/.updatecli-alloy.yaml | 10 +- .../k8s-monitoring-v1/.updatecli-beyla.yaml | 6 +- .../k8s-monitoring-v1/.updatecli-kepler.yaml | 6 +- .../.updatecli-kube-state-metrics.yaml | 4 +- .../.updatecli-opencost.yaml | 4 +- .../.updatecli-prometheus-node-exporter.yaml | 6 +- .../.updatecli-prometheus-operator-crds.yaml | 4 +- ...updatecli-prometheus-windows-exporter.yaml | 4 +- charts/k8s-monitoring-v1/Makefile | 8 +- charts/k8s-monitoring/Makefile | 6 +- scripts/charts-to-updatecli.sh | 2 +- 24 files changed, 120 insertions(+), 346 deletions(-) rename .github/configs/updatecli.d/alloy.yaml => charts/k8s-monitoring-v1/.updatecli-alloy.yaml (87%) rename .github/configs/updatecli.d/beyla.yaml => charts/k8s-monitoring-v1/.updatecli-beyla.yaml (89%) rename .github/configs/updatecli.d/kepler.yaml => charts/k8s-monitoring-v1/.updatecli-kepler.yaml (89%) rename .github/configs/updatecli.d/kube-state-metrics.yaml => charts/k8s-monitoring-v1/.updatecli-kube-state-metrics.yaml (90%) rename .github/configs/updatecli.d/opencost.yaml => charts/k8s-monitoring-v1/.updatecli-opencost.yaml (89%) rename .github/configs/updatecli.d/node-exporter.yaml => charts/k8s-monitoring-v1/.updatecli-prometheus-node-exporter.yaml (91%) rename .github/configs/updatecli.d/prometheus-operator-crds.yaml => charts/k8s-monitoring-v1/.updatecli-prometheus-operator-crds.yaml (91%) rename .github/configs/updatecli.d/windows-exporter.yaml => charts/k8s-monitoring-v1/.updatecli-prometheus-windows-exporter.yaml (91%) diff --git a/.github/workflows/check-for-dependency-updates.yaml b/.github/workflows/check-for-dependency-updates.yaml index 685d6a530..f68b793bd 100644 --- a/.github/workflows/check-for-dependency-updates.yaml +++ b/.github/workflows/check-for-dependency-updates.yaml @@ -16,56 +16,29 @@ env: UPDATECLI_GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" jobs: - updateGrafanaAlloy: - name: Update Grafana Alloy - runs-on: "ubuntu-latest" + detect-updatecli-configs: + name: Detect Updatecli Configuration Files + runs-on: ubuntu-latest + outputs: + updatecli_configs: ${{ steps.detect_updatecli_configs.outputs.updatecli_configs }} steps: - - name: Checkout + - name: Checkout code uses: actions/checkout@v4 - - name: Install Updatecli - uses: updatecli/updatecli-action@v2 - - - name: Run Updatecli - id: update-alloy + - name: Detect Updatecli Configuration Files + id: detect_updatecli_configs run: | - updatecli apply --config "${UPDATECLI_CONFIG_DIR}/alloy.yaml" - if ! git diff --exit-code > /dev/null; then - echo "changed=true" >> "${GITHUB_OUTPUT}" - fi - - - name: Regenerate docs - if: steps.update-alloy.outputs.changed == 'true' - run: docker run --rm -v "$(pwd)/charts/k8s-monitoring-v1:/helm-docs" -u "$(id -u)" jnorwood/helm-docs - - - name: Install Helm - if: steps.update-alloy.outputs.changed == 'true' - uses: azure/setup-helm@v4 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Regenerate examples - if: steps.update-alloy.outputs.changed == 'true' - run: make clean examples - working-directory: charts/k8s-monitoring-v1 - - - name: Create pull request - if: steps.update-alloy.outputs.changed == 'true' - uses: peter-evans/create-pull-request@v7 - with: - title: "[dependency] Update Grafana Alloy" - body: "Updates the Grafana Alloy subchart" - base: main - author: "${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>" - committer: "GitHub " - commit-message: Update Grafana Alloy - labels: dependencies - branch: chore/update-grafana-alloy - delete-branch: true - - updateKepler: - name: Update Kepler - runs-on: "ubuntu-latest" + # shellcheck disable=SC2010 + echo "updatecli_configs=$(find charts -type f -name ".updatecli*.yaml" | jq --raw-input --slurp --compact-output 'split("\n") | map(select(. != ""))')" >> "${GITHUB_OUTPUT}" + + run-dependency-check: + name: Run Dependency Check + needs: detect-updatecli-configs + runs-on: ubuntu-latest + strategy: + matrix: + config: ${{fromJson(needs.detect-updatecli-configs.outputs.updatecli_configs)}} + fail-fast: false steps: - name: Checkout uses: actions/checkout@v4 @@ -74,273 +47,41 @@ jobs: uses: updatecli/updatecli-action@v2 - name: Run Updatecli - id: update-kepler + id: update-dependency run: | - updatecli apply --config "${UPDATECLI_CONFIG_DIR}/kepler.yaml" + updatecli apply --config "${{ matrix.config }}" if ! git diff --exit-code > /dev/null; then echo "changed=true" >> "${GITHUB_OUTPUT}" fi - - name: Regenerate docs - if: steps.update-kepler.outputs.changed == 'true' - run: docker run --rm -v "$(pwd)/charts/k8s-monitoring-v1:/helm-docs" -u "$(id -u)" jnorwood/helm-docs - - name: Install Helm - if: steps.update-kepler.outputs.changed == 'true' + if: steps.update-dependency.outputs.changed == 'true' uses: azure/setup-helm@v4 with: token: ${{ secrets.GITHUB_TOKEN }} - - name: Regenerate examples - if: steps.update-kepler.outputs.changed == 'true' - run: make clean examples - working-directory: charts/k8s-monitoring-v1 + - name: Regenerate files + if: steps.update-dependency.outputs.changed == 'true' + run: make -C "$(dirname "${{ matrix.config }}")" clean build - - name: Create pull request - if: steps.update-kepler.outputs.changed == 'true' - uses: peter-evans/create-pull-request@v7 - with: - title: "[dependency] Update Kepler" - body: "Updates the Kepler subchart" - base: main - author: "${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>" - committer: "GitHub " - commit-message: Update Kepler - labels: dependencies - branch: chore/update-kepler - delete-branch: true - - updateKubeStateMetrics: - name: Update Kube State Metrics - runs-on: "ubuntu-latest" - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install Updatecli - uses: updatecli/updatecli-action@v2 - - - name: Run Updatecli - id: update-kube-state-metrics + - name: Get details + id: get-details run: | - updatecli apply --config "${UPDATECLI_CONFIG_DIR}/kube-state-metrics.yaml" - if ! git diff --exit-code > /dev/null; then - echo "changed=true" >> "${GITHUB_OUTPUT}" - fi - - - name: Regenerate docs - if: steps.update-kube-state-metrics.outputs.changed == 'true' - run: docker run --rm -v "$(pwd)/charts/k8s-monitoring-v1:/helm-docs" -u "$(id -u)" jnorwood/helm-docs - - - name: Install Helm - if: steps.update-kube-state-metrics.outputs.changed == 'true' - uses: azure/setup-helm@v4 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Regenerate examples - if: steps.update-kube-state-metrics.outputs.changed == 'true' - run: make clean examples - working-directory: charts/k8s-monitoring-v1 - - - name: Create pull request - if: steps.update-kube-state-metrics.outputs.changed == 'true' - uses: peter-evans/create-pull-request@v7 - with: - title: "[dependency] Update Kube State Metrics" - body: "Updates the Kube State Metrics subchart" - base: main - author: "${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>" - committer: "GitHub " - commit-message: Update Kube State Metrics - labels: dependencies - branch: chore/update-kube-state-metrics - delete-branch: true - - updateNodeExporter: - name: Update Node Exporter - runs-on: "ubuntu-latest" - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install Updatecli - uses: updatecli/updatecli-action@v2 - - - name: Run Updatecli - id: update-node-exporter - run: | - updatecli apply --config "${UPDATECLI_CONFIG_DIR}/node-exporter.yaml" - if ! git diff --exit-code > /dev/null; then - echo "changed=true" >> "${GITHUB_OUTPUT}" - fi - - - name: Regenerate docs - if: steps.update-node-exporter.outputs.changed == 'true' - run: docker run --rm -v "$(pwd)/charts/k8s-monitoring-v1:/helm-docs" -u "$(id -u)" jnorwood/helm-docs - - - name: Install Helm - if: steps.update-node-exporter.outputs.changed == 'true' - uses: azure/setup-helm@v4 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Regenerate examples - if: steps.update-node-exporter.outputs.changed == 'true' - run: make clean examples - working-directory: charts/k8s-monitoring-v1 - - - name: Create pull request - if: steps.update-node-exporter.outputs.changed == 'true' - uses: peter-evans/create-pull-request@v7 - with: - title: "[dependency] Update Node Exporter" - body: "Updates the Node Exporter subchart" - base: main - author: "${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>" - committer: "GitHub " - commit-message: Update Node Exporter - labels: dependencies - branch: chore/update-node-exporter - delete-branch: true - - updateOpenCost: - name: Update OpenCost - runs-on: "ubuntu-latest" - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install Updatecli - uses: updatecli/updatecli-action@v2 - - - name: Run Updatecli - id: update-opencost - run: | - updatecli apply --config "${UPDATECLI_CONFIG_DIR}/opencost.yaml" - if ! git diff --exit-code > /dev/null; then - echo "changed=true" >> "${GITHUB_OUTPUT}" - fi - - - name: Regenerate docs - if: steps.update-opencost.outputs.changed == 'true' - run: docker run --rm -v "$(pwd)/charts/k8s-monitoring-v1:/helm-docs" -u "$(id -u)" jnorwood/helm-docs - - - name: Install Helm - if: steps.update-opencost.outputs.changed == 'true' - uses: azure/setup-helm@v4 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Regenerate examples - if: steps.update-opencost.outputs.changed == 'true' - run: make clean examples - working-directory: charts/k8s-monitoring-v1 - - - name: Create pull request - if: steps.update-opencost.outputs.changed == 'true' - uses: peter-evans/create-pull-request@v7 - with: - title: "[dependency] Update OpenCost" - body: "Updates the OpenCost subchart" - base: main - author: "${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>" - committer: "GitHub " - commit-message: Update OpenCost - labels: dependencies - branch: chore/update-opencost - delete-branch: true - - updatePrometheusOperatorCRDs: - name: Update Prometheus Operator CRDs - runs-on: "ubuntu-latest" - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install Updatecli - uses: updatecli/updatecli-action@v2 - - - name: Run Updatecli - id: update-prometheus-operator-crds - run: | - updatecli apply --config "${UPDATECLI_CONFIG_DIR}/prometheus-operator-crds.yaml" - if ! git diff --exit-code > /dev/null; then - echo "changed=true" >> "${GITHUB_OUTPUT}" - fi - - - name: Regenerate docs - if: steps.update-prometheus-operator-crds.outputs.changed == 'true' - run: docker run --rm -v "$(pwd)/charts/k8s-monitoring-v1:/helm-docs" -u "$(id -u)" jnorwood/helm-docs - - - name: Install Helm - if: steps.update-prometheus-operator-crds.outputs.changed == 'true' - uses: azure/setup-helm@v4 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Regenerate examples - if: steps.update-prometheus-operator-crds.outputs.changed == 'true' - run: make clean examples - working-directory: charts/k8s-monitoring-v1 - - - name: Create pull request - if: steps.update-prometheus-operator-crds.outputs.changed == 'true' - uses: peter-evans/create-pull-request@v7 - with: - title: "[dependency] Update Prometheus Operator CRDs" - body: "Updates the Prometheus Operator CRD subchart" - base: main - author: "${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>" - committer: "GitHub " - commit-message: Update Prometheus Operator CRDs - labels: dependencies - branch: chore/update-prometheus-operator-crds - delete-branch: true - - updateWindowsExporter: - name: Update Windows Exporter - runs-on: "ubuntu-latest" - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install Updatecli - uses: updatecli/updatecli-action@v2 - - - name: Run Updatecli - id: update-windows-exporter - run: | - updatecli apply --config "${UPDATECLI_CONFIG_DIR}/windows-exporter.yaml" - if ! git diff --exit-code > /dev/null; then - echo "changed=true" >> "${GITHUB_OUTPUT}" - fi - - - name: Regenerate docs - if: steps.update-windows-exporter.outputs.changed == 'true' - run: docker run --rm -v "$(pwd)/charts/k8s-monitoring-v1:/helm-docs" -u "$(id -u)" jnorwood/helm-docs - - - name: Install Helm - if: steps.update-windows-exporter.outputs.changed == 'true' - uses: azure/setup-helm@v4 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Regenerate examples - if: steps.update-windows-exporter.outputs.changed == 'true' - run: make clean examples - working-directory: charts/k8s-monitoring-v1 + versionPath="$(yq eval '.targets.*.spec.key' "${{ matrix.config }}" | head -n 1 | cut -c2-)" + echo "version=$(yq eval "${versionPath}" "$(dirname "${{ matrix.config }}")/Chart.yaml")" >> "${GITHUB_OUTPUT}" + echo "chart=$(basename "${{ matrix.config }}" | sed -e "s/.updatecli-\(.*\)\.yaml/\1/")" >> "${GITHUB_OUTPUT}" + echo "title=$(yq eval ".name" "${{ matrix.config }}")" >> "${GITHUB_OUTPUT}" - name: Create pull request - if: steps.update-windows-exporter.outputs.changed == 'true' + if: steps.update-dependency.outputs.changed == 'true' uses: peter-evans/create-pull-request@v7 with: - title: "[dependency] Update Windows Exporter" - body: "Updates the Windows Exporter subchart" + title: [dependency] ${{ steps.get-details.outputs.title }} to ${{ steps.get-details.outputs.version }} + body: ${{ steps.get-details.outputs.title }} to ${{ steps.get-details.outputs.version }} base: main author: "${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>" committer: "GitHub " - commit-message: Update Windows Exporter + commit-message: Update ${{ steps.get-details.outputs.title }} to ${{ steps.get-details.outputs.version }} labels: dependencies - branch: chore/update-windows-exporter + branch: chore/update-${{ steps.get-details.outputs.chart }} delete-branch: true diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index a19e740c6..07dfb7436 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -70,6 +70,4 @@ jobs: env: CREATE_CLUSTER: "false" DEPLOY_GRAFANA: "false" - run: | - echo "Testing ${{ matrix.test }}" - ./scripts/integration-test.sh "charts/k8s-monitoring/tests/integration/${{ matrix.test }}" + run: ./scripts/integration-test.sh "charts/k8s-monitoring/tests/integration/${{ matrix.test }}" diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 7178e9cb5..cb10eece0 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -94,10 +94,7 @@ jobs: sudo apt-get install -y alloy - name: Run tests - run: | - echo "Testing ${{ matrix.dir }}" - cd charts/${{ matrix.dir }} - make test + run: make -C "charts/${{ matrix.dir }}" test check-generated-files: name: Check Generated Files @@ -113,10 +110,7 @@ jobs: uses: actions/checkout@v4 - name: Regenerate files - run: | - echo "Running make all in charts/${{ matrix.dir }}" - cd charts/${{ matrix.dir }} - make clean build + run: make -C "charts/${{ matrix.dir }}" clean build - name: Check for changes in generated files run: | diff --git a/charts/feature-annotation-autodiscovery/Makefile b/charts/feature-annotation-autodiscovery/Makefile index 82a837825..8e322c3ef 100644 --- a/charts/feature-annotation-autodiscovery/Makefile +++ b/charts/feature-annotation-autodiscovery/Makefile @@ -1,5 +1,6 @@ HAS_HELM_DOCS := $(shell command -v helm-docs;) HAS_HELM_UNITTEST := $(shell helm plugin list | grep unittest 2> /dev/null) +UPDATECLI_FILES := $(shell yq -e '.dependencies[] | select(.repository == "http*") | ".updatecli-" + .name + ".yaml"' Chart.yaml | sort | uniq) .SECONDEXPANSION: README.md: values.yaml Chart.yaml $$(wildcard README.md.gotmpl) @@ -16,12 +17,15 @@ Chart.lock: Chart.yaml values.schema.json: values.yaml $$(wildcard schema-mods/*) ../../scripts/schema-gen.sh . +.updatecli-%.yaml: Chart.yaml + ../../scripts/charts-to-updatecli.sh Chart.yaml + .PHONY: clean clean: rm -f README.md values.schema.json .PHONY: build -build: README.md Chart.lock values.schema.json +build: README.md Chart.lock values.schema.json $(UPDATECLI_FILES) .PHONY: test test: build diff --git a/charts/feature-application-observability/Makefile b/charts/feature-application-observability/Makefile index 82a837825..8e322c3ef 100644 --- a/charts/feature-application-observability/Makefile +++ b/charts/feature-application-observability/Makefile @@ -1,5 +1,6 @@ HAS_HELM_DOCS := $(shell command -v helm-docs;) HAS_HELM_UNITTEST := $(shell helm plugin list | grep unittest 2> /dev/null) +UPDATECLI_FILES := $(shell yq -e '.dependencies[] | select(.repository == "http*") | ".updatecli-" + .name + ".yaml"' Chart.yaml | sort | uniq) .SECONDEXPANSION: README.md: values.yaml Chart.yaml $$(wildcard README.md.gotmpl) @@ -16,12 +17,15 @@ Chart.lock: Chart.yaml values.schema.json: values.yaml $$(wildcard schema-mods/*) ../../scripts/schema-gen.sh . +.updatecli-%.yaml: Chart.yaml + ../../scripts/charts-to-updatecli.sh Chart.yaml + .PHONY: clean clean: rm -f README.md values.schema.json .PHONY: build -build: README.md Chart.lock values.schema.json +build: README.md Chart.lock values.schema.json $(UPDATECLI_FILES) .PHONY: test test: build diff --git a/charts/feature-cluster-events/Makefile b/charts/feature-cluster-events/Makefile index 82a837825..8e322c3ef 100644 --- a/charts/feature-cluster-events/Makefile +++ b/charts/feature-cluster-events/Makefile @@ -1,5 +1,6 @@ HAS_HELM_DOCS := $(shell command -v helm-docs;) HAS_HELM_UNITTEST := $(shell helm plugin list | grep unittest 2> /dev/null) +UPDATECLI_FILES := $(shell yq -e '.dependencies[] | select(.repository == "http*") | ".updatecli-" + .name + ".yaml"' Chart.yaml | sort | uniq) .SECONDEXPANSION: README.md: values.yaml Chart.yaml $$(wildcard README.md.gotmpl) @@ -16,12 +17,15 @@ Chart.lock: Chart.yaml values.schema.json: values.yaml $$(wildcard schema-mods/*) ../../scripts/schema-gen.sh . +.updatecli-%.yaml: Chart.yaml + ../../scripts/charts-to-updatecli.sh Chart.yaml + .PHONY: clean clean: rm -f README.md values.schema.json .PHONY: build -build: README.md Chart.lock values.schema.json +build: README.md Chart.lock values.schema.json $(UPDATECLI_FILES) .PHONY: test test: build diff --git a/charts/feature-cluster-metrics/Makefile b/charts/feature-cluster-metrics/Makefile index 64990bba4..095a8ecab 100644 --- a/charts/feature-cluster-metrics/Makefile +++ b/charts/feature-cluster-metrics/Makefile @@ -1,5 +1,6 @@ HAS_HELM_DOCS := $(shell command -v helm-docs;) HAS_HELM_UNITTEST := $(shell helm plugin list | grep unittest 2> /dev/null) +UPDATECLI_FILES := $(shell yq -e '.dependencies[] | select(.repository == "http*") | ".updatecli-" + .name + ".yaml"' Chart.yaml | sort | uniq) .SECONDEXPANSION: README.md: values.yaml Chart.yaml $$(wildcard README.md.gotmpl) @@ -16,12 +17,15 @@ Chart.lock: Chart.yaml values.schema.json: values.yaml $$(wildcard schema-mods/*) ../../scripts/schema-gen.sh . +.updatecli-%.yaml: Chart.yaml + ../../scripts/charts-to-updatecli.sh Chart.yaml + .PHONY: clean clean: rm -f README.md values.schema.json .PHONY: build -build: README.md Chart.lock values.schema.json +build: README.md Chart.lock values.schema.json $(UPDATECLI_FILES) .PHONY: test test: build diff --git a/charts/feature-frontend-observability/Makefile b/charts/feature-frontend-observability/Makefile index 82a837825..8e322c3ef 100644 --- a/charts/feature-frontend-observability/Makefile +++ b/charts/feature-frontend-observability/Makefile @@ -1,5 +1,6 @@ HAS_HELM_DOCS := $(shell command -v helm-docs;) HAS_HELM_UNITTEST := $(shell helm plugin list | grep unittest 2> /dev/null) +UPDATECLI_FILES := $(shell yq -e '.dependencies[] | select(.repository == "http*") | ".updatecli-" + .name + ".yaml"' Chart.yaml | sort | uniq) .SECONDEXPANSION: README.md: values.yaml Chart.yaml $$(wildcard README.md.gotmpl) @@ -16,12 +17,15 @@ Chart.lock: Chart.yaml values.schema.json: values.yaml $$(wildcard schema-mods/*) ../../scripts/schema-gen.sh . +.updatecli-%.yaml: Chart.yaml + ../../scripts/charts-to-updatecli.sh Chart.yaml + .PHONY: clean clean: rm -f README.md values.schema.json .PHONY: build -build: README.md Chart.lock values.schema.json +build: README.md Chart.lock values.schema.json $(UPDATECLI_FILES) .PHONY: test test: build diff --git a/charts/feature-integrations/Makefile b/charts/feature-integrations/Makefile index 469ba242e..8c697bfb8 100644 --- a/charts/feature-integrations/Makefile +++ b/charts/feature-integrations/Makefile @@ -1,5 +1,6 @@ HAS_HELM_DOCS := $(shell command -v helm-docs;) HAS_HELM_UNITTEST := $(shell helm plugin list | grep unittest 2> /dev/null) +UPDATECLI_FILES := $(shell yq -e '.dependencies[] | select(.repository == "http*") | ".updatecli-" + .name + ".yaml"' Chart.yaml | sort | uniq) SCHEMA_MODS_JSON_FILES = $(shell find schema-mods -name "*.json") SCHEMA_MODS_JQ_FILES = $(shell find schema-mods -name "*.jq") @@ -54,6 +55,9 @@ templates/_integration_types.tpl: $(INTEGRATION_VALUES_FILES) values.schema.json: values.yaml $(INTEGRATION_SCHEMA_FILES) $(SCHEMA_MODS_JSON_FILES) $(SCHEMA_MODS_JQ_FILES) schema-mods/integration-list.json ../../scripts/schema-gen.sh . +.updatecli-%.yaml: Chart.yaml + ../../scripts/charts-to-updatecli.sh Chart.yaml + README.md: values.yaml Chart.yaml $$(wildcard README.md.gotmpl) ifdef HAS_HELM_DOCS helm-docs @@ -68,7 +72,7 @@ clean: rm -f $(INTEGRATION_DOCS_FILES) .PHONY: build -build: README.md $(INTEGRATION_DOCS_FILES) Chart.lock values.schema.json templates/_integration_types.tpl +build: README.md $(INTEGRATION_DOCS_FILES) Chart.lock values.schema.json templates/_integration_types.tpl $(UPDATECLI_FILES) .PHONY: test test: build diff --git a/charts/feature-pod-logs/Makefile b/charts/feature-pod-logs/Makefile index 82a837825..8e322c3ef 100644 --- a/charts/feature-pod-logs/Makefile +++ b/charts/feature-pod-logs/Makefile @@ -1,5 +1,6 @@ HAS_HELM_DOCS := $(shell command -v helm-docs;) HAS_HELM_UNITTEST := $(shell helm plugin list | grep unittest 2> /dev/null) +UPDATECLI_FILES := $(shell yq -e '.dependencies[] | select(.repository == "http*") | ".updatecli-" + .name + ".yaml"' Chart.yaml | sort | uniq) .SECONDEXPANSION: README.md: values.yaml Chart.yaml $$(wildcard README.md.gotmpl) @@ -16,12 +17,15 @@ Chart.lock: Chart.yaml values.schema.json: values.yaml $$(wildcard schema-mods/*) ../../scripts/schema-gen.sh . +.updatecli-%.yaml: Chart.yaml + ../../scripts/charts-to-updatecli.sh Chart.yaml + .PHONY: clean clean: rm -f README.md values.schema.json .PHONY: build -build: README.md Chart.lock values.schema.json +build: README.md Chart.lock values.schema.json $(UPDATECLI_FILES) .PHONY: test test: build diff --git a/charts/feature-profiling/Makefile b/charts/feature-profiling/Makefile index 82a837825..8e322c3ef 100644 --- a/charts/feature-profiling/Makefile +++ b/charts/feature-profiling/Makefile @@ -1,5 +1,6 @@ HAS_HELM_DOCS := $(shell command -v helm-docs;) HAS_HELM_UNITTEST := $(shell helm plugin list | grep unittest 2> /dev/null) +UPDATECLI_FILES := $(shell yq -e '.dependencies[] | select(.repository == "http*") | ".updatecli-" + .name + ".yaml"' Chart.yaml | sort | uniq) .SECONDEXPANSION: README.md: values.yaml Chart.yaml $$(wildcard README.md.gotmpl) @@ -16,12 +17,15 @@ Chart.lock: Chart.yaml values.schema.json: values.yaml $$(wildcard schema-mods/*) ../../scripts/schema-gen.sh . +.updatecli-%.yaml: Chart.yaml + ../../scripts/charts-to-updatecli.sh Chart.yaml + .PHONY: clean clean: rm -f README.md values.schema.json .PHONY: build -build: README.md Chart.lock values.schema.json +build: README.md Chart.lock values.schema.json $(UPDATECLI_FILES) .PHONY: test test: build diff --git a/charts/feature-prometheus-operator-objects/Makefile b/charts/feature-prometheus-operator-objects/Makefile index e5b91712b..4131e39ac 100644 --- a/charts/feature-prometheus-operator-objects/Makefile +++ b/charts/feature-prometheus-operator-objects/Makefile @@ -1,5 +1,6 @@ HAS_HELM_DOCS := $(shell command -v helm-docs;) HAS_HELM_UNITTEST := $(shell helm plugin list | grep unittest 2> /dev/null) +UPDATECLI_FILES := $(shell yq -e '.dependencies[] | select(.repository == "http*") | ".updatecli-" + .name + ".yaml"' Chart.yaml | sort | uniq) .SECONDEXPANSION: README.md: values.yaml Chart.yaml $$(wildcard README.md.gotmpl) @@ -16,12 +17,15 @@ Chart.lock: Chart.yaml values.schema.json: values.yaml $$(wildcard schema-mods/*) ../../scripts/schema-gen.sh . +.updatecli-%.yaml: Chart.yaml + ../../scripts/charts-to-updatecli.sh Chart.yaml + .PHONY: clean clean: rm -f README.md values.schema.json .PHONY: build -build: README.md Chart.lock values.schema.json +build: README.md Chart.lock values.schema.json $(UPDATECLI_FILES) .PHONY: test test: build diff --git a/charts/k8s-monitoring-test/Makefile b/charts/k8s-monitoring-test/Makefile index 82a837825..4131e39ac 100644 --- a/charts/k8s-monitoring-test/Makefile +++ b/charts/k8s-monitoring-test/Makefile @@ -1,5 +1,6 @@ HAS_HELM_DOCS := $(shell command -v helm-docs;) HAS_HELM_UNITTEST := $(shell helm plugin list | grep unittest 2> /dev/null) +UPDATECLI_FILES := $(shell yq -e '.dependencies[] | select(.repository == "http*") | ".updatecli-" + .name + ".yaml"' Chart.yaml | sort | uniq) .SECONDEXPANSION: README.md: values.yaml Chart.yaml $$(wildcard README.md.gotmpl) @@ -16,15 +17,19 @@ Chart.lock: Chart.yaml values.schema.json: values.yaml $$(wildcard schema-mods/*) ../../scripts/schema-gen.sh . +.updatecli-%.yaml: Chart.yaml + ../../scripts/charts-to-updatecli.sh Chart.yaml + .PHONY: clean clean: rm -f README.md values.schema.json .PHONY: build -build: README.md Chart.lock values.schema.json +build: README.md Chart.lock values.schema.json $(UPDATECLI_FILES) .PHONY: test test: build + helm repo add prometheus-community https://prometheus-community.github.io/helm-charts helm lint . ct lint --lint-conf ../../.configs/lintconf.yaml --check-version-increment=false --helm-dependency-extra-args=--skip-refresh --charts . ifdef HAS_HELM_UNITTEST diff --git a/.github/configs/updatecli.d/alloy.yaml b/charts/k8s-monitoring-v1/.updatecli-alloy.yaml similarity index 87% rename from .github/configs/updatecli.d/alloy.yaml rename to charts/k8s-monitoring-v1/.updatecli-alloy.yaml index c4fabf010..fb43bf09d 100644 --- a/.github/configs/updatecli.d/alloy.yaml +++ b/charts/k8s-monitoring-v1/.updatecli-alloy.yaml @@ -15,7 +15,7 @@ conditions: name: Ensure Helm chart dependency "alloy" is specified kind: yaml spec: - file: charts/k8s-monitoring-v1/Chart.yaml + file: charts/k8s-monitoring/Chart.yaml key: $.dependencies[0].name value: alloy disablesourceinput: true @@ -26,7 +26,7 @@ targets: spec: file: Chart.yaml key: $.dependencies[0].version - name: charts/k8s-monitoring-v1 + name: charts/k8s-monitoring versionincrement: none sourceid: alloy alloy-events: @@ -35,7 +35,7 @@ targets: spec: file: Chart.yaml key: $.dependencies[1].version - name: charts/k8s-monitoring-v1 + name: charts/k8s-monitoring versionincrement: none sourceid: alloy alloy-logs: @@ -44,7 +44,7 @@ targets: spec: file: Chart.yaml key: $.dependencies[2].version - name: charts/k8s-monitoring-v1 + name: charts/k8s-monitoring versionincrement: none sourceid: alloy alloy-profiles: @@ -53,6 +53,6 @@ targets: spec: file: Chart.yaml key: $.dependencies[3].version - name: charts/k8s-monitoring-v1 + name: charts/k8s-monitoring versionincrement: none sourceid: alloy diff --git a/.github/configs/updatecli.d/beyla.yaml b/charts/k8s-monitoring-v1/.updatecli-beyla.yaml similarity index 89% rename from .github/configs/updatecli.d/beyla.yaml rename to charts/k8s-monitoring-v1/.updatecli-beyla.yaml index a7f8b2dd3..3f196379d 100644 --- a/.github/configs/updatecli.d/beyla.yaml +++ b/charts/k8s-monitoring-v1/.updatecli-beyla.yaml @@ -10,17 +10,15 @@ sources: versionfilter: kind: semver pattern: '*' - conditions: beyla: name: Ensure Helm chart dependency "beyla" is specified kind: yaml spec: - file: charts/k8s-monitoring-v1/Chart.yaml + file: charts/k8s-monitoring/Chart.yaml key: $.dependencies[10].name value: beyla disablesourceinput: true - targets: beyla: name: Bump Helm chart dependency "beyla" for Helm chart "k8s-monitoring" @@ -28,6 +26,6 @@ targets: spec: file: Chart.yaml key: $.dependencies[10].version - name: charts/k8s-monitoring-v1 + name: charts/k8s-monitoring versionincrement: none sourceid: beyla diff --git a/.github/configs/updatecli.d/kepler.yaml b/charts/k8s-monitoring-v1/.updatecli-kepler.yaml similarity index 89% rename from .github/configs/updatecli.d/kepler.yaml rename to charts/k8s-monitoring-v1/.updatecli-kepler.yaml index 00adbd4c3..118ceaf2b 100644 --- a/.github/configs/updatecli.d/kepler.yaml +++ b/charts/k8s-monitoring-v1/.updatecli-kepler.yaml @@ -10,17 +10,15 @@ sources: versionfilter: kind: semver pattern: '*' - conditions: kepler: name: Ensure Helm chart dependency "kepler" is specified kind: yaml spec: - file: charts/k8s-monitoring-v1/Chart.yaml + file: charts/k8s-monitoring/Chart.yaml key: $.dependencies[9].name value: kepler disablesourceinput: true - targets: kepler: name: Bump Helm chart dependency "kepler" for Helm chart "k8s-monitoring" @@ -28,6 +26,6 @@ targets: spec: file: Chart.yaml key: $.dependencies[9].version - name: charts/k8s-monitoring-v1 + name: charts/k8s-monitoring versionincrement: none sourceid: kepler diff --git a/.github/configs/updatecli.d/kube-state-metrics.yaml b/charts/k8s-monitoring-v1/.updatecli-kube-state-metrics.yaml similarity index 90% rename from .github/configs/updatecli.d/kube-state-metrics.yaml rename to charts/k8s-monitoring-v1/.updatecli-kube-state-metrics.yaml index c49f73a53..c318820e4 100644 --- a/.github/configs/updatecli.d/kube-state-metrics.yaml +++ b/charts/k8s-monitoring-v1/.updatecli-kube-state-metrics.yaml @@ -15,7 +15,7 @@ conditions: name: Ensure Helm chart dependency "kube-state-metrics" is specified kind: yaml spec: - file: charts/k8s-monitoring-v1/Chart.yaml + file: charts/k8s-monitoring/Chart.yaml key: $.dependencies[4].name value: kube-state-metrics disablesourceinput: true @@ -26,6 +26,6 @@ targets: spec: file: Chart.yaml key: $.dependencies[4].version - name: charts/k8s-monitoring-v1 + name: charts/k8s-monitoring versionincrement: none sourceid: kube-state-metrics diff --git a/.github/configs/updatecli.d/opencost.yaml b/charts/k8s-monitoring-v1/.updatecli-opencost.yaml similarity index 89% rename from .github/configs/updatecli.d/opencost.yaml rename to charts/k8s-monitoring-v1/.updatecli-opencost.yaml index 8dd8c0925..4bb89284f 100644 --- a/.github/configs/updatecli.d/opencost.yaml +++ b/charts/k8s-monitoring-v1/.updatecli-opencost.yaml @@ -15,7 +15,7 @@ conditions: name: Ensure Helm chart dependency "opencost" is specified kind: yaml spec: - file: charts/k8s-monitoring-v1/Chart.yaml + file: charts/k8s-monitoring/Chart.yaml key: $.dependencies[8].name value: opencost disablesourceinput: true @@ -26,6 +26,6 @@ targets: spec: file: Chart.yaml key: $.dependencies[8].version - name: charts/k8s-monitoring-v1 + name: charts/k8s-monitoring versionincrement: none sourceid: opencost diff --git a/.github/configs/updatecli.d/node-exporter.yaml b/charts/k8s-monitoring-v1/.updatecli-prometheus-node-exporter.yaml similarity index 91% rename from .github/configs/updatecli.d/node-exporter.yaml rename to charts/k8s-monitoring-v1/.updatecli-prometheus-node-exporter.yaml index b26191532..37acb4b0f 100644 --- a/.github/configs/updatecli.d/node-exporter.yaml +++ b/charts/k8s-monitoring-v1/.updatecli-prometheus-node-exporter.yaml @@ -10,17 +10,15 @@ sources: versionfilter: kind: semver pattern: '*' - conditions: prometheus-node-exporter: name: Ensure Helm chart dependency "prometheus-node-exporter" is specified kind: yaml spec: - file: charts/k8s-monitoring-v1/Chart.yaml + file: charts/k8s-monitoring/Chart.yaml key: $.dependencies[5].name value: prometheus-node-exporter disablesourceinput: true - targets: prometheus-node-exporter: name: Bump Helm chart dependency "prometheus-node-exporter" for Helm chart "k8s-monitoring" @@ -28,6 +26,6 @@ targets: spec: file: Chart.yaml key: $.dependencies[5].version - name: charts/k8s-monitoring-v1 + name: charts/k8s-monitoring versionincrement: none sourceid: prometheus-node-exporter diff --git a/.github/configs/updatecli.d/prometheus-operator-crds.yaml b/charts/k8s-monitoring-v1/.updatecli-prometheus-operator-crds.yaml similarity index 91% rename from .github/configs/updatecli.d/prometheus-operator-crds.yaml rename to charts/k8s-monitoring-v1/.updatecli-prometheus-operator-crds.yaml index 42e646b5e..3c45aef40 100644 --- a/.github/configs/updatecli.d/prometheus-operator-crds.yaml +++ b/charts/k8s-monitoring-v1/.updatecli-prometheus-operator-crds.yaml @@ -15,7 +15,7 @@ conditions: name: Ensure Helm chart dependency "prometheus-operator-crds" is specified kind: yaml spec: - file: charts/k8s-monitoring-v1/Chart.yaml + file: charts/k8s-monitoring/Chart.yaml key: $.dependencies[6].name value: prometheus-operator-crds disablesourceinput: true @@ -26,6 +26,6 @@ targets: spec: file: Chart.yaml key: $.dependencies[6].version - name: charts/k8s-monitoring-v1 + name: charts/k8s-monitoring versionincrement: none sourceid: prometheus-operator-crds diff --git a/.github/configs/updatecli.d/windows-exporter.yaml b/charts/k8s-monitoring-v1/.updatecli-prometheus-windows-exporter.yaml similarity index 91% rename from .github/configs/updatecli.d/windows-exporter.yaml rename to charts/k8s-monitoring-v1/.updatecli-prometheus-windows-exporter.yaml index 1502a3350..2dac044f2 100644 --- a/.github/configs/updatecli.d/windows-exporter.yaml +++ b/charts/k8s-monitoring-v1/.updatecli-prometheus-windows-exporter.yaml @@ -15,7 +15,7 @@ conditions: name: Ensure Helm chart dependency "prometheus-windows-exporter" is specified kind: yaml spec: - file: charts/k8s-monitoring-v1/Chart.yaml + file: charts/k8s-monitoring/Chart.yaml key: $.dependencies[7].name value: prometheus-windows-exporter disablesourceinput: true @@ -26,6 +26,6 @@ targets: spec: file: Chart.yaml key: $.dependencies[7].version - name: charts/k8s-monitoring-v1 + name: charts/k8s-monitoring versionincrement: none sourceid: prometheus-windows-exporter diff --git a/charts/k8s-monitoring-v1/Makefile b/charts/k8s-monitoring-v1/Makefile index 21f52ab7c..54f853d9c 100644 --- a/charts/k8s-monitoring-v1/Makefile +++ b/charts/k8s-monitoring-v1/Makefile @@ -1,7 +1,9 @@ SHELL := /bin/bash +HAS_HELM_DOCS := $(shell command -v helm-docs;) CHART_TEMPLATE_FILES = $(shell find templates -name "*.tpl") CHART_YAML_FILES = $(shell find templates -name "*.yaml") +UPDATECLI_FILES := $(shell yq -e '.dependencies[] | select(.repository == "http*") | ".updatecli-" + .name + ".yaml"' Chart.yaml | sort | uniq) values.schema.json: values.yaml schema-mods/enums-and-types.json schema-mods/required-values.json docker run -it --rm --platform linux/amd64 -v "$(shell pwd):/chart" --entrypoint sh alpine/helm \ @@ -44,8 +46,8 @@ values.schema.json: values.yaml schema-mods/enums-and-types.json schema-mods/req rm values.schema.generated.json -HAS_HELM_DOCS := $(shell command -v helm-docs;) - +.updatecli-%.yaml: Chart.yaml + ../../scripts/charts-to-updatecli.sh Chart.yaml README.md: README.md.gotmpl values.yaml Chart.yaml ifdef HAS_HELM_DOCS @@ -157,7 +159,7 @@ alloy_configs = $(shell \ examples: $(EXAMPLE_OUTPUT_FILES) $(EXAMPLE_ALLOY_FILES) .PHONY: build -build: README.md examples values.schema.json +build: README.md examples values.schema.json $(UPDATECLI_FILES) .PHONY: clean clean: diff --git a/charts/k8s-monitoring/Makefile b/charts/k8s-monitoring/Makefile index afb27f2d9..6e0679848 100644 --- a/charts/k8s-monitoring/Makefile +++ b/charts/k8s-monitoring/Makefile @@ -4,6 +4,7 @@ HAS_SHELLSPEC := $(shell command -v shellspec;) CHART_TEMPLATE_FILES = $(shell find templates -name "*.tpl") CHART_YAML_FILES = $(shell find templates -name "*.yaml") +UPDATECLI_FILES := $(shell yq -e '.dependencies[] | select(.repository == "http*") | ".updatecli-" + .name + ".yaml"' Chart.yaml | sort | uniq) SCHEMA_MODS_JSON_FILES = $(shell find schema-mods -name "*.json") SCHEMA_MODS_JQ_FILES = $(shell find schema-mods -name "*.jq") @@ -53,6 +54,9 @@ templates/destinations/_destination_types.tpl: $(DESTINATION_VALUES_FILES) values.schema.json: values.yaml $(DESTINATION_SCHEMA_FILES) $(SCHEMA_MODS_JSON_FILES) $(SCHEMA_MODS_JQ_FILES) schema-mods/destination-list.json ../../scripts/schema-gen.sh . +.updatecli-%.yaml: Chart.yaml + ../../scripts/charts-to-updatecli.sh Chart.yaml + README.md: README.md.gotmpl values.yaml Chart.yaml ifdef HAS_HELM_DOCS helm-docs --chart-to-generate . @@ -131,7 +135,7 @@ clean: # Build targets .PHONY: build -build: README.md values.schema.json templates/destinations/_destination_types.tpl $(DESTINATION_DOCS_FILES) examples +build: README.md values.schema.json templates/destinations/_destination_types.tpl $(DESTINATION_DOCS_FILES) $(UPDATECLI_FILES) examples # Test targets .PHONY: test unittest lint-helm lint-configs diff --git a/scripts/charts-to-updatecli.sh b/scripts/charts-to-updatecli.sh index e8075ff19..9bb3732fd 100755 --- a/scripts/charts-to-updatecli.sh +++ b/scripts/charts-to-updatecli.sh @@ -22,7 +22,7 @@ for ((i=0; i ".updatecli-${chart}.yaml" yq eval --null-input "{ - \"name\": \"Bump dependency \\\"$chart\\\" for Helm chart \\\"$chartName\\\"\", + \"name\": \"Update dependency \\\"$chart\\\" for Helm chart \\\"$chartName\\\"\", \"sources\": { \"$chart\": { \"name\": \"Get latest \\\"$chart\\\" Helm chart version\", From 64b3b42178b15e5aac487a0f4bf6a9f19dd8068b Mon Sep 17 00:00:00 2001 From: Pete Wall Date: Fri, 11 Oct 2024 15:15:22 -0500 Subject: [PATCH 03/10] quote this line Signed-off-by: Pete Wall --- .github/workflows/check-for-dependency-updates.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-for-dependency-updates.yaml b/.github/workflows/check-for-dependency-updates.yaml index f68b793bd..7366b5928 100644 --- a/.github/workflows/check-for-dependency-updates.yaml +++ b/.github/workflows/check-for-dependency-updates.yaml @@ -76,7 +76,7 @@ jobs: if: steps.update-dependency.outputs.changed == 'true' uses: peter-evans/create-pull-request@v7 with: - title: [dependency] ${{ steps.get-details.outputs.title }} to ${{ steps.get-details.outputs.version }} + title: "[dependency] ${{ steps.get-details.outputs.title }} to ${{ steps.get-details.outputs.version }}" body: ${{ steps.get-details.outputs.title }} to ${{ steps.get-details.outputs.version }} base: main author: "${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>" From 25b90a55daf68d05f6cf1f23c14b1e934b1d5ade Mon Sep 17 00:00:00 2001 From: Pete Wall Date: Fri, 11 Oct 2024 16:14:27 -0500 Subject: [PATCH 04/10] Run on PR when modifying the workflow Signed-off-by: Pete Wall --- .github/workflows/check-for-dependency-updates.yaml | 3 +++ charts/feature-annotation-autodiscovery/Makefile | 2 +- charts/feature-application-observability/Makefile | 2 +- charts/feature-cluster-events/Makefile | 2 +- charts/feature-cluster-metrics/Makefile | 2 +- charts/feature-frontend-observability/Makefile | 2 +- charts/feature-integrations/Makefile | 1 + charts/feature-pod-logs/Makefile | 2 +- charts/feature-profiling/Makefile | 2 +- charts/feature-prometheus-operator-objects/Makefile | 2 +- charts/k8s-monitoring-test/Makefile | 2 +- charts/k8s-monitoring-v1/Makefile | 2 +- charts/k8s-monitoring/.updatecli-alloy.yaml | 2 +- charts/k8s-monitoring/Makefile | 2 +- 14 files changed, 16 insertions(+), 12 deletions(-) diff --git a/.github/workflows/check-for-dependency-updates.yaml b/.github/workflows/check-for-dependency-updates.yaml index 7366b5928..7494f2c42 100644 --- a/.github/workflows/check-for-dependency-updates.yaml +++ b/.github/workflows/check-for-dependency-updates.yaml @@ -6,6 +6,9 @@ on: schedule: # Run once a day - cron: '0 0 * * *' + pull_request: + paths: + - '.github/workflows/check-for-dependency-updates.yaml' permissions: contents: "write" diff --git a/charts/feature-annotation-autodiscovery/Makefile b/charts/feature-annotation-autodiscovery/Makefile index 8e322c3ef..03e4c3e85 100644 --- a/charts/feature-annotation-autodiscovery/Makefile +++ b/charts/feature-annotation-autodiscovery/Makefile @@ -22,7 +22,7 @@ values.schema.json: values.yaml $$(wildcard schema-mods/*) .PHONY: clean clean: - rm -f README.md values.schema.json + rm -f README.md values.schema.json $(UPDATECLI_FILES) .PHONY: build build: README.md Chart.lock values.schema.json $(UPDATECLI_FILES) diff --git a/charts/feature-application-observability/Makefile b/charts/feature-application-observability/Makefile index 8e322c3ef..03e4c3e85 100644 --- a/charts/feature-application-observability/Makefile +++ b/charts/feature-application-observability/Makefile @@ -22,7 +22,7 @@ values.schema.json: values.yaml $$(wildcard schema-mods/*) .PHONY: clean clean: - rm -f README.md values.schema.json + rm -f README.md values.schema.json $(UPDATECLI_FILES) .PHONY: build build: README.md Chart.lock values.schema.json $(UPDATECLI_FILES) diff --git a/charts/feature-cluster-events/Makefile b/charts/feature-cluster-events/Makefile index 8e322c3ef..03e4c3e85 100644 --- a/charts/feature-cluster-events/Makefile +++ b/charts/feature-cluster-events/Makefile @@ -22,7 +22,7 @@ values.schema.json: values.yaml $$(wildcard schema-mods/*) .PHONY: clean clean: - rm -f README.md values.schema.json + rm -f README.md values.schema.json $(UPDATECLI_FILES) .PHONY: build build: README.md Chart.lock values.schema.json $(UPDATECLI_FILES) diff --git a/charts/feature-cluster-metrics/Makefile b/charts/feature-cluster-metrics/Makefile index 095a8ecab..26ce3bdff 100644 --- a/charts/feature-cluster-metrics/Makefile +++ b/charts/feature-cluster-metrics/Makefile @@ -22,7 +22,7 @@ values.schema.json: values.yaml $$(wildcard schema-mods/*) .PHONY: clean clean: - rm -f README.md values.schema.json + rm -f README.md values.schema.json $(UPDATECLI_FILES) .PHONY: build build: README.md Chart.lock values.schema.json $(UPDATECLI_FILES) diff --git a/charts/feature-frontend-observability/Makefile b/charts/feature-frontend-observability/Makefile index 8e322c3ef..03e4c3e85 100644 --- a/charts/feature-frontend-observability/Makefile +++ b/charts/feature-frontend-observability/Makefile @@ -22,7 +22,7 @@ values.schema.json: values.yaml $$(wildcard schema-mods/*) .PHONY: clean clean: - rm -f README.md values.schema.json + rm -f README.md values.schema.json $(UPDATECLI_FILES) .PHONY: build build: README.md Chart.lock values.schema.json $(UPDATECLI_FILES) diff --git a/charts/feature-integrations/Makefile b/charts/feature-integrations/Makefile index 8c697bfb8..c2ccc6027 100644 --- a/charts/feature-integrations/Makefile +++ b/charts/feature-integrations/Makefile @@ -68,6 +68,7 @@ endif .PHONY: clean clean: rm -f README.md values.schema.json schema-mods/integration-list.json templates/_integration_types.tpl + rm -f $(UPDATECLI_FILES) rm -f $(INTEGRATION_SCHEMA_FILES) rm -f $(INTEGRATION_DOCS_FILES) diff --git a/charts/feature-pod-logs/Makefile b/charts/feature-pod-logs/Makefile index 8e322c3ef..03e4c3e85 100644 --- a/charts/feature-pod-logs/Makefile +++ b/charts/feature-pod-logs/Makefile @@ -22,7 +22,7 @@ values.schema.json: values.yaml $$(wildcard schema-mods/*) .PHONY: clean clean: - rm -f README.md values.schema.json + rm -f README.md values.schema.json $(UPDATECLI_FILES) .PHONY: build build: README.md Chart.lock values.schema.json $(UPDATECLI_FILES) diff --git a/charts/feature-profiling/Makefile b/charts/feature-profiling/Makefile index 8e322c3ef..03e4c3e85 100644 --- a/charts/feature-profiling/Makefile +++ b/charts/feature-profiling/Makefile @@ -22,7 +22,7 @@ values.schema.json: values.yaml $$(wildcard schema-mods/*) .PHONY: clean clean: - rm -f README.md values.schema.json + rm -f README.md values.schema.json $(UPDATECLI_FILES) .PHONY: build build: README.md Chart.lock values.schema.json $(UPDATECLI_FILES) diff --git a/charts/feature-prometheus-operator-objects/Makefile b/charts/feature-prometheus-operator-objects/Makefile index 4131e39ac..15dc56c10 100644 --- a/charts/feature-prometheus-operator-objects/Makefile +++ b/charts/feature-prometheus-operator-objects/Makefile @@ -22,7 +22,7 @@ values.schema.json: values.yaml $$(wildcard schema-mods/*) .PHONY: clean clean: - rm -f README.md values.schema.json + rm -f README.md values.schema.json $(UPDATECLI_FILES) .PHONY: build build: README.md Chart.lock values.schema.json $(UPDATECLI_FILES) diff --git a/charts/k8s-monitoring-test/Makefile b/charts/k8s-monitoring-test/Makefile index 4131e39ac..15dc56c10 100644 --- a/charts/k8s-monitoring-test/Makefile +++ b/charts/k8s-monitoring-test/Makefile @@ -22,7 +22,7 @@ values.schema.json: values.yaml $$(wildcard schema-mods/*) .PHONY: clean clean: - rm -f README.md values.schema.json + rm -f README.md values.schema.json $(UPDATECLI_FILES) .PHONY: build build: README.md Chart.lock values.schema.json $(UPDATECLI_FILES) diff --git a/charts/k8s-monitoring-v1/Makefile b/charts/k8s-monitoring-v1/Makefile index 54f853d9c..17fe60024 100644 --- a/charts/k8s-monitoring-v1/Makefile +++ b/charts/k8s-monitoring-v1/Makefile @@ -163,4 +163,4 @@ build: README.md examples values.schema.json $(UPDATECLI_FILES) .PHONY: clean clean: - rm -f $(EXAMPLE_OUTPUT_FILES) $(EXAMPLE_ALLOY_FILES) + rm -f README.md values.schema.json $(EXAMPLE_OUTPUT_FILES) $(EXAMPLE_ALLOY_FILES) $(UPDATECLI_FILES) diff --git a/charts/k8s-monitoring/.updatecli-alloy.yaml b/charts/k8s-monitoring/.updatecli-alloy.yaml index b594dc947..b94001f48 100644 --- a/charts/k8s-monitoring/.updatecli-alloy.yaml +++ b/charts/k8s-monitoring/.updatecli-alloy.yaml @@ -1,5 +1,5 @@ --- -name: Bump dependency "alloy" for Helm chart "k8s-monitoring" +name: Update dependency "alloy" for Helm chart "k8s-monitoring" sources: alloy: name: Get latest "alloy" Helm chart version diff --git a/charts/k8s-monitoring/Makefile b/charts/k8s-monitoring/Makefile index 6e0679848..ac0c109cf 100644 --- a/charts/k8s-monitoring/Makefile +++ b/charts/k8s-monitoring/Makefile @@ -130,7 +130,7 @@ endif .PHONY: clean clean: - rm -f README.md values.schema.json templates/destinations/_destination_types.tpl schema-mods/destination-list.json $(DESTINATION_SCHEMA_FILES) $(DESTINATION_DOCS_FILES) + rm -f README.md values.schema.json $(UPDATECLI_FILES) templates/destinations/_destination_types.tpl schema-mods/destination-list.json $(DESTINATION_SCHEMA_FILES) $(DESTINATION_DOCS_FILES) rm -f $(EXAMPLE_OUTPUT_FILES) $(EXAMPLE_ALLOY_FILES) $(EXAMPLE_README_FILES) # Build targets From 253b556046b41085ad57b136adb19e2d8ce13b40 Mon Sep 17 00:00:00 2001 From: Pete Wall Date: Fri, 11 Oct 2024 16:29:12 -0500 Subject: [PATCH 05/10] Remove requirements and improve the branch name Signed-off-by: Pete Wall --- .../check-for-dependency-updates.yaml | 10 +++++++--- charts/k8s-monitoring/README.md | 19 ------------------- charts/k8s-monitoring/README.md.gotmpl | 2 -- 3 files changed, 7 insertions(+), 24 deletions(-) diff --git a/.github/workflows/check-for-dependency-updates.yaml b/.github/workflows/check-for-dependency-updates.yaml index 7494f2c42..c13c95c8d 100644 --- a/.github/workflows/check-for-dependency-updates.yaml +++ b/.github/workflows/check-for-dependency-updates.yaml @@ -70,10 +70,14 @@ jobs: - name: Get details id: get-details run: | + echo "title=$(yq eval ".name" "${{ matrix.config }}")" >> "${GITHUB_OUTPUT}" + versionPath="$(yq eval '.targets.*.spec.key' "${{ matrix.config }}" | head -n 1 | cut -c2-)" echo "version=$(yq eval "${versionPath}" "$(dirname "${{ matrix.config }}")/Chart.yaml")" >> "${GITHUB_OUTPUT}" - echo "chart=$(basename "${{ matrix.config }}" | sed -e "s/.updatecli-\(.*\)\.yaml/\1/")" >> "${GITHUB_OUTPUT}" - echo "title=$(yq eval ".name" "${{ matrix.config }}")" >> "${GITHUB_OUTPUT}" + + chart="$(basename "$(dirname "${{ matrix.config }}")")" >> "${GITHUB_OUTPUT}" + dep="$(basename "${{ matrix.config }}" | sed -e "s/.updatecli-\(.*\)\.yaml/\1/")" + echo "branch=chore/update-${chart}-${dep}" >> "${GITHUB_OUTPUT}" - name: Create pull request if: steps.update-dependency.outputs.changed == 'true' @@ -86,5 +90,5 @@ jobs: committer: "GitHub " commit-message: Update ${{ steps.get-details.outputs.title }} to ${{ steps.get-details.outputs.version }} labels: dependencies - branch: chore/update-${{ steps.get-details.outputs.chart }} + branch: ${{ steps.get-details.outputs.branch }} delete-branch: true diff --git a/charts/k8s-monitoring/README.md b/charts/k8s-monitoring/README.md index 9535595fe..17636fdfd 100644 --- a/charts/k8s-monitoring/README.md +++ b/charts/k8s-monitoring/README.md @@ -118,25 +118,6 @@ podLogs: * - -## Requirements - -| Repository | Name | Version | -|------------|------|---------| -| file://../feature-annotation-autodiscovery | annotationAutodiscovery(k8s-monitoring-feature-annotation-autodiscovery) | 1.0.0 | -| file://../feature-application-observability | applicationObservability(k8s-monitoring-feature-application-observability) | 1.0.0 | -| file://../feature-cluster-events | clusterEvents(k8s-monitoring-feature-cluster-events) | 1.0.0 | -| file://../feature-cluster-metrics | clusterMetrics(k8s-monitoring-feature-cluster-metrics) | 1.0.0 | -| file://../feature-frontend-observability | frontendObservability(k8s-monitoring-feature-frontend-observability) | 1.0.0 | -| file://../feature-integrations | integrations(k8s-monitoring-feature-integrations) | 1.0.0 | -| file://../feature-pod-logs | podLogs(k8s-monitoring-feature-pod-logs) | 1.0.0 | -| file://../feature-profiling | profiling(k8s-monitoring-feature-profiling) | 1.0.0 | -| file://../feature-prometheus-operator-objects | prometheusOperatorObjects(k8s-monitoring-feature-prometheus-operator-objects) | 1.0.0 | -| https://grafana.github.io/helm-charts | alloy-metrics(alloy) | 0.7.0 | -| https://grafana.github.io/helm-charts | alloy-singleton(alloy) | 0.7.0 | -| https://grafana.github.io/helm-charts | alloy-logs(alloy) | 0.7.0 | -| https://grafana.github.io/helm-charts | alloy-receiver(alloy) | 0.7.0 | -| https://grafana.github.io/helm-charts | alloy-profiles(alloy) | 0.7.0 | ## Values diff --git a/charts/k8s-monitoring/README.md.gotmpl b/charts/k8s-monitoring/README.md.gotmpl index c2769e771..5c7c416a0 100644 --- a/charts/k8s-monitoring/README.md.gotmpl +++ b/charts/k8s-monitoring/README.md.gotmpl @@ -115,8 +115,6 @@ podLogs: {{ template "chart.sourcesSection" . }} - -{{ template "chart.requirementsSection" . }} {{ template "chart.valuesSection" . }} From 7ded18e3c7437db0df591d0576bfcbccca7f2cbe Mon Sep 17 00:00:00 2001 From: Pete Wall Date: Fri, 11 Oct 2024 16:39:28 -0500 Subject: [PATCH 06/10] Update generated files Signed-off-by: Pete Wall --- charts/feature-cluster-metrics/.updatecli-kepler.yaml | 2 +- .../feature-cluster-metrics/.updatecli-kube-state-metrics.yaml | 2 +- .../.updatecli-prometheus-node-exporter.yaml | 2 +- .../.updatecli-prometheus-windows-exporter.yaml | 2 +- .../.updatecli-prometheus-operator-crds.yaml | 2 +- charts/k8s-monitoring-v1/.updatecli-alloy.yaml | 2 +- charts/k8s-monitoring-v1/.updatecli-beyla.yaml | 2 +- charts/k8s-monitoring-v1/.updatecli-kepler.yaml | 2 +- charts/k8s-monitoring-v1/.updatecli-kube-state-metrics.yaml | 2 +- charts/k8s-monitoring-v1/.updatecli-opencost.yaml | 2 +- .../k8s-monitoring-v1/.updatecli-prometheus-node-exporter.yaml | 2 +- .../k8s-monitoring-v1/.updatecli-prometheus-operator-crds.yaml | 2 +- .../.updatecli-prometheus-windows-exporter.yaml | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/charts/feature-cluster-metrics/.updatecli-kepler.yaml b/charts/feature-cluster-metrics/.updatecli-kepler.yaml index 72eab3f10..a4f1ea340 100644 --- a/charts/feature-cluster-metrics/.updatecli-kepler.yaml +++ b/charts/feature-cluster-metrics/.updatecli-kepler.yaml @@ -1,5 +1,5 @@ --- -name: Bump dependency "kepler" for Helm chart "k8s-monitoring-feature-cluster-metrics" +name: Update dependency "kepler" for Helm chart "k8s-monitoring-feature-cluster-metrics" sources: kepler: name: Get latest "kepler" Helm chart version diff --git a/charts/feature-cluster-metrics/.updatecli-kube-state-metrics.yaml b/charts/feature-cluster-metrics/.updatecli-kube-state-metrics.yaml index 8aabe1315..5cf4f4275 100644 --- a/charts/feature-cluster-metrics/.updatecli-kube-state-metrics.yaml +++ b/charts/feature-cluster-metrics/.updatecli-kube-state-metrics.yaml @@ -1,5 +1,5 @@ --- -name: Bump dependency "kube-state-metrics" for Helm chart "k8s-monitoring-feature-cluster-metrics" +name: Update dependency "kube-state-metrics" for Helm chart "k8s-monitoring-feature-cluster-metrics" sources: kube-state-metrics: name: Get latest "kube-state-metrics" Helm chart version diff --git a/charts/feature-cluster-metrics/.updatecli-prometheus-node-exporter.yaml b/charts/feature-cluster-metrics/.updatecli-prometheus-node-exporter.yaml index 79c2c7816..484dab563 100644 --- a/charts/feature-cluster-metrics/.updatecli-prometheus-node-exporter.yaml +++ b/charts/feature-cluster-metrics/.updatecli-prometheus-node-exporter.yaml @@ -1,5 +1,5 @@ --- -name: Bump dependency "prometheus-node-exporter" for Helm chart "k8s-monitoring-feature-cluster-metrics" +name: Update dependency "prometheus-node-exporter" for Helm chart "k8s-monitoring-feature-cluster-metrics" sources: prometheus-node-exporter: name: Get latest "prometheus-node-exporter" Helm chart version diff --git a/charts/feature-cluster-metrics/.updatecli-prometheus-windows-exporter.yaml b/charts/feature-cluster-metrics/.updatecli-prometheus-windows-exporter.yaml index cef387e62..6563438a8 100644 --- a/charts/feature-cluster-metrics/.updatecli-prometheus-windows-exporter.yaml +++ b/charts/feature-cluster-metrics/.updatecli-prometheus-windows-exporter.yaml @@ -1,5 +1,5 @@ --- -name: Bump dependency "prometheus-windows-exporter" for Helm chart "k8s-monitoring-feature-cluster-metrics" +name: Update dependency "prometheus-windows-exporter" for Helm chart "k8s-monitoring-feature-cluster-metrics" sources: prometheus-windows-exporter: name: Get latest "prometheus-windows-exporter" Helm chart version diff --git a/charts/feature-prometheus-operator-objects/.updatecli-prometheus-operator-crds.yaml b/charts/feature-prometheus-operator-objects/.updatecli-prometheus-operator-crds.yaml index 4125b2703..ef8ec55e1 100644 --- a/charts/feature-prometheus-operator-objects/.updatecli-prometheus-operator-crds.yaml +++ b/charts/feature-prometheus-operator-objects/.updatecli-prometheus-operator-crds.yaml @@ -1,5 +1,5 @@ --- -name: Bump dependency "prometheus-operator-crds" for Helm chart "k8s-monitoring-feature-prometheus-operator-objects" +name: Update dependency "prometheus-operator-crds" for Helm chart "k8s-monitoring-feature-prometheus-operator-objects" sources: prometheus-operator-crds: name: Get latest "prometheus-operator-crds" Helm chart version diff --git a/charts/k8s-monitoring-v1/.updatecli-alloy.yaml b/charts/k8s-monitoring-v1/.updatecli-alloy.yaml index fb43bf09d..1ebd43de1 100644 --- a/charts/k8s-monitoring-v1/.updatecli-alloy.yaml +++ b/charts/k8s-monitoring-v1/.updatecli-alloy.yaml @@ -1,5 +1,5 @@ --- -name: Bump dependency "alloy" for Helm chart "k8s-monitoring" +name: Update dependency "alloy" for Helm chart "k8s-monitoring" sources: alloy: name: Get latest "alloy" Helm chart version diff --git a/charts/k8s-monitoring-v1/.updatecli-beyla.yaml b/charts/k8s-monitoring-v1/.updatecli-beyla.yaml index 3f196379d..cf3a6475f 100644 --- a/charts/k8s-monitoring-v1/.updatecli-beyla.yaml +++ b/charts/k8s-monitoring-v1/.updatecli-beyla.yaml @@ -1,5 +1,5 @@ --- -name: Bump dependency "beyla" for Helm chart "k8s-monitoring" +name: Update dependency "beyla" for Helm chart "k8s-monitoring" sources: beyla: name: Get latest "beyla" Helm chart version diff --git a/charts/k8s-monitoring-v1/.updatecli-kepler.yaml b/charts/k8s-monitoring-v1/.updatecli-kepler.yaml index 118ceaf2b..6dc0fda7b 100644 --- a/charts/k8s-monitoring-v1/.updatecli-kepler.yaml +++ b/charts/k8s-monitoring-v1/.updatecli-kepler.yaml @@ -1,5 +1,5 @@ --- -name: Bump dependency "kepler" for Helm chart "k8s-monitoring" +name: Update dependency "kepler" for Helm chart "k8s-monitoring" sources: kepler: name: Get latest "kepler" Helm chart version diff --git a/charts/k8s-monitoring-v1/.updatecli-kube-state-metrics.yaml b/charts/k8s-monitoring-v1/.updatecli-kube-state-metrics.yaml index c318820e4..87399282e 100644 --- a/charts/k8s-monitoring-v1/.updatecli-kube-state-metrics.yaml +++ b/charts/k8s-monitoring-v1/.updatecli-kube-state-metrics.yaml @@ -1,5 +1,5 @@ --- -name: Bump dependency "kube-state-metrics" for Helm chart "k8s-monitoring" +name: Update dependency "kube-state-metrics" for Helm chart "k8s-monitoring" sources: kube-state-metrics: name: Get latest "kube-state-metrics" Helm chart version diff --git a/charts/k8s-monitoring-v1/.updatecli-opencost.yaml b/charts/k8s-monitoring-v1/.updatecli-opencost.yaml index 4bb89284f..1d1e84a70 100644 --- a/charts/k8s-monitoring-v1/.updatecli-opencost.yaml +++ b/charts/k8s-monitoring-v1/.updatecli-opencost.yaml @@ -1,5 +1,5 @@ --- -name: Bump dependency "opencost" for Helm chart "k8s-monitoring" +name: Update dependency "opencost" for Helm chart "k8s-monitoring" sources: opencost: name: Get latest "opencost" Helm chart version diff --git a/charts/k8s-monitoring-v1/.updatecli-prometheus-node-exporter.yaml b/charts/k8s-monitoring-v1/.updatecli-prometheus-node-exporter.yaml index 37acb4b0f..3aa43ce25 100644 --- a/charts/k8s-monitoring-v1/.updatecli-prometheus-node-exporter.yaml +++ b/charts/k8s-monitoring-v1/.updatecli-prometheus-node-exporter.yaml @@ -1,5 +1,5 @@ --- -name: Bump dependency "prometheus-node-exporter" for Helm chart "k8s-monitoring" +name: Update dependency "prometheus-node-exporter" for Helm chart "k8s-monitoring" sources: prometheus-node-exporter: name: Get latest "prometheus-node-exporter" Helm chart version diff --git a/charts/k8s-monitoring-v1/.updatecli-prometheus-operator-crds.yaml b/charts/k8s-monitoring-v1/.updatecli-prometheus-operator-crds.yaml index 3c45aef40..5f6f89ae8 100644 --- a/charts/k8s-monitoring-v1/.updatecli-prometheus-operator-crds.yaml +++ b/charts/k8s-monitoring-v1/.updatecli-prometheus-operator-crds.yaml @@ -1,5 +1,5 @@ --- -name: Bump dependency "prometheus-operator-crds" for Helm chart "k8s-monitoring" +name: Update dependency "prometheus-operator-crds" for Helm chart "k8s-monitoring" sources: prometheus-operator-crds: name: Get latest "prometheus-operator-crds" Helm chart version diff --git a/charts/k8s-monitoring-v1/.updatecli-prometheus-windows-exporter.yaml b/charts/k8s-monitoring-v1/.updatecli-prometheus-windows-exporter.yaml index 2dac044f2..8b69b1367 100644 --- a/charts/k8s-monitoring-v1/.updatecli-prometheus-windows-exporter.yaml +++ b/charts/k8s-monitoring-v1/.updatecli-prometheus-windows-exporter.yaml @@ -1,5 +1,5 @@ --- -name: Bump dependency "prometheus-windows-exporter" for Helm chart "k8s-monitoring" +name: Update dependency "prometheus-windows-exporter" for Helm chart "k8s-monitoring" sources: prometheus-windows-exporter: name: Get latest "prometheus-windows-exporter" Helm chart version From 9eb2c5878668932c6bf7b1aa7bbfc8d6d8650e64 Mon Sep 17 00:00:00 2001 From: Pete Wall Date: Fri, 11 Oct 2024 16:44:16 -0500 Subject: [PATCH 07/10] Update workflow to check for any generated files Signed-off-by: Pete Wall --- .github/workflows/test-v1.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-v1.yml b/.github/workflows/test-v1.yml index 02e01e883..7ac6c4016 100644 --- a/.github/workflows/test-v1.yml +++ b/.github/workflows/test-v1.yml @@ -51,7 +51,7 @@ jobs: exit 1 fi - check-for-example-output-changes: + check-for-generated-file-changes: runs-on: ubuntu-latest steps: - name: Checkout @@ -60,12 +60,12 @@ jobs: - name: Install Helm uses: azure/setup-helm@v4 - - name: Check for example output changes + - name: Check for generated file changes working-directory: charts/k8s-monitoring-v1 run: | - make clean examples + make clean build if [[ -n "$(git status --porcelain)" ]]; then - echo "k8s-monitoring Helm chart v1 examples are not up to date. Please run 'make clean examples', examine changes, and commit changes." >&2 + echo "k8s-monitoring Helm chart v1 generated files are not up to date. Please run 'make clean build', examine changes, and commit changes." >&2 exit 1 fi From 444f483a3764a929555a89cfb564426a733fad61 Mon Sep 17 00:00:00 2001 From: Pete Wall Date: Fri, 11 Oct 2024 17:06:16 -0500 Subject: [PATCH 08/10] This shouldn't be removed in this change Signed-off-by: Pete Wall --- charts/k8s-monitoring/README.md.gotmpl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/charts/k8s-monitoring/README.md.gotmpl b/charts/k8s-monitoring/README.md.gotmpl index 5c7c416a0..c2769e771 100644 --- a/charts/k8s-monitoring/README.md.gotmpl +++ b/charts/k8s-monitoring/README.md.gotmpl @@ -115,6 +115,8 @@ podLogs: {{ template "chart.sourcesSection" . }} + +{{ template "chart.requirementsSection" . }} {{ template "chart.valuesSection" . }} From 06c9e2400b61b7e5bdc21e7908fd289145b4c41a Mon Sep 17 00:00:00 2001 From: Pete Wall Date: Sat, 12 Oct 2024 06:59:36 -0500 Subject: [PATCH 09/10] This should make the tests happy Signed-off-by: Pete Wall --- charts/k8s-monitoring-v1/Makefile | 2 +- charts/k8s-monitoring/README.md | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/charts/k8s-monitoring-v1/Makefile b/charts/k8s-monitoring-v1/Makefile index 17fe60024..a350c8c4e 100644 --- a/charts/k8s-monitoring-v1/Makefile +++ b/charts/k8s-monitoring-v1/Makefile @@ -6,7 +6,7 @@ CHART_YAML_FILES = $(shell find templates -name "*.yaml") UPDATECLI_FILES := $(shell yq -e '.dependencies[] | select(.repository == "http*") | ".updatecli-" + .name + ".yaml"' Chart.yaml | sort | uniq) values.schema.json: values.yaml schema-mods/enums-and-types.json schema-mods/required-values.json - docker run -it --rm --platform linux/amd64 -v "$(shell pwd):/chart" --entrypoint sh alpine/helm \ + docker run --rm --platform linux/amd64 -v "$(shell pwd):/chart" --entrypoint sh alpine/helm \ --command -c 'helm plugin install https://github.com/karuppiah7890/helm-schema-gen.git && \ helm schema-gen /chart/values.yaml > /chart/values.schema.generated.json' diff --git a/charts/k8s-monitoring/README.md b/charts/k8s-monitoring/README.md index 17636fdfd..9535595fe 100644 --- a/charts/k8s-monitoring/README.md +++ b/charts/k8s-monitoring/README.md @@ -118,6 +118,25 @@ podLogs: * + +## Requirements + +| Repository | Name | Version | +|------------|------|---------| +| file://../feature-annotation-autodiscovery | annotationAutodiscovery(k8s-monitoring-feature-annotation-autodiscovery) | 1.0.0 | +| file://../feature-application-observability | applicationObservability(k8s-monitoring-feature-application-observability) | 1.0.0 | +| file://../feature-cluster-events | clusterEvents(k8s-monitoring-feature-cluster-events) | 1.0.0 | +| file://../feature-cluster-metrics | clusterMetrics(k8s-monitoring-feature-cluster-metrics) | 1.0.0 | +| file://../feature-frontend-observability | frontendObservability(k8s-monitoring-feature-frontend-observability) | 1.0.0 | +| file://../feature-integrations | integrations(k8s-monitoring-feature-integrations) | 1.0.0 | +| file://../feature-pod-logs | podLogs(k8s-monitoring-feature-pod-logs) | 1.0.0 | +| file://../feature-profiling | profiling(k8s-monitoring-feature-profiling) | 1.0.0 | +| file://../feature-prometheus-operator-objects | prometheusOperatorObjects(k8s-monitoring-feature-prometheus-operator-objects) | 1.0.0 | +| https://grafana.github.io/helm-charts | alloy-metrics(alloy) | 0.7.0 | +| https://grafana.github.io/helm-charts | alloy-singleton(alloy) | 0.7.0 | +| https://grafana.github.io/helm-charts | alloy-logs(alloy) | 0.7.0 | +| https://grafana.github.io/helm-charts | alloy-receiver(alloy) | 0.7.0 | +| https://grafana.github.io/helm-charts | alloy-profiles(alloy) | 0.7.0 | ## Values From 86e62f12784e9a4ceb44f014fa3b47e2a700769e Mon Sep 17 00:00:00 2001 From: Pete Wall Date: Sat, 12 Oct 2024 08:39:46 -0500 Subject: [PATCH 10/10] Start using the much better schema generation script Signed-off-by: Pete Wall --- charts/k8s-monitoring-v1/Makefile | 43 ++----------------- .../schema-mods/remove-subchart-fields.jq | 28 ++++++++++++ 2 files changed, 31 insertions(+), 40 deletions(-) create mode 100644 charts/k8s-monitoring-v1/schema-mods/remove-subchart-fields.jq diff --git a/charts/k8s-monitoring-v1/Makefile b/charts/k8s-monitoring-v1/Makefile index a350c8c4e..bbbf1d121 100644 --- a/charts/k8s-monitoring-v1/Makefile +++ b/charts/k8s-monitoring-v1/Makefile @@ -5,46 +5,9 @@ CHART_TEMPLATE_FILES = $(shell find templates -name "*.tpl") CHART_YAML_FILES = $(shell find templates -name "*.yaml") UPDATECLI_FILES := $(shell yq -e '.dependencies[] | select(.repository == "http*") | ".updatecli-" + .name + ".yaml"' Chart.yaml | sort | uniq) -values.schema.json: values.yaml schema-mods/enums-and-types.json schema-mods/required-values.json - docker run --rm --platform linux/amd64 -v "$(shell pwd):/chart" --entrypoint sh alpine/helm \ - --command -c 'helm plugin install https://github.com/karuppiah7890/helm-schema-gen.git && \ - helm schema-gen /chart/values.yaml > /chart/values.schema.generated.json' - - jq --indent 4 -s '.[0] * .[1] * .[2]' \ - <(jq --indent 4 \ - 'del(.properties["alloy"].properties.alloy) \ - | del(.properties["alloy"].properties.controller) \ - | del(.properties["alloy"].properties.crds) \ - | del(.properties["alloy-events"].properties.alloy) \ - | del(.properties["alloy-events"].properties.controller) \ - | del(.properties["alloy-events"].properties.crds) \ - | del(.properties["alloy-logs"].properties.alloy) \ - | del(.properties["alloy-logs"].properties.controller) \ - | del(.properties["alloy-logs"].properties.crds) \ - | del(.properties["alloy-profiles"].properties.alloy) \ - | del(.properties["alloy-profiles"].properties.controller) \ - | del(.properties["alloy-profiles"].properties.crds) \ - | del(.properties["kepler"].properties.canMount) \ - | del(.properties["beyla"].properties.config) \ - | del(.properties["kube-state-metrics"].properties.autosharding) \ - | del(.properties["kube-state-metrics"].properties.nodeSelector) \ - | del(.properties["kube-state-metrics"].properties.prometheusScrape) \ - | del(.properties["kube-state-metrics"].properties.releaseLabel) \ - | del(.properties["kube-state-metrics"].properties.updateStrategy) \ - | del(.properties["prometheus-node-exporter"].properties.nodeSelector) \ - | del(.properties["prometheus-node-exporter"].properties.podAnnotations) \ - | del(.properties["prometheus-node-exporter"].properties.releaseLabel) \ - | del(.properties["prometheus-node-exporter"].properties.service) \ - | del(.properties["prometheus-windows-exporter"].properties.config) \ - | del(.properties["prometheus-windows-exporter"].properties.podAnnotations) \ - | del(.properties["prometheus-windows-exporter"].properties.releaseLabel) \ - | del(.properties.logs.properties.pod_logs.properties.labels.properties) \ - | del(.properties.opencost.properties.opencost)' values.schema.generated.json) \ - schema-mods/enums-and-types.json \ - schema-mods/required-values.json \ - > values.schema.json - - rm values.schema.generated.json +.SECONDEXPANSION: +values.schema.json: values.yaml $$(wildcard schema-mods/*) + ../../scripts/schema-gen.sh . .updatecli-%.yaml: Chart.yaml ../../scripts/charts-to-updatecli.sh Chart.yaml diff --git a/charts/k8s-monitoring-v1/schema-mods/remove-subchart-fields.jq b/charts/k8s-monitoring-v1/schema-mods/remove-subchart-fields.jq new file mode 100644 index 000000000..bdb9c3ec6 --- /dev/null +++ b/charts/k8s-monitoring-v1/schema-mods/remove-subchart-fields.jq @@ -0,0 +1,28 @@ +del(.properties["alloy"].properties.alloy) +| del(.properties["alloy"].properties.controller) +| del(.properties["alloy"].properties.crds) +| del(.properties["alloy-events"].properties.alloy) +| del(.properties["alloy-events"].properties.controller) +| del(.properties["alloy-events"].properties.crds) +| del(.properties["alloy-logs"].properties.alloy) +| del(.properties["alloy-logs"].properties.controller) +| del(.properties["alloy-logs"].properties.crds) +| del(.properties["alloy-profiles"].properties.alloy) +| del(.properties["alloy-profiles"].properties.controller) +| del(.properties["alloy-profiles"].properties.crds) +| del(.properties["kepler"].properties.canMount) +| del(.properties["beyla"].properties.config) +| del(.properties["kube-state-metrics"].properties.autosharding) +| del(.properties["kube-state-metrics"].properties.nodeSelector) +| del(.properties["kube-state-metrics"].properties.prometheusScrape) +| del(.properties["kube-state-metrics"].properties.releaseLabel) +| del(.properties["kube-state-metrics"].properties.updateStrategy) +| del(.properties["prometheus-node-exporter"].properties.nodeSelector) +| del(.properties["prometheus-node-exporter"].properties.podAnnotations) +| del(.properties["prometheus-node-exporter"].properties.releaseLabel) +| del(.properties["prometheus-node-exporter"].properties.service) +| del(.properties["prometheus-windows-exporter"].properties.config) +| del(.properties["prometheus-windows-exporter"].properties.podAnnotations) +| del(.properties["prometheus-windows-exporter"].properties.releaseLabel) +| del(.properties.logs.properties.pod_logs.properties.labels.properties) +| del(.properties.opencost.properties.opencost) \ No newline at end of file