From 11cbaae3667044d13f498224f6c5218662a93c55 Mon Sep 17 00:00:00 2001 From: Juan Antonio Osorio Date: Fri, 24 Oct 2025 11:04:21 +0300 Subject: [PATCH] Configure chart-testing to install all charts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes a critical issue where Helm chart tests fail when PRs only modify the operator chart without bumping the operator-crds chart version. Problem: -------- By default, 'ct install' only installs charts that have changed in a PR (detected by comparing to the target branch). The operator chart depends on the operator-crds chart, but this dependency is not explicitly declared in Chart.yaml. When a PR modifies only the operator chart: 1. ct detects only the operator chart as changed 2. ct installs ONLY the operator chart (not operator-crds) 3. The operator pod starts but immediately crashes with: "unable to retrieve the complete list of server APIs: toolhive.stacklok.dev/v1alpha1: no matches for toolhive.stacklok.dev/v1alpha1" 4. This happens because the operator tries to create field indexes for CRD fields at startup (e.g., MCPServer.Spec.GroupRef in main.go:82-96) Root Cause: ----------- The operator and operator-crds charts have an implicit dependency: - The operator image includes code that requires CRDs to exist at startup - The charts are separate and the dependency is not declared - chart-testing's default behavior is to only test changed charts Previous Workaround: -------------------- PRs had to manually bump both chart versions together (see PR #2284), but this is error-prone and not obvious to contributors. Solution: --------- Set 'all: true' in ct-install.yaml to ensure chart-testing always installs all charts in the chart-dirs, regardless of which ones changed. This ensures the CRDs are always present before the operator starts. This is the recommended approach when charts have dependencies that aren't explicitly declared in Chart.yaml dependencies. Alternative Solutions Considered: ---------------------------------- 1. Declare dependency in Chart.yaml - Would work but requires managing chart repositories and complicates local development 2. Combine charts - Would require significant restructuring 3. Manual version bumps - Current approach, error-prone Testing: -------- With this change, PRs that only modify the operator chart (like #2176) will now pass Helm chart tests because both charts will be installed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- ct-install.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ct-install.yaml b/ct-install.yaml index 2fb25f34e..ee24e5d7e 100644 --- a/ct-install.yaml +++ b/ct-install.yaml @@ -1,5 +1,16 @@ +# Configuration for chart-testing (ct) install command +# See: https://github.com/helm/chart-testing + chart-dirs: - deploy/charts validate-maintainers: false remote: origin target-branch: main + +# Install all charts, not just changed ones. +# This is required because the operator chart depends on the operator-crds chart. +# Without 'all: true', ct only installs charts that have changed in the PR. +# If a PR only changes the operator chart (not operator-crds), the operator +# will fail to start because the CRDs are not installed in the test cluster. +# The operator requires CRDs at startup to create field indexes (e.g., spec.groupRef). +all: true