Allow Create/Update/Delete kubectl commands to handle arbitrary objects

* Ensure kubectl uses abstractions from other parts of Kube
* Begin adding abstractions that allow arbitrary objects
* Refactor "update" to more closely match allowed behavior
This commit is contained in:
Clayton Coleman
2014-10-26 22:21:31 -04:00
parent f0c23d68f7
commit 39882a3555
10 changed files with 288 additions and 185 deletions

View File

@@ -27,12 +27,11 @@ import (
"strings"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/latest"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/GoogleCloudPlatform/kubernetes/pkg/version"
"gopkg.in/v1/yaml"
)
@@ -160,21 +159,6 @@ func makeImageList(manifest api.ContainerManifest) string {
return strings.Join(images, ",")
}
// Takes input 'data' as either json or yaml and attemps to decode it into the
// supplied object.
func dataToObject(data []byte) (runtime.Object, error) {
// This seems hacky but we can't get the codec from kubeClient.
versionInterfaces, err := latest.InterfacesFor(apiVersionToUse)
if err != nil {
return nil, err
}
obj, err := versionInterfaces.Codec.Decode(data)
if err != nil {
return nil, err
}
return obj, nil
}
const (
resolveToPath = "path"
resolveToKind = "kind"