Merge pull request #12405 from uluyol/kubectlexp

Add experimental api support to kubectl
This commit is contained in:
CJ Cullen
2015-08-12 14:24:56 -07:00
17 changed files with 210 additions and 70 deletions

View File

@@ -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.