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

feat: edit set configmap #5391

Merged

Conversation

stormqueen1990
Copy link
Member

@stormqueen1990 stormqueen1990 commented Oct 18, 2023

First pass at implementing the edit set configmap command. Initally adding just two flags: --from-literal and --new-namespace.

Related issue: #4493

@k8s-ci-robot
Copy link
Contributor

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
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Oct 18, 2023
@k8s-ci-robot k8s-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Oct 18, 2023
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.

Quick drive by comments. Overall approach LGTM. I can do a more thorough review once this is taken out of draft state.

kustomize/commands/edit/add/addconfigmap.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Oct 26, 2023
@stormqueen1990 stormqueen1990 marked this pull request as ready for review October 26, 2023 00:19
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 26, 2023
Copy link
Contributor

@ncapps ncapps left a comment

Choose a reason for hiding this comment

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

I left minor questions and suggestions. I assume the set secret functionality will be added in a follow up PR?

kustomize/commands/edit/set/configmap.go Outdated Show resolved Hide resolved
kustomize/commands/edit/set/configmap.go Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 29, 2023
@stormqueen1990
Copy link
Member Author

I left minor questions and suggestions. I assume the set secret functionality will be added in a follow up PR?

Hi @ncapps! Yes, that's correct. I intend to add edit set secret in a separate PR, as smaller blocks are usually easier to review and push forward.

Copy link
Member

@charles-chenzz charles-chenzz left a comment

Choose a reason for hiding this comment

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

overall lgtm
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 30, 2023
@ncapps
Copy link
Contributor

ncapps commented Oct 30, 2023

I am not an official reviewer but these changes lgtm.

Copy link
Member

@varshaprasad96 varshaprasad96 left a comment

Choose a reason for hiding this comment

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

@stormqueen1990 Thanks for the PR. My reviews are just language specific nits. The general logic seems good :)

/lgtm

kustomize/commands/edit/set/configmap.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 31, 2023
Copy link
Member

@charles-chenzz charles-chenzz left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 2, 2023
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.

Overall looks good. Minor question and nit.

kustomize/commands/edit/add/configmap.go Outdated Show resolved Hide resolved
kustomize/commands/edit/set/configmap.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 4, 2023
@k8s-ci-robot k8s-ci-robot removed lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Nov 4, 2023
stormqueen1990 and others added 7 commits November 16, 2023 21:47
* 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.
* 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.
Use '%q' formatter instead of '%s' to print resource name

Co-authored-by: Varsha <varshaprasad96@gmail.com>
* 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.
Rename the test package from set_test back to set and unexport functions that do
not need to be exported anymore for testing purposes.
Handle the empty and the default namespaces as equal. Add tests to validate this
scenario.
@stormqueen1990
Copy link
Member Author

/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 17, 2023
Copy link
Member

@charles-chenzz charles-chenzz left a comment

Choose a reason for hiding this comment

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

Thanks
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 17, 2023
@natasha41575
Copy link
Contributor

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: natasha41575, stormqueen1990

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 Nov 17, 2023
@k8s-ci-robot k8s-ci-robot merged commit 30893b0 into kubernetes-sigs:master Nov 17, 2023
9 checks passed
@stormqueen1990 stormqueen1990 deleted the feat/edit-set-configmap branch November 18, 2023 20:59
@ncapps ncapps mentioned this pull request Dec 1, 2023
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. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Development

Successfully merging this pull request may close these issues.

None yet

6 participants