Add experimental API support to kubectl

This commit is contained in:
Muhammed Uluyol
2015-08-10 13:08:34 -07:00
parent 01807c1fac
commit fab367230f
16 changed files with 194 additions and 63 deletions

View File

@@ -81,6 +81,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)
@@ -94,12 +98,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.