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

Move each kubectl command to a separate directory #69464

Merged
merged 4 commits into from Oct 6, 2018

Conversation

@soltysh
Contributor

soltysh commented Oct 5, 2018

What this PR does / why we need it:
/kind cleanup

Special notes for your reviewer:
/assign @juanvallejo @seans3 @pwittrock

Release note:

NONE
@soltysh

This comment has been minimized.

Show comment
Hide comment
@soltysh

soltysh Oct 5, 2018

Contributor

/sig cli

Contributor

soltysh commented Oct 5, 2018

/sig cli

@pwittrock

This comment has been minimized.

Show comment
Hide comment
@pwittrock

pwittrock Oct 5, 2018

Member

From a high level this LGTM. Will let @seans3 do the more detailed review.

Member

pwittrock commented Oct 5, 2018

From a high level this LGTM. Will let @seans3 do the more detailed review.

@seans3

seans3 approved these changes Oct 5, 2018

This is much better organization of the code. Just a question on if we want commands to depend on other commands (or only something like common or util). If we think we don't want inter-command dependencies, then I think we should add a TODO, and fix in another PR. Another idea we might want to think about is if we should create an unexported "internal" directory somewhere to make clear what is exportable.

gracePeriod: o.DeleteOptions.GracePeriod,
serverDryRun: o.ServerDryRun,
openapiSchema: openapiSchema,
patcher := &Patcher{

This comment has been minimized.

@seans3

seans3 Oct 5, 2018

Collaborator

The diff command uses this. Should we put a TODO here to refactor this into it's own file?

@seans3

seans3 Oct 5, 2018

Collaborator

The diff command uses this. Should we put a TODO here to refactor this into it's own file?

@@ -31,6 +31,7 @@ import (
"k8s.io/cli-runtime/pkg/genericclioptions/resource"
restclient "k8s.io/client-go/rest"
"k8s.io/client-go/tools/remotecommand"
"k8s.io/kubernetes/pkg/kubectl/cmd/exec"

This comment has been minimized.

@seans3

seans3 Oct 5, 2018

Collaborator

Should a command depend on other commands. If we don't this so, can we put a TODO here to fix in the future? Like you said, I don't think we should address this here because the PR is already big.

@seans3

seans3 Oct 5, 2018

Collaborator

Should a command depend on other commands. If we don't this so, can we put a TODO here to fix in the future? Like you said, I don't think we should address this here because the PR is already big.

@@ -416,72 +447,72 @@ func NewKubectlCommand(in io.Reader, out, err io.Writer) *cobra.Command {
Message: "Basic Commands (Beginner):",
Commands: []*cobra.Command{
create.NewCmdCreate(f, ioStreams),
NewCmdExposeService(f, ioStreams),
NewCmdRun(f, ioStreams),
expose.NewCmdExposeService(f, ioStreams),

This comment has been minimized.

@seans3

seans3 Oct 5, 2018

Collaborator

This is much easier to read, with the package prefixing the "New" command.

@seans3

seans3 Oct 5, 2018

Collaborator

This is much easier to read, with the package prefixing the "New" command.

@@ -30,6 +30,7 @@ import (
"k8s.io/cli-runtime/pkg/genericclioptions"
"k8s.io/client-go/kubernetes"
restclient "k8s.io/client-go/rest"
"k8s.io/kubernetes/pkg/kubectl/cmd/exec"

This comment has been minimized.

@seans3

seans3 Oct 5, 2018

Collaborator

Ditton on depending on other commands.

@seans3

seans3 Oct 5, 2018

Collaborator

Ditton on depending on other commands.

@@ -34,6 +34,7 @@ import (
"k8s.io/cli-runtime/pkg/genericclioptions"
"k8s.io/cli-runtime/pkg/genericclioptions/resource"
"k8s.io/kubernetes/pkg/kubectl"
"k8s.io/kubernetes/pkg/kubectl/cmd/apply"

This comment has been minimized.

@seans3

seans3 Oct 5, 2018

Collaborator

Ditto on depending on other commands.

@seans3

seans3 Oct 5, 2018

Collaborator

Ditto on depending on other commands.

@@ -33,6 +33,7 @@ import (
"k8s.io/cli-runtime/pkg/genericclioptions"
"k8s.io/cli-runtime/pkg/genericclioptions/resource"
"k8s.io/kubernetes/pkg/kubectl"
"k8s.io/kubernetes/pkg/kubectl/cmd/delete"

This comment has been minimized.

@seans3

seans3 Oct 5, 2018

Collaborator

Ditto on depending on other commands.

@seans3

seans3 Oct 5, 2018

Collaborator

Ditto on depending on other commands.

@@ -39,6 +39,10 @@ import (
corev1client "k8s.io/client-go/kubernetes/typed/core/v1"
watchtools "k8s.io/client-go/tools/watch"
"k8s.io/kubernetes/pkg/kubectl"
"k8s.io/kubernetes/pkg/kubectl/cmd/attach"

This comment has been minimized.

@seans3

seans3 Oct 5, 2018

Collaborator

Ditto on depending on other commands.

@seans3

seans3 Oct 5, 2018

Collaborator

Ditto on depending on other commands.

@seans3

This comment has been minimized.

Show comment
Hide comment
@seans3

seans3 Oct 5, 2018

Collaborator

/lgtm

Collaborator

seans3 commented Oct 5, 2018

/lgtm

@k8s-ci-robot k8s-ci-robot added lgtm and removed lgtm approved labels Oct 5, 2018

@soltysh

This comment has been minimized.

Show comment
Hide comment
@soltysh

soltysh Oct 5, 2018

Contributor

Just a question on if we want commands to depend on other commands (or only something like common or util).

That is a good question, but the current patterns we have allow this. See how we use wait and delete flags in other commands. We might want to discuss that during next SIG meeting. It's worth discussing before moving further. It'll take us a few more bits to move the bits here and there, but at least this initial batch is done :)

Re-applying the label back, since I've only fixed bazel. I'm also applying the approve based on slack approval from Phil.

Contributor

soltysh commented Oct 5, 2018

Just a question on if we want commands to depend on other commands (or only something like common or util).

That is a good question, but the current patterns we have allow this. See how we use wait and delete flags in other commands. We might want to discuss that during next SIG meeting. It's worth discussing before moving further. It'll take us a few more bits to move the bits here and there, but at least this initial batch is done :)

Re-applying the label back, since I've only fixed bazel. I'm also applying the approve based on slack approval from Phil.

@k8s-ci-robot k8s-ci-robot removed the lgtm label Oct 5, 2018

@seans3

This comment has been minimized.

Show comment
Hide comment
@seans3

seans3 Oct 5, 2018

Collaborator

/lgtm

Collaborator

seans3 commented Oct 5, 2018

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm label Oct 5, 2018

@k8s-ci-robot

This comment has been minimized.

Show comment
Hide comment
@k8s-ci-robot

k8s-ci-robot Oct 5, 2018

Contributor

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by: seans3, soltysh

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

Contributor

k8s-ci-robot commented Oct 5, 2018

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by: seans3, soltysh

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

@fejta-bot

This comment has been minimized.

Show comment
Hide comment
@fejta-bot

fejta-bot Oct 6, 2018

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel comment for consistent failures.

fejta-bot commented Oct 6, 2018

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel comment for consistent failures.

@fejta-bot

This comment has been minimized.

Show comment
Hide comment
@fejta-bot

fejta-bot Oct 6, 2018

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel comment for consistent failures.

fejta-bot commented Oct 6, 2018

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel comment for consistent failures.

@fejta-bot

This comment has been minimized.

Show comment
Hide comment
@fejta-bot

fejta-bot Oct 6, 2018

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel comment for consistent failures.

fejta-bot commented Oct 6, 2018

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel comment for consistent failures.

soltysh added some commits Oct 5, 2018

@k8s-ci-robot

This comment has been minimized.

Show comment
Hide comment
@k8s-ci-robot

k8s-ci-robot Oct 6, 2018

Contributor

New changes are detected. LGTM label has been removed.

Contributor

k8s-ci-robot commented Oct 6, 2018

New changes are detected. LGTM label has been removed.

@k8s-ci-robot k8s-ci-robot removed the lgtm label Oct 6, 2018

@soltysh

This comment has been minimized.

Show comment
Hide comment
@soltysh

soltysh Oct 6, 2018

Contributor

Just rebased, re-applying the label back.

Contributor

soltysh commented Oct 6, 2018

Just rebased, re-applying the label back.

@soltysh soltysh added the lgtm label Oct 6, 2018

@k8s-ci-robot k8s-ci-robot merged commit 06de51c into kubernetes:master Oct 6, 2018

18 checks passed

cla/linuxfoundation soltysh 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-e2e-gke Skipped
pull-kubernetes-e2e-kops-aws Job succeeded.
Details
pull-kubernetes-e2e-kubeadm-gce Skipped
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
tide In merge pool.
Details
@m1kola

This comment has been minimized.

Show comment
Hide comment
@m1kola

m1kola Oct 7, 2018

Contributor

Thanks for this! Now it takes less time to run tests and check coverage for a specific kubectl command.

Contributor

m1kola commented Oct 7, 2018

Thanks for this! Now it takes less time to run tests and check coverage for a specific kubectl command.

@soltysh soltysh deleted the soltysh:restructure_kubectl branch Oct 8, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment