Jenkins Pipeline中Helm子图表部署报错‘Error: no objects visited’排查求助
Let's break down how to diagnose and fix this vague error. The "no objects visited" message means Helm didn't generate any Kubernetes resources from your templates—so we need to figure out why your templates aren't producing anything.
First, Pinpoint the Issue with helm template
The easiest way to debug is to render your templates locally before running the upgrade command. Execute this:
helm template testing deployment/helm/testing -f deployment/helm/testing/values.yaml --set image_name=test-image
If this outputs nothing (or no DeploymentConfig resources), your templates aren't rendering correctly. Let's look at the most likely culprits.
1. Critical Filename Typo in Subchart
Looking at your directory structure, I spotted a common mistake:
Your application subchart has a value.yaml file (singular), but Helm expects values.yaml (plural) for default values.
Helm automatically loads values.yaml from subcharts, but it ignores misnamed files like value.yaml. This means your region array in the application's default values isn't being loaded at all. The range $k, $v := .Values.region loop in your deployment.yaml has no data to iterate over, so it produces zero resources.
Fix: Rename application/value.yaml to application/values.yaml.
2. Undefined Variables in Templates
Your DeploymentConfig template references $.Values.global.namespace, but nowhere in your provided values files is global.namespace defined. While Helm won't throw a hard error for undefined variables, an empty namespace field could cause Kubernetes to reject the resource, or Helm might skip rendering it entirely.
Fix: Add the global namespace to your testing/values.yaml:
global: namespace: your-target-namespace # Replace with your actual namespace application: enabled: true configuration: enabled: false
Or, if you don't need a global namespace, replace {{ $.Values.global.namespace }} with a hardcoded namespace or remove the field entirely (Kubernetes will use the namespace you're deploying to by default).
3. Verify Subchart Enablement
Double-check that your subchart is actually enabled. In your testing/values.yaml, you have application: enabled: true—that's correct, but if you accidentally set it to false, the subchart would be skipped entirely.
4. Check Template Syntax Errors
Even a small syntax mistake (like missing closing brackets, incorrect variable references) can cause Helm to silently fail to render resources. Run helm lint on your chart to catch these:
helm lint deployment/helm/testing
This will flag any syntax issues or best practice violations in your templates and values files.
5. Validate Variable Scope
In your deployment.yaml, you're using $.Values.image_name (referencing the parent chart's values) which works with your --set image_name=$DOCKER_TAG flag. However, make sure any other variable references are targeting the correct scope:
.Values.regionrefers to the subchart's values (once you fix the filename typo)$.Valuesrefers to the parent chart's values
Final Test
After fixing the filename typo and any undefined variables, re-run helm template—you should see your DeploymentConfig resources rendered correctly. Then proceed with your helm upgrade --install command.
内容的提问来源于stack exchange,提问作者NealR

