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

Proposal for new command "kustomize localize" #4590

Merged
merged 4 commits into from May 15, 2022

Conversation

annasong20
Copy link
Contributor

Wrote mini KEP proposal for new command "kustomize localize", first suggested in issue #3980.

Write mini KEP proposal for new command kustomize localize.
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 19, 2022
@k8s-ci-robot
Copy link
Contributor

Hi @annasong20. 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 k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 19, 2022
@annasong20
Copy link
Contributor Author

/cc @KnVerey

Copy link
Contributor

@natasha41575 natasha41575 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comment.

/lgtm

@KnVerey this proposal was a joint effort from Anna and myself, so I will defer to you for approval.

proposals/22-04-localize-command.md Outdated Show resolved Hide resolved
@natasha41575
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Apr 19, 2022
@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 19, 2022
@natasha41575
Copy link
Contributor

natasha41575 commented May 4, 2022

Summary of meeting today:

  1. Add another argument like you proposed earlier that tells us where in target to start looking for the kustomization file. This can be optional and defaults to the root of target. That way, the user does not need to create the extra top-level kustomization.yaml file in user story 2

  2. Look through https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/ to get an exhaustive list of where filepaths can be referenced

  3. We will copy over KRM function exec binaries if they are available (there is a guide here on those)

Am I missing anything?

@annasong20
Copy link
Contributor Author

annasong20 commented May 4, 2022 via email

@k8s-ci-robot
Copy link
Contributor

@annasong20: 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/test-infra repository.

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 9, 2022
@annasong20
Copy link
Contributor Author

annasong20 commented May 9, 2022

/label tide/merge-method-squash

Copy link
Contributor

@natasha41575 natasha41575 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nits. Overall LGTM

proposals/22-04-localize-command.md Show resolved Hide resolved
proposals/22-04-localize-command.md Outdated Show resolved Hide resolved
proposals/22-04-localize-command.md Outdated Show resolved Hide resolved
proposals/22-04-localize-command.md Show resolved Hide resolved
proposals/22-04-localize-command.md Outdated Show resolved Hide resolved
proposals/22-04-localize-command.md Outdated Show resolved Hide resolved
proposals/22-04-localize-command.md Show resolved Hide resolved
proposals/22-04-localize-command.md Outdated Show resolved Hide resolved
proposals/22-04-localize-command.md Outdated Show resolved Hide resolved
proposals/22-04-localize-command.md Outdated Show resolved Hide resolved
proposals/22-04-localize-command.md Outdated Show resolved Hide resolved
proposals/22-04-localize-command.md Outdated Show resolved Hide resolved
**Goals:**

1. This command should localize
* all remote files that a kustomization file directly references
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have an inventory of where these references can happen? Certainly resources, and also openapi as of #4567. (there are many builtin transformers that reference files localize will need to adjust, but most don't support remote afaik)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We know they can occur in resources, openapi, bases, and components.

Anna is compiling a list of all places that filepaths (local or remote) can occur, and for implementation purposes we were thinking of doing something like the following:

for path in all_possible_local_filepaths:
   if IsURL(path): 
      localize(path)

i.e. check all filepaths to see if they are remote.

That way, kustomize localize can be robust enough to handle changes like #4567 if any come up in the future, and doesn't need to keep track of which paths can be remote; it just needs to know which fields are paths. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems reasonable. There's still a non-trivial likelihood that new fields with paths will get added in the future and localize's list will not be remembered. We should try to think if there's a way to help future us avoid that. I was imagining we'd need to delegate localization to the various transformers, possibly through an optional interface they could implement like we did with TrackableFilter. If we did something like that we could have a test iterate over the list of built-ins and assert that they satisfy it. But that might be very complicated overall. In any case, we don't need to decide on the implementation at the design stage.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KnVerey I will track your suggestion in #4671 and resolve this conversation.

@annasong20
Copy link
Contributor Author

/label tide/merge-method-squash

@k8s-ci-robot k8s-ci-robot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label May 12, 2022
@natasha41575
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 12, 2022
Copy link
Contributor

@KnVerey KnVerey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very minor comments. Great work!

/approve

proposals/22-04-localize-command.md Show resolved Hide resolved
proposals/22-04-localize-command.md Show resolved Hide resolved
proposals/22-04-localize-command.md Show resolved Hide resolved
proposals/22-04-localize-command.md Show resolved Hide resolved
proposals/22-04-localize-command.md Show resolved Hide resolved
proposals/22-04-localize-command.md Show resolved Hide resolved
proposals/22-04-localize-command.md Show resolved Hide resolved
proposals/22-04-localize-command.md Show resolved Hide resolved
proposals/22-04-localize-command.md Show resolved Hide resolved
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: annasong20, KnVerey

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

The pull request process is described 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 k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 15, 2022
@k8s-ci-robot k8s-ci-robot merged commit 03ac2e1 into kubernetes-sigs:master May 15, 2022
@annasong20 annasong20 deleted the localize-proposal branch June 7, 2022 16:35
annasong20 added a commit to annasong20/kustomize that referenced this pull request Jun 8, 2022
k8s-ci-robot pushed a commit that referenced this pull request Jul 5, 2022
* Address nits on #4590 and correct mistakes

* Flesh out remote target use case

Remove scope, add ref, add user story
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants