mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-04 23:17:50 +00:00
switch some commands to use its own scheme
This commit is contained in:
@@ -37,15 +37,20 @@ import (
|
||||
restclient "k8s.io/client-go/rest"
|
||||
"k8s.io/client-go/rest/fake"
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/api/legacyscheme"
|
||||
"k8s.io/kubernetes/pkg/api/testapi"
|
||||
cmdtesting "k8s.io/kubernetes/pkg/kubectl/cmd/testing"
|
||||
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
|
||||
"k8s.io/kubernetes/pkg/kubectl/scheme"
|
||||
"k8s.io/kubernetes/pkg/printers"
|
||||
printersinternal "k8s.io/kubernetes/pkg/printers/internalversion"
|
||||
"k8s.io/kubernetes/pkg/util/strings"
|
||||
)
|
||||
|
||||
// This init should be removed after switching this command and its tests to user external types.
|
||||
func init() {
|
||||
api.AddToScheme(scheme.Scheme)
|
||||
}
|
||||
|
||||
func initTestErrorHandler(t *testing.T) {
|
||||
cmdutil.BehaviorOnFatal(func(str string, code int) {
|
||||
t.Errorf("Error running command (exit code %d): %s", code, str)
|
||||
@@ -62,9 +67,9 @@ func defaultClientConfig() *restclient.Config {
|
||||
return &restclient.Config{
|
||||
APIPath: "/api",
|
||||
ContentConfig: restclient.ContentConfig{
|
||||
NegotiatedSerializer: legacyscheme.Codecs,
|
||||
NegotiatedSerializer: scheme.Codecs,
|
||||
ContentType: runtime.ContentTypeJSON,
|
||||
GroupVersion: &legacyscheme.Registry.GroupOrDie(api.GroupName).GroupVersion,
|
||||
GroupVersion: &schema.GroupVersion{Version: "v1"},
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -73,7 +78,7 @@ func defaultClientConfigForVersion(version *schema.GroupVersion) *restclient.Con
|
||||
return &restclient.Config{
|
||||
APIPath: "/api",
|
||||
ContentConfig: restclient.ContentConfig{
|
||||
NegotiatedSerializer: legacyscheme.Codecs,
|
||||
NegotiatedSerializer: scheme.Codecs,
|
||||
ContentType: runtime.ContentTypeJSON,
|
||||
GroupVersion: version,
|
||||
},
|
||||
@@ -163,7 +168,6 @@ func Example_printReplicationControllerWithNamespace() {
|
||||
printersinternal.AddHandlers(p)
|
||||
tf.Printer = p
|
||||
tf.Client = &fake.RESTClient{
|
||||
GroupVersion: legacyscheme.Registry.GroupOrDie(api.GroupName).GroupVersion,
|
||||
NegotiatedSerializer: ns,
|
||||
Client: nil,
|
||||
}
|
||||
@@ -216,7 +220,6 @@ func Example_printMultiContainersReplicationControllerWithWide() {
|
||||
printersinternal.AddHandlers(p)
|
||||
tf.Printer = p
|
||||
tf.Client = &fake.RESTClient{
|
||||
GroupVersion: legacyscheme.Registry.GroupOrDie(api.GroupName).GroupVersion,
|
||||
NegotiatedSerializer: ns,
|
||||
Client: nil,
|
||||
}
|
||||
@@ -270,7 +273,6 @@ func Example_printReplicationController() {
|
||||
printersinternal.AddHandlers(p)
|
||||
tf.Printer = p
|
||||
tf.Client = &fake.RESTClient{
|
||||
GroupVersion: legacyscheme.Registry.GroupOrDie(api.GroupName).GroupVersion,
|
||||
NegotiatedSerializer: ns,
|
||||
Client: nil,
|
||||
}
|
||||
@@ -325,7 +327,6 @@ func Example_printPodWithWideFormat() {
|
||||
printersinternal.AddHandlers(p)
|
||||
tf.Printer = p
|
||||
tf.Client = &fake.RESTClient{
|
||||
GroupVersion: legacyscheme.Registry.GroupOrDie(api.GroupName).GroupVersion,
|
||||
NegotiatedSerializer: ns,
|
||||
Client: nil,
|
||||
}
|
||||
@@ -368,7 +369,6 @@ func Example_printPodWithShowLabels() {
|
||||
printersinternal.AddHandlers(p)
|
||||
tf.Printer = p
|
||||
tf.Client = &fake.RESTClient{
|
||||
GroupVersion: legacyscheme.Registry.GroupOrDie(api.GroupName).GroupVersion,
|
||||
NegotiatedSerializer: ns,
|
||||
Client: nil,
|
||||
}
|
||||
@@ -505,7 +505,6 @@ func Example_printPodHideTerminated() {
|
||||
printersinternal.AddHandlers(p)
|
||||
tf.Printer = p
|
||||
tf.Client = &fake.RESTClient{
|
||||
GroupVersion: legacyscheme.Registry.GroupOrDie(api.GroupName).GroupVersion,
|
||||
NegotiatedSerializer: ns,
|
||||
Client: nil,
|
||||
}
|
||||
@@ -541,7 +540,6 @@ func Example_printPodShowAll() {
|
||||
printersinternal.AddHandlers(p)
|
||||
tf.Printer = p
|
||||
tf.Client = &fake.RESTClient{
|
||||
GroupVersion: legacyscheme.Registry.GroupOrDie(api.GroupName).GroupVersion,
|
||||
NegotiatedSerializer: ns,
|
||||
Client: nil,
|
||||
}
|
||||
@@ -570,7 +568,6 @@ func Example_printServiceWithNamespacesAndLabels() {
|
||||
printersinternal.AddHandlers(p)
|
||||
tf.Printer = p
|
||||
tf.Client = &fake.RESTClient{
|
||||
GroupVersion: legacyscheme.Registry.GroupOrDie(api.GroupName).GroupVersion,
|
||||
NegotiatedSerializer: ns,
|
||||
Client: nil,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user