Skip to content

Commit 2cbe49e

Browse files
authored
Merge pull request kubernetes#81768 from wojtek-t/cleanup_serializers
Remove dead code
2 parents da470c6 + b167571 commit 2cbe49e

File tree

4 files changed

+3
-101
lines changed

4 files changed

+3
-101
lines changed

staging/src/k8s.io/apiextensions-apiserver/pkg/registry/customresource/etcd_test.go

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ limitations under the License.
1717
package customresource_test
1818

1919
import (
20-
"io"
2120
"reflect"
2221
"strings"
2322
"testing"
@@ -48,7 +47,7 @@ import (
4847

4948
func newStorage(t *testing.T) (customresource.CustomResourceStorage, *etcd3testing.EtcdTestServer) {
5049
server, etcdStorage := etcd3testing.NewUnsecuredEtcd3TestClientServer(t)
51-
etcdStorage.Codec = unstructuredJsonCodec{}
50+
etcdStorage.Codec = unstructured.UnstructuredJSONScheme
5251
restOptions := generic.RESTOptions{StorageConfig: etcdStorage, Decorator: generic.UndecoratedStorage, DeleteCollectionWorkers: 1, ResourcePrefix: "noxus"}
5352

5453
parameterScheme := runtime.NewScheme()
@@ -527,28 +526,6 @@ func TestScaleUpdateWithoutSpecReplicas(t *testing.T) {
527526
}
528527
}
529528

530-
type unstructuredJsonCodec struct{}
531-
532-
func (c unstructuredJsonCodec) Decode(data []byte, defaults *schema.GroupVersionKind, into runtime.Object) (runtime.Object, *schema.GroupVersionKind, error) {
533-
obj := into.(*unstructured.Unstructured)
534-
err := obj.UnmarshalJSON(data)
535-
if err != nil {
536-
return nil, nil, err
537-
}
538-
gvk := obj.GroupVersionKind()
539-
return obj, &gvk, nil
540-
}
541-
542-
func (c unstructuredJsonCodec) Encode(obj runtime.Object, w io.Writer) error {
543-
u := obj.(*unstructured.Unstructured)
544-
bs, err := u.MarshalJSON()
545-
if err != nil {
546-
return err
547-
}
548-
w.Write(bs)
549-
return nil
550-
}
551-
552529
func setSpecReplicas(u *unstructured.Unstructured, replicas int64) {
553530
setNestedField(u, replicas, "spec", "replicas")
554531
}

staging/src/k8s.io/client-go/deprecated-dynamic/BUILD

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
33
go_library(
44
name = "go_default_library",
55
srcs = [
6-
"bad_debt.go",
76
"client.go",
87
"client_pool.go",
98
],
@@ -16,11 +15,9 @@ go_library(
1615
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured:go_default_library",
1716
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
1817
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
19-
"//staging/src/k8s.io/apimachinery/pkg/runtime/serializer:go_default_library",
2018
"//staging/src/k8s.io/apimachinery/pkg/types:go_default_library",
2119
"//staging/src/k8s.io/apimachinery/pkg/watch:go_default_library",
2220
"//staging/src/k8s.io/client-go/dynamic:go_default_library",
23-
"//staging/src/k8s.io/client-go/kubernetes/scheme:go_default_library",
2421
"//staging/src/k8s.io/client-go/rest:go_default_library",
2522
],
2623
)

staging/src/k8s.io/client-go/deprecated-dynamic/bad_debt.go

Lines changed: 0 additions & 73 deletions
This file was deleted.

staging/src/k8s.io/client-go/deprecated-dynamic/client_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,8 @@ func TestWatch(t *testing.T) {
511511
t.Errorf("Watch(%q) got query %s. wanted %s", tc.name, r.URL.RawQuery, tc.query)
512512
}
513513

514-
enc := restclientwatch.NewEncoder(streaming.NewEncoder(w, dynamicCodec{}), dynamicCodec{})
514+
codec := unstructured.UnstructuredJSONScheme
515+
enc := restclientwatch.NewEncoder(streaming.NewEncoder(w, codec), codec)
515516
for _, e := range tc.events {
516517
enc.Encode(&e)
517518
}

0 commit comments

Comments
 (0)