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

add kustomize as a subcommand in kubectl #73033

Merged
merged 4 commits into from
Feb 12, 2019

Conversation

Liujingfang1
Copy link
Contributor

@Liujingfang1 Liujingfang1 commented Jan 17, 2019

What type of PR is this?
/kind feature

What this PR does / why we need it:
Add kustomize as a subcommand in kubectl
KEP
feature issue

Which issue(s) this PR fixes:

Fixes kubernetes/enhancements#633

Special notes for your reviewer:

$ kubectl kustomize --help
Print a set of API resources generated from instructions in a kustomization.yaml file. 

The argument must be the path to the directory containing the file, or a git
repository URL with a path suffix specifying same with respect to the repository root. 

kubectl kustomize somedir

Examples:
  # Use the current working directory
  kubectl kustomize .
  
  # Use some shared configuration directory
  kubectl kustomize /home/configuration/production
  
  # Use a URL
  kubectl kustomize github.com/kubernetes-sigs/kustomize.git/examples/helloWorld?ref=v1.0.6

Usage:
  kubectl kustomize <dir> [flags] [options]

Use "kubectl options" for a list of global command-line options (applies to all commands).

Does this PR introduce a user-facing change?:

Kustomize is developed in its own repo https://github.com/kubernetes-sigs/kustomize

This PR added a new subcommand `kustomize` in kubectl. 
  kubectl kustomize <somedir> has the same effect as kustomize build <somedir>

To build API resources from somedir with a kustomization.yaml file
   kubectl kustomize <somedir>

This command can be piped to apply or delete 
   kubectl kustomize <somedir> | kubectl apply -f -
   kubectl kustomize <somedir> | kubectl delete -f -

@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. release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Jan 17, 2019
@k8s-ci-robot
Copy link
Contributor

Hi @Liujingfang1. Thanks for your PR.

I'm waiting for a kubernetes 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 needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jan 17, 2019
@k8s-ci-robot k8s-ci-robot added area/kubectl sig/cli Categorizes an issue or PR as relevant to SIG CLI. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jan 17, 2019
@Liujingfang1 Liujingfang1 force-pushed the kustomizeSubcommand branch 2 times, most recently from 0a4433a to bcba36f Compare January 17, 2019 22:26
@Liujingfang1
Copy link
Contributor Author

/sig-cli

Copy link
Contributor

@monopole monopole left a comment

Choose a reason for hiding this comment

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

integration looks unobtrusive

pkg/kubectl/cmd/kustomize/kustomize.go Outdated Show resolved Hide resolved
pkg/kubectl/cmd/kustomize/kustomize.go Outdated Show resolved Hide resolved
@Liujingfang1 Liujingfang1 force-pushed the kustomizeSubcommand branch 2 times, most recently from d7ea877 to 71c10ca Compare January 18, 2019 19:05
@Liujingfang1 Liujingfang1 changed the title [WIP] add kustomize as a subcommand in kubectl add kustomize as a subcommand in kubectl Jan 18, 2019
@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 Jan 18, 2019
@Liujingfang1
Copy link
Contributor Author

/ok-to-test

@k8s-ci-robot
Copy link
Contributor

@Liujingfang1: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/ok-to-test

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.

@mengqiy
Copy link
Member

mengqiy commented Jan 18, 2019

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 18, 2019
@mengqiy
Copy link
Member

mengqiy commented Jan 18, 2019

/priority important-soon

@k8s-ci-robot k8s-ci-robot added priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Jan 18, 2019
)

// NewCmdKustomize returns a kustomize command
func NewCmdKustomize() *cobra.Command {
Copy link
Member

@liggitt liggitt Feb 11, 2019

Choose a reason for hiding this comment

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

consume genericclioption.IOStreams as a param here (already constructed in NewKubectlCommand and passed into all other command constructors) and propagate into RunKustomizeBuild, rather than hard-coding os.Stdout

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to use genericclioption.IOStreams.

@liggitt
Copy link
Member

liggitt commented Feb 11, 2019

from the vendor kustomize 2.0.1 commit:

  • squash the Godeps and vendor/sigs.k8s.io/kustomize changes to vendor kustomize
  • squash staging/src/k8s.io/cli-runtime/pkg/kustomize/k8sdeps changes to copy kustomize/k8sdeps into cli-runtime

@liggitt
Copy link
Member

liggitt commented Feb 11, 2019

is the process for copy kustomize/k8sdeps into cli-runtime commit documented or scriptable?

@liggitt
Copy link
Member

liggitt commented Feb 11, 2019

looks consistent with the proposed integration. a few cleanup comments, then lgtm

@Liujingfang1
Copy link
Contributor Author

@liggitt

from the vendor kustomize 2.0.1 commit:

  • squash the Godeps and vendor/sigs.k8s.io/kustomize changes to vendor kustomize
  • squash staging/src/k8s.io/cli-runtime/pkg/kustomize/k8sdeps changes to copy kustomize/k8sdeps into cli-runtime

This is done.

is the process for copy kustomize/k8sdeps into cli-runtime commit documented or scriptable?

This is documented https://github.com/kubernetes-sigs/kustomize/blob/master/build/vendor_kustomize.sh#L74
There is a function to copy that directory and update the import paths.

@liggitt
Copy link
Member

liggitt commented Feb 11, 2019

/lgtm
/approve
/retest

/hold
for @soltysh

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Feb 11, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: liggitt, Liujingfang1

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 Feb 11, 2019
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 12, 2019
@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Feb 12, 2019

@Liujingfang1: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-e2e-kops-aws 0126f745390e563305da14cd6c337033470a2cbf link /test pull-kubernetes-e2e-kops-aws

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@Liujingfang1
Copy link
Contributor Author

/test pull-kubernetes-verify

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

@soltysh soltysh left a comment

Choose a reason for hiding this comment

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

/hold cancel
/lgtm

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. area/kubectl cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. 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. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/cli Categorizes an issue or PR as relevant to SIG CLI. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

integrate Kustomize into kubectl
9 participants