mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 20:53:33 +00:00
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:
commit
671efe1255
@ -68,9 +68,6 @@ type Builder struct {
|
|||||||
defaultNamespace bool
|
defaultNamespace bool
|
||||||
requireNamespace bool
|
requireNamespace bool
|
||||||
|
|
||||||
isLocal bool
|
|
||||||
isUnstructured bool
|
|
||||||
|
|
||||||
flatten bool
|
flatten bool
|
||||||
latest bool
|
latest bool
|
||||||
|
|
||||||
@ -86,8 +83,6 @@ type Builder struct {
|
|||||||
schema validation.Schema
|
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.
|
var missingResourceError = fmt.Errorf(`You must provide one or more resources by argument or filename.
|
||||||
Example resource specifications include:
|
Example resource specifications include:
|
||||||
'-f rsrc.yaml'
|
'-f rsrc.yaml'
|
||||||
@ -169,12 +164,6 @@ func (b *Builder) FilenameParam(enforceNamespace bool, filenameOptions *Filename
|
|||||||
|
|
||||||
// Local wraps the builder's clientMapper in a DisabledClientMapperForMapping
|
// Local wraps the builder's clientMapper in a DisabledClientMapperForMapping
|
||||||
func (b *Builder) Local(mapperFunc ClientMapperFunc) *Builder {
|
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)}
|
b.mapper.ClientMapper = DisabledClientForMapping{ClientMapper: ClientMapperFunc(mapperFunc)}
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
@ -182,12 +171,6 @@ func (b *Builder) Local(mapperFunc ClientMapperFunc) *Builder {
|
|||||||
// Unstructured updates the builder's ClientMapper, RESTMapper,
|
// Unstructured updates the builder's ClientMapper, RESTMapper,
|
||||||
// ObjectTyper, and codec for working with unstructured api objects
|
// ObjectTyper, and codec for working with unstructured api objects
|
||||||
func (b *Builder) Unstructured(mapperFunc ClientMapperFunc, mapper meta.RESTMapper, typer runtime.ObjectTyper) *Builder {
|
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.RESTMapper = mapper
|
||||||
b.mapper.ObjectTyper = typer
|
b.mapper.ObjectTyper = typer
|
||||||
b.mapper.Decoder = unstructured.UnstructuredJSONScheme
|
b.mapper.Decoder = unstructured.UnstructuredJSONScheme
|
||||||
|
Loading…
Reference in New Issue
Block a user