-
Notifications
You must be signed in to change notification settings - Fork 258
Add Kustomize Support #1045
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add Kustomize Support #1045
Conversation
Integrate k8s-manifests-lib to enable linting of Kustomize manifests. Kustomization directories are automatically detected and rendered, with each kustomization treated as a separate lint context similar to Helm charts. Changes: - Add isKustomizeDir() detection for kustomization.yaml/yml files - Add loadObjectsFromKustomize() to render manifests using k8s-manifests-lib - Add unit tests for Kustomize support - Add e2e BATS test for Kustomize rendering and linting - Add test fixtures in tests/testdata/mykustomize/ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Enable source annotations in the Kustomize renderer to track the actual source files where Kubernetes objects are defined. This improves error reporting by showing the real file paths instead of synthetic paths. Before: tests/testdata/mykustomize/deployment-kustomize-test-deployment.yaml After: /path/to/tests/testdata/mykustomize/base/deployment.yaml This makes it easier for users to find and fix lint errors in their Kustomize configurations. Addresses PR review comment: #1045 (comment) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Signed-off-by: Tomasz Janiszewski <[email protected]>
Signed-off-by: Tomasz Janiszewski <[email protected]>
|
@janisz I've tried to run it vs opedatahub-operator: If I run it vs the However it does not for This is likely because for this to work, kustomize must be set using some additional configuration options, int his case to disable load restrinctions (not a good practice, but for this project it is required). The engine has an option to configure it : |
|
For this issue I have a separated pr |
|
I think the only missing part is to figure out how to pass some specific kustomize flags, but otherwhise to LGTM Note: update to github.com/lburgazzoli/k8s-manifests-lib v0.1.3 if you have time as it includes a fix that could prevent the engine to work in some cases |
This PR adds native support for linting Kustomize manifests. kube-linter can now automatically detect and render Kustomize directories, applying all transformations before running lint checks.
Motivation
Currently, users need to manually render Kustomize manifests before linting:
kustomize build ./my-app | kube-linter lint -This PR enables direct linting of Kustomize directories:
Changes
kustomization.yamlorkustomization.ymlfilesUsage Examples
Basic Usage
Directory Structure Example
Overlays Example
Example Output
Note: The deployment name
kustomize-test-deploymentincludes thekustomize-namePrefix from kustomization.yaml.CI/CD Integration
With Ignore Paths
Implementation Details
kustomization.yamlorkustomization.ymlin directories during traversalgithub.com/lburgazzoli/k8s-manifests-libv0.1.1 for Kustomize renderingInvalidObjects(non-fatal, similar to Helm charts)--ignore-pathsflag works with Kustomize directoriesTesting
Breaking Changes
None. This is a purely additive feature.
Checklist