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

Modify fix command to replace vars with replacements #3849

Closed
monopole opened this issue Apr 28, 2021 · 3 comments
Closed

Modify fix command to replace vars with replacements #3849

monopole opened this issue Apr 28, 2021 · 3 comments
Assignees

Comments

@monopole
Copy link
Contributor

We should at lease see how difficult this would be.

so running

kustomize fix

would, say:

  • copying the kustomization and everything it referred to to a tmp dir
  • running the build and saving the output to the tmp dir
  • then (vars specific):
    • scanning all resources for embedded $VAR placeholders,
    • computing the target address for a replacement entry (where the $VAR was found),
    • replacing $VAR with some non-dollar, placeholder value that's legal (could be applied to the cluster)
      but perhaps unusual (e.g. the literal string 'placeholder', or the number 99999)
    • writing the modified resource files and kustomization files back to the tmp dir
  • running build again to compare the new result to the old result
  • if no change, copy everything back over the top of the real resources
  • else report error and don't copy
  • delete the tmp dir

kustomize fix does not do the copy and compare now, but it should have done so from the start, so part of this work fixes something that should already be there (and that could be peeled off into a different issue done b4fore this one)

@monopole monopole changed the title Modify fix command to replace use of vars with replacements Modify fix command to replace vars with replacements Apr 28, 2021
@natasha41575 natasha41575 self-assigned this Apr 28, 2021
@natasha41575
Copy link
Contributor

Will work on it

@natasha41575
Copy link
Contributor

natasha41575 commented May 25, 2021

Currently working on this and commenting to reflect discussion:

Rather than copying the directory, we will have this behind a flag (e.g. kustomize edit fix --vars), and it should output a diff between the previous and new output of kustomize build. In a git repository the changes will be easy to undo if the output is different.

@natasha41575
Copy link
Contributor

closed by #3926

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants