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

new command kustomize edit add buildmetadata #4413

Merged
merged 2 commits into from
Jan 26, 2022

Conversation

natasha41575
Copy link
Contributor

@natasha41575 natasha41575 commented Jan 21, 2022

This is the last PR needed to finish implementation of the proposal to add origin and transformer annotations [link to KEP].

This adds a command kustomize edit add buildmetadata that allows users to edit the buildMetadata options in the kustomization file. It also adds kustomize edit set buildmetadata and kustomize edit remove buildmetadata commands.

E.g. kustomize edit add buildmetadata managedByLabel, kustomize edit add buildmetadata originAnnotations,transformerAnnotations

/cc @yuwenma
/cc @KnVerey

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

@natasha41575: 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 added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 21, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: natasha41575

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 Jan 21, 2022
@natasha41575 natasha41575 changed the title new command kustomize edit add buildmetadata new command kustomize edit add buildmetadata Jan 21, 2022
@natasha41575 natasha41575 force-pushed the editBuildMeta branch 3 times, most recently from 1e5e5db to d0ac733 Compare January 21, 2022 18:35
@yuwenma
Copy link
Contributor

yuwenma commented Jan 24, 2022

Shall we add the "buildmetadata" to kustomize edit remove as well?

@natasha41575
Copy link
Contributor Author

Shall we add the "buildmetadata" to kustomize edit remove as well?

Yes we should, I was thinking about doing that in a separate PR but I can add it to this one instead

}
}
return nil
}
Copy link
Contributor

@yuwenma yuwenma Jan 25, 2022

Choose a reason for hiding this comment

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

Normally we define the function Validate to be sharable among setBuildMetadataOptions, addBuildMetadataOptions, removeBuildMetadataOptions? But I can see this may introduces more code structure to kustomize/commands/set dir. So it defers to you

What we can do to share the code: add a new structure buildMetadataValidator which has the Validate func, and itself is an attribute to the other functions? e.g.

package cmdvalidate // a sub dir under kustomize/commands/internal
type buildMetadataValidator struct {}

func (b *buildMetadataValidator) Validate() {
   ...
}
type setBuildMetadataOptions struct {
       *buildMetadataValidator
	buildMetadataOptions []string
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did this in kustomize/commands/util/validate.go, because the util package already had some common functions shared among the edit commands. Thanks for the suggestion!

@natasha41575 natasha41575 force-pushed the editBuildMeta branch 2 times, most recently from 058c639 to d825e36 Compare January 26, 2022 23:19
@yuwenma
Copy link
Contributor

yuwenma commented Jan 26, 2022

/lgtm

Looks great!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 26, 2022
@k8s-ci-robot k8s-ci-robot merged commit bcebad1 into kubernetes-sigs:master Jan 26, 2022
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/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.

3 participants