kustomize icon indicating copy to clipboard operation
kustomize copied to clipboard

Support for declaring entire resources inline in kustomization.yaml?

Open shapirus opened this issue 6 months ago • 1 comments

Eschewed features

  • [x] This issue is not requesting templating, unstuctured edits, build-time side-effects from args or env vars, or any other eschewed feature.

What would you like to have added?

Just like the support for patches and some other things, it would be nice if kustomize supported declaring entire resources inline.

Why is this needed?

Use case: generating manifests using automation tools (e.g. terraform) without humans ever having to touch the output. It's easier and more convenient to write the generator code to put everything in one file rather than having to deal with multiple files (minimum: kustomization.yaml plus one with resources) with path references in kustomization.yaml.

Example:

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

inlineResources:
- |-
  apiVersion: v1
  kind: Namespace
  metadata:
    name: foo
- |-
  apiVersion: v1
  kind: Namespace
  metadata:
    name: bar

Can you accomplish the motivating task without this feature, and if so, how?

n/a

What other solutions have you considered?

n/a

Anything else we should know?

No response

Feature ownership

  • [ ] I am interested in contributing this feature myself! 🎉

shapirus avatar May 13 '25 16:05 shapirus

Hey @shapirus, thanks for this great feature suggestion. We had internal discussion on this feature request and have come to conclusion that we will keep this issue open and will monitor the traction it gets from other users. If there is a significant demand for this we will review it again to make a decision on how we can implement this. /triage under-consideration cc @koba1t

sarab97 avatar Jul 16 '25 04:07 sarab97

Well, there may be no demand until the feature is implemented (potential users wouldn't think of it because they never imagined it possible), so it can end up being a chicken and egg problem :)

But yes, let's see.

shapirus avatar Jul 16 '25 14:07 shapirus

I am currently generating manifests with CUE (https://github.com/cue-lang/cue) and this would simplify the building and packaging process.

Right now I have to have two separate outputs for each kustomization in my repo, this means at least two .cue files, and also at least 2 command calls to generate the 2 yaml files (kustomization.yaml, resources.yaml).

With inline resources, it would only require one file and be a lot simpler

LelouBil avatar Oct 07 '25 12:10 LelouBil