Skip to content

[BUG] Kustomize support broken for kustomizations using builtin transformers (ImageTagTransformer, BploUndefined error) #1203

Description

@ltshb

System info:

  • OS: Linux (Ubuntu 24.04, x86_64)
  • kube-linter version: v0.8.3 (installed via go install golang.stackrox.io/kube-linter/cmd/kube-linter@v0.8.3, kube-linter version reports development as expected for go install builds)

Describe the bug
Linting a Kustomize directory fails with Warning: no valid objects found. when the kustomization (or one of its bases) declares a builtin plugin explicitly via the transformers: field (e.g. an ImageTagTransformer in a separate file). Running with -v reveals the underlying error:

unknown plugin loader behavior specified: ImageTagTransformer.builtin.[noGrp] BploUndefined

This suggests the embedded krusty kustomizer is constructed with PluginConfig.BpLoadingOptions left at BploUndefined instead of BploUseStaticallyLinked. Explicit transformers:/generators: entries go through kustomize's plugin loader, which validates that option, whereas the equivalent images: shorthand does not — which matches what I observe: the same image override expressed via images: works fine, while the explicit ImageTagTransformer fails. The kustomize CLI builds the same directory without any problem.

To Reproduce
Steps to reproduce the behavior:

  1. Create a standard base/overlay layout (see sample below) where the base kustomization references an ImageTagTransformer via transformers:
  2. Run kube-linter lint overlays/dev
  3. Output: Warning: no valid objects found.
  4. Run kube-linter lint -v overlays/dev to see the rendering error
  5. Replace the transformers: entry with the equivalent images: shorthand in base/kustomization.yaml and re-run: linting now works

Sample YAML input

Directory layout:

.
├── base
│   ├── deployment.yaml
│   ├── image-transformer.yaml
│   └── kustomization.yaml
└── overlays
    └── dev
        └── kustomization.yaml

base/deployment.yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: demo
spec:
  replicas: 1
  selector:
    matchLabels:
      app: demo
  template:
    metadata:
      labels:
        app: demo
    spec:
      containers:
        - name: demo
          image: demo-app

base/image-transformer.yaml:

apiVersion: builtin
kind: ImageTagTransformer
metadata:
  name: image-demo-patcher
imageTag:
  name: demo-app
  newTag: v1.2.3

base/kustomization.yaml (fails):

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
  - deployment.yaml
transformers:
  - image-transformer.yaml

Equivalent kustomization using the images: shorthand (works):

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
  - deployment.yaml
images:
  - name: demo-app
    newTag: v1.2.3

overlays/dev/kustomization.yaml:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
  - ../../base

Expected behavior
The Kustomize directory should render and lint successfully, as it does with the kustomize CLI: kustomize build overlays/dev | kube-linter lint - works fine on the same input.

Screenshots
N/A — full verbose output:

$ kube-linter lint -v --add-all-built-in ./
Warning: failed to load object from <repo>/overlays/dev: rendering failed: error processing renderer "kustomize" (*kustomize.Renderer): error rendering kustomize path <repo>/overlays/dev: failed to run kustomize for path "<repo>/overlays/dev": failed to run kustomize for path "<repo>/overlays/dev": kustomize run failed: accumulating resources: accumulation err='accumulating resources from '../../base': '<repo>/base' must resolve to a file': recursed accumulation of path '<repo>/base': unknown plugin loader behavior specified: ImageTagTransformer.builtin.[noGrp] BploUndefined
Warning: no valid objects found.

Additional context

  • Introduced with the new Kustomize support from Add Kustomize Support #1045 (v0.8.0); also reproducible on v0.8.3.
  • ImageTagTransformer is likely not the only affected plugin — any builtin transformer or generator declared explicitly via transformers:/generators: should hit the same loader code path.
  • Without -v, the failure is completely silent apart from the generic no valid objects found warning.
  • Likely fix: set types.BploUseStaticallyLinked in the krusty.Options.PluginConfig used by the kustomize renderer.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions