Merge pull request #12405 from uluyol/kubectlexp
Add experimental api support to kubectl
This commit is contained in:
@@ -82,6 +82,10 @@ func describerMap(c *client.Client) map[string]Describer {
|
||||
return m
|
||||
}
|
||||
|
||||
func expDescriberMap(c *client.ExperimentalClient) map[string]Describer {
|
||||
return map[string]Describer{}
|
||||
}
|
||||
|
||||
// List of all resource types we can describe
|
||||
func DescribableResources() []string {
|
||||
keys := make([]string, 0)
|
||||
@@ -95,12 +99,15 @@ func DescribableResources() []string {
|
||||
|
||||
// Describer returns the default describe functions for each of the standard
|
||||
// Kubernetes types.
|
||||
func DescriberFor(kind string, c *client.Client) (Describer, bool) {
|
||||
f, ok := describerMap(c)[kind]
|
||||
if ok {
|
||||
return f, true
|
||||
func DescriberFor(kind string, c *client.Client, ec *client.ExperimentalClient) (Describer, bool) {
|
||||
var f Describer
|
||||
var ok bool
|
||||
if c != nil {
|
||||
f, ok = describerMap(c)[kind]
|
||||
} else if ec != nil {
|
||||
f, ok = expDescriberMap(ec)[kind]
|
||||
}
|
||||
return nil, false
|
||||
return f, ok
|
||||
}
|
||||
|
||||
// DefaultObjectDescriber can describe the default Kubernetes objects.
|
||||
|
Reference in New Issue
Block a user