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

Bug 1788194: allow --config and --kubeconfig #246

Merged
merged 2 commits into from Jan 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -94,7 +94,7 @@ replace (
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.0.0-20191121182328-3e5a379d6404
k8s.io/kube-proxy => k8s.io/kube-proxy v0.0.0-20191121182004-c1057c1a0821
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.0.0-20191121182219-f40ec664a26f
k8s.io/kubectl => github.com/openshift/kubernetes-kubectl v0.0.0-20200107205144-7f331345e3e8
k8s.io/kubectl => github.com/openshift/kubernetes-kubectl v0.0.0-20200109100530-0dbab4a25283
k8s.io/kubelet => k8s.io/kubelet v0.0.0-20191121182112-95f295975fc9
k8s.io/kubernetes => github.com/openshift/kubernetes v1.17.0-alpha.0.0.20191216151305-079984b0a154
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.0.0-20191215115203-1896ee2ad49b
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Expand Up @@ -593,8 +593,8 @@ github.com/openshift/kubernetes-cli-runtime v0.0.0-20191211181810-5b89652d688e h
github.com/openshift/kubernetes-cli-runtime v0.0.0-20191211181810-5b89652d688e/go.mod h1:1E5iQpMODZq2lMWLUJELwRu2MLWIzwvMgDBpn3Y81Qo=
github.com/openshift/kubernetes-client-go v0.0.0-20191211181558-5dcabadb2b45 h1:jHJuv5QzUaLdx50lkvTYcZqM59xNhV6insW6K0EAduQ=
github.com/openshift/kubernetes-client-go v0.0.0-20191211181558-5dcabadb2b45/go.mod h1:TYgR6EUHs6k45hb6KWjVD6jFZvJV4gHDikv/It0xz+k=
github.com/openshift/kubernetes-kubectl v0.0.0-20200107205144-7f331345e3e8 h1:WOfau7ZmF9RcFA3FgCQyvO1blQSq/b4a6lJjcUxASiM=
github.com/openshift/kubernetes-kubectl v0.0.0-20200107205144-7f331345e3e8/go.mod h1:jIPrUAW656Vzn9wZCCe0PC+oTcu56u2HgFD21Xbfk1s=
github.com/openshift/kubernetes-kubectl v0.0.0-20200109100530-0dbab4a25283 h1:d1ReQs7UB13PeKZ8Xj9mi4q5HSMkwLilafR5gdwTaBs=
github.com/openshift/kubernetes-kubectl v0.0.0-20200109100530-0dbab4a25283/go.mod h1:jIPrUAW656Vzn9wZCCe0PC+oTcu56u2HgFD21Xbfk1s=
github.com/openshift/library-go v0.0.0-20200102104155-021f88c1381d h1:x3iGkw/dKQUOhjeGdlS/+5Ev1iYODMseFsRGNCAQ84Q=
github.com/openshift/library-go v0.0.0-20200102104155-021f88c1381d/go.mod h1:+EzNb8oA3fnhC613pNcAU0DJ9s3m6WaIMECIVQm2ork=
github.com/openshift/onsi-ginkgo v0.0.0-20190125161613-53ca7dc85f60 h1:5nzHJsbOaopxpyfxKmKKM3kq5rVlKiFzDuhByGLfJFQ=
Expand Down
12 changes: 1 addition & 11 deletions pkg/cli/kubectlwrappers/wrappers.go
Expand Up @@ -3,7 +3,6 @@ package kubectlwrappers
import (
"bufio"
"flag"
"path"
"strings"

"github.com/spf13/cobra"
Expand Down Expand Up @@ -226,16 +225,7 @@ func NewCmdEdit(fullName string, f kcmdutil.Factory, streams genericclioptions.I

// NewCmdConfig is a wrapper for the Kubernetes cli config command
func NewCmdConfig(fullName, name string, f kcmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command {
pathOptions := &kclientcmd.PathOptions{
GlobalFile: kclientcmd.RecommendedHomeFile,
EnvVar: kclientcmd.RecommendedConfigPathEnvVar,
ExplicitFileFlag: genericclioptions.OpenShiftKubeConfigFlagName,
Copy link
Member Author

Choose a reason for hiding this comment

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

@sallyom this was the place that was panicing for you, b/c it tried to have --config registered twice.

Copy link
Contributor

Choose a reason for hiding this comment

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

oh, I see what I was doing wrong now. I was duplicating the if !openshiftpatch.IsOC in this file, so not fixing the panic.


GlobalFileSubpath: path.Join(kclientcmd.RecommendedHomeDir, kclientcmd.RecommendedFileName),

LoadingRules: kclientcmd.NewDefaultClientConfigLoadingRules(),
}
pathOptions.LoadingRules.DoNotResolvePaths = true
pathOptions := kclientcmd.NewDefaultPathOptions()

return cmdutil.ReplaceCommandName("kubectl", fullName, templates.Normalize(config.NewCmdConfig(f, pathOptions, streams)))
}
Expand Down
8 changes: 7 additions & 1 deletion vendor/k8s.io/kubectl/pkg/cmd/config/config.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 0 additions & 32 deletions vendor/k8s.io/kubernetes/cmd/genutils/BUILD

This file was deleted.

43 changes: 0 additions & 43 deletions vendor/k8s.io/kubernetes/cmd/genutils/genutils.go

This file was deleted.

3 changes: 1 addition & 2 deletions vendor/modules.txt
Expand Up @@ -905,7 +905,7 @@ k8s.io/kube-openapi/pkg/common
k8s.io/kube-openapi/pkg/util/proto
k8s.io/kube-openapi/pkg/util/proto/testing
k8s.io/kube-openapi/pkg/util/proto/validation
# k8s.io/kubectl v0.0.0 => github.com/openshift/kubernetes-kubectl v0.0.0-20200107205144-7f331345e3e8
# k8s.io/kubectl v0.0.0 => github.com/openshift/kubernetes-kubectl v0.0.0-20200109100530-0dbab4a25283
k8s.io/kubectl/pkg/apps
k8s.io/kubectl/pkg/cmd
k8s.io/kubectl/pkg/cmd/annotate
Expand Down Expand Up @@ -984,7 +984,6 @@ k8s.io/kubectl/pkg/util/templates
k8s.io/kubectl/pkg/util/term
k8s.io/kubectl/pkg/validation
# k8s.io/kubernetes v0.0.0-00010101000000-000000000000 => github.com/openshift/kubernetes v1.17.0-alpha.0.0.20191216151305-079984b0a154
k8s.io/kubernetes/cmd/genutils
k8s.io/kubernetes/pkg/api/legacyscheme
k8s.io/kubernetes/pkg/apis/apps
k8s.io/kubernetes/pkg/apis/apps/install
Expand Down