kustomize icon indicating copy to clipboard operation
kustomize copied to clipboard

feat: support inline configurations

Open TLDMain opened this issue 1 year ago • 26 comments

Relevant issue #1966

TLDMain avatar Apr 12 '24 19:04 TLDMain

CLA Signed

The committers listed above are authorized under a signed CLA.

  • :white_check_mark: login: TLDMain (2f0dd27ebf8a8502cd94b39d2283510caa95aeaa, 69c819da36d305fc53f2d79fb0a11174d2aad3a4, 70101ba0a21a79d06d0c6ef3c4880f2aafa5029f)

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: TLDMain Once this PR has been reviewed and has the lgtm label, please assign koba1t for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

k8s-ci-robot avatar Apr 12 '24 19:04 k8s-ci-robot

Welcome @TLDMain!

It looks like this is your first PR to kubernetes-sigs/kustomize 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/kustomize has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. :smiley:

k8s-ci-robot avatar Apr 12 '24 19:04 k8s-ci-robot

Hi @TLDMain. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Apr 12 '24 19:04 k8s-ci-robot

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Apr 25 '24 11:04 k8s-ci-robot

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Jul 24 '24 12:07 k8s-triage-robot

This PR has multiple commits, and the default merge method is: merge. You can request commits to be squashed using the label: tide/merge-method-squash

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

k8s-ci-robot avatar Aug 06 '24 08:08 k8s-ci-robot

Hi there, @stormqueen1990!

Thanks for your feedback!

This PR addresses the need to streamline kustomize configurations by allowing inlined configurations directly within the kustomization.yaml file, similar to how patches are currently handled. The use case here is to simplify the sharing and management of kustomize configurations by embedding them within a single file, eliminating the need for separate configuration files. This makes it easier to provide comprehensive and portable examples.

For instance, with this change, configurations can be inlined as follows:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
  - helmrelease.yaml
configMapGenerator:
  - name: helmrelease-values
    files:
      - values.yaml=helmrelease.values.yaml
configurations:
  - |
    nameReference:
      - kind: ConfigMap
        version: v1
        fieldSpecs:
          - path: spec/valuesFrom/name
            kind: HelmRelease

This enhancement allows users to consolidate their configurations, making it more convenient to manage and share kustomize setups.

/remove-lifecycle stale /label tide/merge-method-squash

TLDMain avatar Aug 06 '24 08:08 TLDMain

/triage under-consideration

stormqueen1990 avatar Aug 07 '24 14:08 stormqueen1990

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: stormqueen1990, TLDMain Once this PR has been reviewed and has the lgtm label, please ask for approval from varshaprasad96. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

k8s-ci-robot avatar Aug 12 '24 18:08 k8s-ci-robot

/remove-triage under-consideration /ok-to-test /unhold

stormqueen1990 avatar Aug 12 '24 18:08 stormqueen1990

Hi @stormqueen1990

I suggest inlineConfigurations as the name. The type can still be a string slice, just like the current configurations field.

type Kustomization struct is our most important top-level configuration. I feel we need to write The Enhancement Proposal and discuss the interface If we try to introduce any changes to that structure. https://github.com/kubernetes-sigs/kustomize/blob/master/proposals/README.md

koba1t avatar Aug 12 '24 22:08 koba1t

Hi there, @stormqueen1990!

Apologies for the incorrect analogy. I based these changes on the behavior of the transformers and generators fields, not on patches. Here's a similar PR: #3225. However, I can create a separate field if that's critical.

Also, the comments for these fields are similar to those in the configurations: https://github.com/kubernetes-sigs/kustomize/blob/77354d73b940e56e19b6e44f6c297b26f22d722f/api/types/kustomization.go#L171-L175

I'll wait for your decision.

TLDMain avatar Aug 13 '24 10:08 TLDMain

Hi @TLDMain

I think there is a many consideration point and need take a time that add new inlineConfigurations field for Kustomization struct. I believe that is a better to use current Configurations []string field in this case and add carefully path check in code avoid some bugs.

Please add more strict check for string in Configurations field.

koba1t avatar Aug 15 '24 21:08 koba1t

Hi @koba1t.

I suggest two options for checking: either use regex to verify that the string contains a file path, or check if the string contains multiple lines.

Alternatively, you can propose your own method for checking.

TLDMain avatar Aug 16 '24 08:08 TLDMain

@TLDMain I am so sorry for the delayed response.

I have one suggestion. If the contents of the field are a single line, the method is to go looking for the file to which it refers.

regexp would be difficult because different operating systems interpret them in different ways. Perhaps in the future there may be content that can be expressed on a single line, so it would be safer to check if it can be resolved with the file open function.

koba1t avatar Sep 16 '24 18:09 koba1t