refactor builder in kubectl factory

This commit is contained in:
ymqytw
2017-11-07 17:42:03 -08:00
parent 42d5dc709e
commit 06c5be9802
25 changed files with 125 additions and 159 deletions

View File

@@ -26,7 +26,6 @@ import (
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
@@ -170,17 +169,6 @@ func (b *Builder) Local(mapperFunc ClientMapperFunc) *Builder {
return b
}
// Unstructured updates the builder's ClientMapper, RESTMapper,
// ObjectTyper, and codec for working with unstructured api objects
func (b *Builder) Unstructured(mapperFunc ClientMapperFunc, mapper meta.RESTMapper, typer runtime.ObjectTyper) *Builder {
b.mapper.RESTMapper = mapper
b.mapper.ObjectTyper = typer
b.mapper.Decoder = unstructured.UnstructuredJSONScheme
b.mapper.ClientMapper = ClientMapperFunc(mapperFunc)
return b
}
// URL accepts a number of URLs directly.
func (b *Builder) URL(httpAttemptCount int, urls ...*url.URL) *Builder {
for _, u := range urls {