Address comments.

pull/6/head
Brendan Burns 2015-08-21 14:24:16 -07:00
parent b196d0f84b
commit 855c7cedcc
9 changed files with 12 additions and 14 deletions

View File

@ -287,6 +287,7 @@ _kubectl_get()
must_have_one_noun+=("secret") must_have_one_noun+=("secret")
must_have_one_noun+=("service") must_have_one_noun+=("service")
must_have_one_noun+=("serviceaccount") must_have_one_noun+=("serviceaccount")
must_have_one_noun+=("thirdpartyresource")
} }
_kubectl_describe() _kubectl_describe()
@ -460,6 +461,7 @@ _kubectl_delete()
must_have_one_noun+=("secret") must_have_one_noun+=("secret")
must_have_one_noun+=("service") must_have_one_noun+=("service")
must_have_one_noun+=("serviceaccount") must_have_one_noun+=("serviceaccount")
must_have_one_noun+=("thirdpartyresource")
} }
_kubectl_namespace() _kubectl_namespace()

View File

@ -167,7 +167,6 @@ type ThirdPartyResourceData struct {
Data []byte `json:"name,omitempty" description:"the raw JSON data for this data"` Data []byte `json:"name,omitempty" description:"the raw JSON data for this data"`
} }
<<<<<<< HEAD
type Deployment struct { type Deployment struct {
api.TypeMeta `json:",inline"` api.TypeMeta `json:",inline"`
api.ObjectMeta `json:"metadata,omitempty"` api.ObjectMeta `json:"metadata,omitempty"`

View File

@ -153,7 +153,6 @@ type ThirdPartyResourceData struct {
Data []byte `json:"name,omitempty" description:"the raw JSON data for this data"` Data []byte `json:"name,omitempty" description:"the raw JSON data for this data"`
} }
<<<<<<< HEAD
type Deployment struct { type Deployment struct {
v1.TypeMeta `json:",inline"` v1.TypeMeta `json:",inline"`
v1.ObjectMeta `json:"metadata,omitempty"` v1.ObjectMeta `json:"metadata,omitempty"`

View File

@ -1088,7 +1088,7 @@ func printThirdPartyResource(rsrc *expapi.ThirdPartyResource, w io.Writer, withN
func printThirdPartyResourceList(list *expapi.ThirdPartyResourceList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { func printThirdPartyResourceList(list *expapi.ThirdPartyResourceList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
for _, item := range list.Items { for _, item := range list.Items {
if err := printThirdPartyResource(&item, w, withNamespace, wide, columnLabels); err != nil { if err := printThirdPartyResource(&item, w, withNamespace, wide, showAll, columnLabels); err != nil {
return err return err
} }
} }

View File

@ -776,7 +776,7 @@ func (m *Master) InstallThirdPartyAPI(rsrc *expapi.ThirdPartyResource) error {
if err != nil { if err != nil {
return err return err
} }
thirdparty := m.thirdpartyapi(group, strings.ToLower(kind)+"s", rsrc.Versions[0].Name) thirdparty := m.thirdpartyapi(group, kind, rsrc.Versions[0].Name)
if err := thirdparty.InstallREST(m.handlerContainer); err != nil { if err := thirdparty.InstallREST(m.handlerContainer); err != nil {
glog.Fatalf("Unable to setup thirdparty api: %v", err) glog.Fatalf("Unable to setup thirdparty api: %v", err)
} }
@ -793,7 +793,7 @@ func (m *Master) thirdpartyapi(group, kind, version string) *apiserver.APIGroupV
apiRoot := "/thirdparty/" + group + "/" apiRoot := "/thirdparty/" + group + "/"
storage := map[string]rest.Storage{ storage := map[string]rest.Storage{
kind: resourceStorage, strings.ToLower(kind) + "s": resourceStorage,
} }
return &apiserver.APIGroupVersion{ return &apiserver.APIGroupVersion{

View File

@ -198,7 +198,7 @@ func TestInstallThirdPartyAPIGet(t *testing.T) {
Name: "test", Name: "test",
}, },
TypeMeta: api.TypeMeta{ TypeMeta: api.TypeMeta{
Kind: "foo", Kind: "Foo",
}, },
SomeField: "test field", SomeField: "test field",
OtherField: 10, OtherField: 10,
@ -237,12 +237,12 @@ func TestInstallThirdPartyAPIPost(t *testing.T) {
Name: "test", Name: "test",
}, },
TypeMeta: api.TypeMeta{ TypeMeta: api.TypeMeta{
Kind: "foo", Kind: "Foo",
}, },
SomeField: "test field", SomeField: "test field",
OtherField: 10, OtherField: 10,
} }
data, err := encodeToThirdParty("test", inputObj) data, err := json.Marshal(inputObj)
if err != nil { if err != nil {
t.Errorf("unexpected error: %v") t.Errorf("unexpected error: %v")
return return
@ -298,7 +298,7 @@ func TestInstallThirdPartyAPIDelete(t *testing.T) {
Name: "test", Name: "test",
}, },
TypeMeta: api.TypeMeta{ TypeMeta: api.TypeMeta{
Kind: "foo", Kind: "Foo",
}, },
SomeField: "test field", SomeField: "test field",
OtherField: 10, OtherField: 10,

View File

@ -101,7 +101,6 @@ func TestUpdate(t *testing.T) {
) )
} }
<<<<<<< HEAD
func TestDelete(t *testing.T) { func TestDelete(t *testing.T) {
ctx := api.NewDefaultContext() ctx := api.NewDefaultContext()
storage, fakeClient := newStorage(t) storage, fakeClient := newStorage(t)

View File

@ -85,9 +85,6 @@ func (t *thirdPartyResourceDataCodec) populate(objIn *expapi.ThirdPartyResourceD
if !ok { if !ok {
return fmt.Errorf("unexpected object: %#v", obj) return fmt.Errorf("unexpected object: %#v", obj)
} }
if kind == "ThirdPartyResourceData" {
return t.delegate.DecodeInto(data, objIn)
}
if kind != t.kind { if kind != t.kind {
return fmt.Errorf("unexpected kind: %s, expected: %s", kind, t.kind) return fmt.Errorf("unexpected kind: %s, expected: %s", kind, t.kind)
} }

View File

@ -17,6 +17,8 @@ limitations under the License.
package etcd package etcd
import ( import (
"strings"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/expapi" "k8s.io/kubernetes/pkg/expapi"
"k8s.io/kubernetes/pkg/fields" "k8s.io/kubernetes/pkg/fields"
@ -35,7 +37,7 @@ type REST struct {
// NewREST returns a registry which will store ThirdPartyResourceData in the given helper // NewREST returns a registry which will store ThirdPartyResourceData in the given helper
func NewREST(s storage.Interface, group, kind string) *REST { func NewREST(s storage.Interface, group, kind string) *REST {
prefix := "/ThirdPartyResourceData/" + group + "/" + kind prefix := "/ThirdPartyResourceData/" + group + "/" + strings.ToLower(kind) + "s"
store := &etcdgeneric.Etcd{ store := &etcdgeneric.Etcd{
NewFunc: func() runtime.Object { return &expapi.ThirdPartyResourceData{} }, NewFunc: func() runtime.Object { return &expapi.ThirdPartyResourceData{} },