* feat: add new command 'edit set configmap'
* Add a new command 'edit set configmap' to allow editing the values of an
already-existing configmap in a kustomization file.
* Add tests to validate the new feature.
* fix: add tests, minor refactoring to use constants
* Include tests to validade the new function ValidateSet, included to do
necessary validations when running the 'kustomize edit set configmap' command.
* Minor refactorings to use the existing constants in the 'edit set configmap'
command.
* Add dashes before each item in the comment explaining how ExpandFileSource()
works so IDEs don't try to reformat the list and remove the indentation in it.
* Because this change mutates the list of literal sources, ensure that both add
and set save the resulting list in a predictable order to make it easier to
check when new items are added/removed and aid in testing.
* Since literal sources are the only bit that's important in this test, verify
that the literal sources in the actual result is equal to what we expected it
to be.
* fix: change format to print resource name
Use '%q' formatter instead of '%s' to print resource name
Co-authored-by: Varsha <varshaprasad96@gmail.com>
* fix: add changes from code review
* Unexport constant that is used only in the scope of a single function.
* Add extra validation to ensure format is correct with one single '=' per key-value
pair.
* Add extra set of tests to validate format.
* Update test case to match new printed format in the error message.
* fix: rollback sort for edit add/set configmap
* chore: rename test package and unexport functions
Rename the test package from set_test back to set and unexport functions that do
not need to be exported anymore for testing purposes.
* feat: handle empty and default namespace as equal
Handle the empty and the default namespaces as equal. Add tests to validate this
scenario.
---------
Co-authored-by: Varsha <varshaprasad96@gmail.com>
Kind:
Refactor
Summary:
Setters functionality is provided as a KRM function. We should remove code related to setters in cmd/config and kyaml.
As of now most setters2 and setters usage are related to fork of kpt, however, these:
[fluxcd/image-automation-controller](6827808a1a/pkg/update/filter.go (L24)) with [kyml](6827808a1a/go.mod (L42))
[rancher/fleet](0a6cf6cb92/internal/cmd/controller/controllers/image/update/setters.go (L16)) with [kyaml](0a6cf6cb92/go.mod (L75))
Repositories still using them, They pinned these two into a specific kyaml version. If we decide to go for this removal then we can make a release note that this is actually removed on the next version since we already marked this as deprecated before.
This PR is an effort towards reducing the public surface
of APIs. It move image/ to internal/image
Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com>
(cherry picked from commit 1f5890709fdc17de6f44f42b5138dd0f7e64bc74)
This PR introduces go-api-diff checker in Makefile
and in CI to make sure we don't end up breaking APIs
unintentionally.
Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com>
* change: components apply after all generator and transformer applied
* fix name for a test case
* add comment about when the components will be executed
* components are applied before transformer
* api: Add new types for customizeable resource ordering
Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>
* plugins: Implement SortOrderTransformer plugin
Implement the SortOrderTransformer plugin. This plugin allows the user
to customize the order that kustomize will output resources in.
The API for the plugin is the following:
sortOptions:
order: legacy | fifo
legacySortOptions:
orderFirst:
- {GVK}
orderLast:
- {GVK}
Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>
* plugins: Add boilerplate and generate code for new SortOrderTransformer
Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>
* build: Add option to denote if the reorder flag was set by the user
We want to take different actions if the reorder flag was set by the
user or filled by the default value. Thus, we propagate this information
from build to the krusty options.
Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com>
* api/krusty: Ensure sort ordering works with CLI flag and kustomization
Sort order can be defined in two places:
- (new) kustomization file
- (old) CLI flag
We want the kustomization file to take precedence over the CLI flag.
Eventually, we may want to move away from having a CLI flag altogether:
https://github.com/kubernetes-sigs/kustomize/issues/3947
Case 1: Sort order set in kustomization file AND in CLI flag.
Print a warning and let the kustomization file take precedence.
Case 2: Sort order set in CLI flag only or not at all.
Follow the CLI flag (defaults to legacy) and reorder at the end.
Case 3: Sort order set in kustomization file only.
Simply build the kustomization.
Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com>
* krusty: Add e2e test for SortOrderTransformer
Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>
* plugins: Purge LegacyOrderTransformer
Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com>
* Update go.work.sum
Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com>
* review: Make review changes
Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com>
Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>
Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com>