Merge pull request #54506 from juanvallejo/jvallejo/remove-check-resource-builder

Automatic merge from submit-queue (batch tested with PRs 54399, 54557, 54506). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

remove mutual exclusivity check - local, unstructured builder attrs

**Release note**:
```release-note
NONE
```
Remove incorrect mutual exclusivity check between the resource builder `Local` and `Unstructured` attributes.

Related comment: https://github.com/kubernetes/kubernetes/pull/48763#discussion_r146437490
Followup to https://github.com/kubernetes/kubernetes/pull/48763

cc @smarterclayton
This commit is contained in:
Kubernetes Submit Queue 2017-10-25 09:50:09 -07:00 committed by GitHub
commit 671efe1255

View File

@ -68,9 +68,6 @@ type Builder struct {
defaultNamespace bool
requireNamespace bool
isLocal bool
isUnstructured bool
flatten bool
latest bool
@ -86,8 +83,6 @@ type Builder struct {
schema validation.Schema
}
var LocalUnstructuredBuilderError = fmt.Errorf("Unstructured objects cannot be handled with a local builder - Local and Unstructured attributes cannot be used in conjunction")
var missingResourceError = fmt.Errorf(`You must provide one or more resources by argument or filename.
Example resource specifications include:
'-f rsrc.yaml'
@ -169,12 +164,6 @@ func (b *Builder) FilenameParam(enforceNamespace bool, filenameOptions *Filename
// Local wraps the builder's clientMapper in a DisabledClientMapperForMapping
func (b *Builder) Local(mapperFunc ClientMapperFunc) *Builder {
if b.isUnstructured {
b.errs = append(b.errs, LocalUnstructuredBuilderError)
return b
}
b.isLocal = true
b.mapper.ClientMapper = DisabledClientForMapping{ClientMapper: ClientMapperFunc(mapperFunc)}
return b
}
@ -182,12 +171,6 @@ func (b *Builder) Local(mapperFunc ClientMapperFunc) *Builder {
// 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 {
if b.isLocal {
b.errs = append(b.errs, LocalUnstructuredBuilderError)
return b
}
b.isUnstructured = true
b.mapper.RESTMapper = mapper
b.mapper.ObjectTyper = typer
b.mapper.Decoder = unstructured.UnstructuredJSONScheme