Skip to content
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

Code struct for each kustomization field #4671

Closed
annasong20 opened this issue Jun 8, 2022 · 5 comments
Closed

Code struct for each kustomization field #4671

annasong20 opened this issue Jun 8, 2022 · 5 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. triage/under-consideration

Comments

@annasong20
Copy link
Contributor

annasong20 commented Jun 8, 2022

Status: This is a draft feature request. I will update it as I further my understanding of the codebase.

Is your feature request related to a problem? Please describe.
@KnVerey first suggested this change in #4590 (comment).

Essentially, every time kustomize looks for a specific behavior in its fields, each field requires its own processing code. For example, to find all files that a kustomization file references, kustomize localize would need code to look for referenced files within each field.

This approach is chunky: it makes the code more difficult to read. It's prone to bugs because not only is the logic is hard to follow, but also when the behavior of fields change, developers need to re-evaluate all various occurrences of code that processes the field in this manner.

Describe the solution you'd like
The problem is that, currently, the logic must be centrally managed because each field is not its own struct. If each field has its own struct type, the struct can implement different interfaces for the different use cases that need to process the field. In this way, most logic around processing the field will be local to each field, and thus easier to manage.

Describe alternatives you've considered
I have not come up with any alternatives at the moment.

Additional context
Will add as I go.

@annasong20 annasong20 added the kind/feature Categorizes issue or PR as related to a new feature. label Jun 8, 2022
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Jun 8, 2022
@k8s-ci-robot
Copy link
Contributor

@annasong20: This issue is currently awaiting triage.

SIG CLI takes a lead on issue triage for this repo, but any Kubernetes member can accept issues by applying the triage/accepted label.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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.

@KnVerey
Copy link
Contributor

KnVerey commented Jun 8, 2022

A bit of context to get you started: We actually already have structs (albeit not with the name you'd expect) representing the types that power most of these fields, and I didn't mean to suggest that we should have additional ones for the fields themselves. For example, the plugin struct here powers the NamespaceTransformer, i.e. the namespace: field. There are also already several interfaces associated with them: they must implement the Configurable interface in order to work as built-ins, and they must implement either the Generator interface or Transformer interface as applicable to be supported in the corresponding field.

This comes with a bunch of caveats though:

@KnVerey KnVerey added triage/under-consideration and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jun 8, 2022
@k8s-triage-robot
Copy link

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

This bot triages issues and 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 issue is closed

You can:

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

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

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Sep 6, 2022
@k8s-triage-robot
Copy link

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

This bot triages issues and 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 issue is closed

You can:

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

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

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Oct 6, 2022
@annasong20
Copy link
Contributor Author

Looking further at the code and discussions in #4797, I don't think this will be happening because

  1. We don't need to. I opened this issue back when I didn't fully understand the codebase.
  2. We seem hesitant to make larger changes to existing code.

@annasong20 annasong20 closed this as not planned Won't fix, can't repro, duplicate, stale Oct 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. triage/under-consideration
Projects
None yet
Development

No branches or pull requests

4 participants