Skip to content

Kustomizations introduced by components are not applied to adjacent generated resources #5141

@djmcgreal-cc

Description

@djmcgreal-cc

What happened?

See reproduction where generated resource is not modified by an adjacent component whereas the non-generated adjacent resource is.

What did you expect to happen?

That the generated resource would behave the same as the non-generated resources.

How can we reproduce it (as minimally and precisely as possible)?

kustomization.yaml:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
  - resource.yaml

components:
  - component

configMapGenerator:
  - name: generated-resource
    literals:
      - key=value
    options:
      disableNameSuffixHash: true

resource.yaml:

apiVersion: v1
kind: ConfigMap
metadata:
  name: adjacent-resource
data:
  blah: hello

component/kustomization.yaml:

apiVersion: kustomize.config.k8s.io/v1alpha1
kind: Component
nameSuffix: -modified

Expected output

apiVersion: v1
data:
  blah: hello
kind: ConfigMap
metadata:
  name: adjacent-resource-modified
---
apiVersion: v1
data:
  key: value
kind: ConfigMap
metadata:
  name: generated-resource-modified

Actual output

apiVersion: v1
data:
  blah: hello
kind: ConfigMap
metadata:
  name: adjacent-resource-modified
---
apiVersion: v1
data:
  key: value
kind: ConfigMap
metadata:
  name: generated-resource

Kustomize version

v5.0.1, also {Version:kustomize/v4.5.5 GitCommit:daa3e5e2c2d3a4b8c94021a7384bfb06734bcd26 BuildDate:2022-05-20T20:21:22Z GoOs:darwin GoArch:amd64}

Operating system

MacOS

Metadata

Metadata

Assignees

Labels

kind/bugCategorizes issue or PR as related to a bug.triage/acceptedIndicates an issue or PR is ready to be actively worked on.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions