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 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

This comment has been minimized.

Copy link
Contributor

k8s-ci-robot commented Jan 17, 2019

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 requested review from dchen1107 and dixudx Jan 17, 2019

@Liujingfang1 Liujingfang1 force-pushed the Liujingfang1:kustomizeSubcommand branch 2 times, most recently from 0a4433a to bcba36f Jan 17, 2019

@Liujingfang1

This comment has been minimized.

Copy link
Contributor Author

Liujingfang1 commented Jan 17, 2019

/sig-cli

@monopole
Copy link
Contributor

monopole left a comment

integration looks unobtrusive

Show resolved Hide resolved pkg/kubectl/cmd/kustomize/kustomize.go Outdated
Show resolved Hide resolved pkg/kubectl/cmd/kustomize/kustomize.go Outdated

@Liujingfang1 Liujingfang1 force-pushed the Liujingfang1:kustomizeSubcommand branch 2 times, most recently from d7ea877 to 71c10ca Jan 18, 2019

@Liujingfang1 Liujingfang1 changed the title [WIP] add kustomize as a subcommand in kubectl add kustomize as a subcommand in kubectl Jan 18, 2019

@Liujingfang1

This comment has been minimized.

Copy link
Contributor Author

Liujingfang1 commented Jan 18, 2019

/ok-to-test

@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

k8s-ci-robot commented Jan 18, 2019

@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

This comment has been minimized.

Copy link
Contributor

mengqiy commented Jan 18, 2019

/ok-to-test

@mengqiy

This comment has been minimized.

Copy link
Contributor

mengqiy commented Jan 18, 2019

/priority important-soon

@k8s-ci-robot k8s-ci-robot removed the lgtm label Feb 8, 2019

@Liujingfang1 Liujingfang1 force-pushed the Liujingfang1:kustomizeSubcommand branch 2 times, most recently from 877eaf3 to cbcd616 Feb 11, 2019

@Liujingfang1

This comment has been minimized.

Copy link
Contributor Author

Liujingfang1 commented Feb 11, 2019

/test pull-kubernetes-integration

)

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

This comment has been minimized.

@liggitt

liggitt Feb 11, 2019

Member

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

This comment has been minimized.

@Liujingfang1

Liujingfang1 Feb 11, 2019

Author Contributor

Updated to use genericclioption.IOStreams.

@liggitt

This comment has been minimized.

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

This comment has been minimized.

Copy link
Member

liggitt commented Feb 11, 2019

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

@liggitt

This comment has been minimized.

Copy link
Member

liggitt commented Feb 11, 2019

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

@Liujingfang1 Liujingfang1 force-pushed the Liujingfang1:kustomizeSubcommand branch from cbcd616 to 8bda532 Feb 11, 2019

@Liujingfang1

This comment has been minimized.

Copy link
Contributor Author

Liujingfang1 commented Feb 11, 2019

@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

This comment has been minimized.

Copy link
Member

liggitt commented Feb 11, 2019

/lgtm
/approve
/retest

/hold
for @soltysh

@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

k8s-ci-robot commented Feb 11, 2019

[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

@Liujingfang1 Liujingfang1 force-pushed the Liujingfang1:kustomizeSubcommand branch from 8bda532 to 8d6ab20 Feb 12, 2019

@k8s-ci-robot k8s-ci-robot removed the lgtm label Feb 12, 2019

@k8s-ci-robot

This comment has been minimized.

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 0126f74 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

This comment has been minimized.

Copy link
Contributor Author

Liujingfang1 commented Feb 12, 2019

/test pull-kubernetes-verify

@k8s-ci-robot k8s-ci-robot added the lgtm label Feb 12, 2019

@soltysh
Copy link
Contributor

soltysh left a comment

/hold cancel
/lgtm

@k8s-ci-robot k8s-ci-robot merged commit 66149bd into kubernetes:master Feb 12, 2019

17 checks passed

cla/linuxfoundation Liujingfang1 authorized
Details
pull-kubernetes-bazel-build Job succeeded.
Details
pull-kubernetes-bazel-test Job succeeded.
Details
pull-kubernetes-cross Job succeeded.
Details
pull-kubernetes-e2e-gce Job succeeded.
Details
pull-kubernetes-e2e-gce-100-performance Job succeeded.
Details
pull-kubernetes-e2e-gce-device-plugin-gpu Job succeeded.
Details
pull-kubernetes-godeps Job succeeded.
Details
pull-kubernetes-integration Job succeeded.
Details
pull-kubernetes-kubemark-e2e-gce-big Job succeeded.
Details
pull-kubernetes-local-e2e Skipped
pull-kubernetes-local-e2e-containerized Skipped
pull-kubernetes-node-e2e Job succeeded.
Details
pull-kubernetes-typecheck Job succeeded.
Details
pull-kubernetes-verify Job succeeded.
Details
pull-publishing-bot-validate Skipped
tide In merge pool.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment