mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-08 20:50:24 +00:00
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:
@@ -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"
|
||||
|
Reference in New Issue
Block a user