mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-06 16:06:51 +00:00
Remove Codec from ContentConfig.
This commit is contained in:
@@ -190,13 +190,16 @@ type testFactory struct {
|
||||
Err error
|
||||
}
|
||||
|
||||
func NewTestFactory() (*cmdutil.Factory, *testFactory, runtime.Codec) {
|
||||
func NewTestFactory() (*cmdutil.Factory, *testFactory, runtime.Codec, runtime.NegotiatedSerializer) {
|
||||
scheme, mapper, codec := newExternalScheme()
|
||||
t := &testFactory{
|
||||
Validator: validation.NullSchema{},
|
||||
Mapper: mapper,
|
||||
Typer: scheme,
|
||||
}
|
||||
negotiatedSerializer := serializer.NegotiatedSerializerWrapper(
|
||||
runtime.SerializerInfo{Serializer: codec},
|
||||
runtime.StreamSerializerInfo{})
|
||||
return &cmdutil.Factory{
|
||||
Object: func(discovery bool) (meta.RESTMapper, runtime.ObjectTyper) {
|
||||
priorityRESTMapper := meta.PriorityRESTMapper{
|
||||
@@ -234,11 +237,11 @@ func NewTestFactory() (*cmdutil.Factory, *testFactory, runtime.Codec) {
|
||||
ClientConfig: func() (*restclient.Config, error) {
|
||||
return t.ClientConfig, t.Err
|
||||
},
|
||||
}, t, codec
|
||||
}, t, codec, negotiatedSerializer
|
||||
}
|
||||
|
||||
func NewMixedFactory(apiClient resource.RESTClient) (*cmdutil.Factory, *testFactory, runtime.Codec) {
|
||||
f, t, c := NewTestFactory()
|
||||
f, t, c, _ := NewTestFactory()
|
||||
var multiRESTMapper meta.MultiRESTMapper
|
||||
multiRESTMapper = append(multiRESTMapper, t.Mapper)
|
||||
multiRESTMapper = append(multiRESTMapper, testapi.Default.RESTMapper())
|
||||
@@ -263,7 +266,7 @@ func NewMixedFactory(apiClient resource.RESTClient) (*cmdutil.Factory, *testFact
|
||||
return f, t, c
|
||||
}
|
||||
|
||||
func NewAPIFactory() (*cmdutil.Factory, *testFactory, runtime.Codec) {
|
||||
func NewAPIFactory() (*cmdutil.Factory, *testFactory, runtime.Codec, runtime.NegotiatedSerializer) {
|
||||
t := &testFactory{
|
||||
Validator: validation.NullSchema{},
|
||||
}
|
||||
@@ -335,7 +338,7 @@ func NewAPIFactory() (*cmdutil.Factory, *testFactory, runtime.Codec) {
|
||||
f.LabelsForObject = rf.LabelsForObject
|
||||
f.CanBeExposed = rf.CanBeExposed
|
||||
f.PrintObjectSpecificMessage = rf.PrintObjectSpecificMessage
|
||||
return f, t, testapi.Default.Codec()
|
||||
return f, t, testapi.Default.Codec(), testapi.Default.NegotiatedSerializer()
|
||||
}
|
||||
|
||||
func objBody(codec runtime.Codec, obj runtime.Object) io.ReadCloser {
|
||||
@@ -367,11 +370,11 @@ func stringBody(body string) io.ReadCloser {
|
||||
//}
|
||||
|
||||
func Example_printReplicationControllerWithNamespace() {
|
||||
f, tf, codec := NewAPIFactory()
|
||||
f, tf, _, ns := NewAPIFactory()
|
||||
tf.Printer = kubectl.NewHumanReadablePrinter(false, true, false, false, false, false, []string{})
|
||||
tf.Client = &fake.RESTClient{
|
||||
Codec: codec,
|
||||
Client: nil,
|
||||
NegotiatedSerializer: ns,
|
||||
Client: nil,
|
||||
}
|
||||
cmd := NewCmdRun(f, os.Stdin, os.Stdout, os.Stderr)
|
||||
ctrl := &api.ReplicationController{
|
||||
@@ -413,11 +416,11 @@ func Example_printReplicationControllerWithNamespace() {
|
||||
}
|
||||
|
||||
func Example_printMultiContainersReplicationControllerWithWide() {
|
||||
f, tf, codec := NewAPIFactory()
|
||||
f, tf, _, ns := NewAPIFactory()
|
||||
tf.Printer = kubectl.NewHumanReadablePrinter(false, false, true, false, false, false, []string{})
|
||||
tf.Client = &fake.RESTClient{
|
||||
Codec: codec,
|
||||
Client: nil,
|
||||
NegotiatedSerializer: ns,
|
||||
Client: nil,
|
||||
}
|
||||
cmd := NewCmdRun(f, os.Stdin, os.Stdout, os.Stderr)
|
||||
ctrl := &api.ReplicationController{
|
||||
@@ -462,11 +465,11 @@ func Example_printMultiContainersReplicationControllerWithWide() {
|
||||
}
|
||||
|
||||
func Example_printReplicationController() {
|
||||
f, tf, codec := NewAPIFactory()
|
||||
f, tf, _, ns := NewAPIFactory()
|
||||
tf.Printer = kubectl.NewHumanReadablePrinter(false, false, false, false, false, false, []string{})
|
||||
tf.Client = &fake.RESTClient{
|
||||
Codec: codec,
|
||||
Client: nil,
|
||||
NegotiatedSerializer: ns,
|
||||
Client: nil,
|
||||
}
|
||||
cmd := NewCmdRun(f, os.Stdin, os.Stdout, os.Stderr)
|
||||
ctrl := &api.ReplicationController{
|
||||
@@ -511,11 +514,11 @@ func Example_printReplicationController() {
|
||||
}
|
||||
|
||||
func Example_printPodWithWideFormat() {
|
||||
f, tf, codec := NewAPIFactory()
|
||||
f, tf, _, ns := NewAPIFactory()
|
||||
tf.Printer = kubectl.NewHumanReadablePrinter(false, false, true, false, false, false, []string{})
|
||||
tf.Client = &fake.RESTClient{
|
||||
Codec: codec,
|
||||
Client: nil,
|
||||
NegotiatedSerializer: ns,
|
||||
Client: nil,
|
||||
}
|
||||
nodeName := "kubernetes-minion-abcd"
|
||||
cmd := NewCmdRun(f, os.Stdin, os.Stdout, os.Stderr)
|
||||
@@ -548,11 +551,11 @@ func Example_printPodWithWideFormat() {
|
||||
}
|
||||
|
||||
func Example_printPodWithShowLabels() {
|
||||
f, tf, codec := NewAPIFactory()
|
||||
f, tf, _, ns := NewAPIFactory()
|
||||
tf.Printer = kubectl.NewHumanReadablePrinter(false, false, false, false, true, false, []string{})
|
||||
tf.Client = &fake.RESTClient{
|
||||
Codec: codec,
|
||||
Client: nil,
|
||||
NegotiatedSerializer: ns,
|
||||
Client: nil,
|
||||
}
|
||||
nodeName := "kubernetes-minion-abcd"
|
||||
cmd := NewCmdRun(f, os.Stdin, os.Stdout, os.Stderr)
|
||||
@@ -680,11 +683,11 @@ func newAllPhasePodList() *api.PodList {
|
||||
}
|
||||
|
||||
func Example_printPodHideTerminated() {
|
||||
f, tf, codec := NewAPIFactory()
|
||||
f, tf, _, ns := NewAPIFactory()
|
||||
tf.Printer = kubectl.NewHumanReadablePrinter(false, false, false, false, false, false, []string{})
|
||||
tf.Client = &fake.RESTClient{
|
||||
Codec: codec,
|
||||
Client: nil,
|
||||
NegotiatedSerializer: ns,
|
||||
Client: nil,
|
||||
}
|
||||
cmd := NewCmdRun(f, os.Stdin, os.Stdout, os.Stderr)
|
||||
podList := newAllPhasePodList()
|
||||
@@ -701,11 +704,11 @@ func Example_printPodHideTerminated() {
|
||||
}
|
||||
|
||||
func Example_printPodShowAll() {
|
||||
f, tf, codec := NewAPIFactory()
|
||||
f, tf, _, ns := NewAPIFactory()
|
||||
tf.Printer = kubectl.NewHumanReadablePrinter(false, false, false, true, false, false, []string{})
|
||||
tf.Client = &fake.RESTClient{
|
||||
Codec: codec,
|
||||
Client: nil,
|
||||
NegotiatedSerializer: ns,
|
||||
Client: nil,
|
||||
}
|
||||
cmd := NewCmdRun(f, os.Stdin, os.Stdout, os.Stderr)
|
||||
podList := newAllPhasePodList()
|
||||
@@ -724,11 +727,11 @@ func Example_printPodShowAll() {
|
||||
}
|
||||
|
||||
func Example_printServiceWithNamespacesAndLabels() {
|
||||
f, tf, codec := NewAPIFactory()
|
||||
f, tf, _, ns := NewAPIFactory()
|
||||
tf.Printer = kubectl.NewHumanReadablePrinter(false, true, false, false, false, false, []string{"l1"})
|
||||
tf.Client = &fake.RESTClient{
|
||||
Codec: codec,
|
||||
Client: nil,
|
||||
NegotiatedSerializer: ns,
|
||||
Client: nil,
|
||||
}
|
||||
cmd := NewCmdRun(f, os.Stdin, os.Stdout, os.Stderr)
|
||||
svc := &api.ServiceList{
|
||||
|
||||
Reference in New Issue
Block a user