diff --git a/pkg/client/simple/vfsclientset/cluster.go b/pkg/client/simple/vfsclientset/cluster.go index 9bfd8efa5f..0a54000ead 100644 --- a/pkg/client/simple/vfsclientset/cluster.go +++ b/pkg/client/simple/vfsclientset/cluster.go @@ -52,8 +52,14 @@ func (c *ClusterVFS) Get(name string, options metav1.GetOptions) (*api.Cluster, if options.ResourceVersion != "" { return nil, fmt.Errorf("ResourceVersion not supported in ClusterVFS::Get") } - // TODO: Return not found - return c.find(name) + o, err := c.find(name) + if err != nil { + return nil, err + } + if o == nil { + return nil, errors.NewNotFound(schema.GroupResource{Group: api.GroupName, Resource: "Cluster"}, name) + } + return o, nil } // Deprecated, but we need this for now.. diff --git a/pkg/client/simple/vfsclientset/commonvfs.go b/pkg/client/simple/vfsclientset/commonvfs.go index 5f25bd7847..2721e4b29e 100644 --- a/pkg/client/simple/vfsclientset/commonvfs.go +++ b/pkg/client/simple/vfsclientset/commonvfs.go @@ -63,7 +63,7 @@ func (c *commonVFS) init(kind string, basePath vfs.Path, storeVersion runtime.Gr c.basePath = basePath } -func (c *commonVFS) get(name string) (runtime.Object, error) { +func (c *commonVFS) find(name string) (runtime.Object, error) { o, err := c.readConfig(c.basePath.Join(name)) if err != nil { if os.IsNotExist(err) { @@ -240,7 +240,7 @@ func (c *commonVFS) readAll(items interface{}) (interface{}, error) { } for _, name := range names { - o, err := c.get(name) + o, err := c.find(name) if err != nil { return nil, err } diff --git a/pkg/client/simple/vfsclientset/federation.go b/pkg/client/simple/vfsclientset/federation.go index afec1babfb..01cf9d7949 100644 --- a/pkg/client/simple/vfsclientset/federation.go +++ b/pkg/client/simple/vfsclientset/federation.go @@ -19,8 +19,10 @@ package vfsclientset import ( "fmt" + "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/watch" api "k8s.io/kops/pkg/apis/kops" @@ -52,12 +54,12 @@ func (c *FederationVFS) Get(name string, options metav1.GetOptions) (*api.Federa if options.ResourceVersion != "" { return nil, fmt.Errorf("ResourceVersion not supported in FederationVFS::Get") } - o, err := c.get(name) + o, err := c.find(name) if err != nil { return nil, err } if o == nil { - return nil, nil + return nil, errors.NewNotFound(schema.GroupResource{Group: api.GroupName, Resource: "Federation"}, name) } return o.(*api.Federation), nil } diff --git a/pkg/client/simple/vfsclientset/instancegroup.go b/pkg/client/simple/vfsclientset/instancegroup.go index 0f922e8271..9fd9a6d0bc 100644 --- a/pkg/client/simple/vfsclientset/instancegroup.go +++ b/pkg/client/simple/vfsclientset/instancegroup.go @@ -20,8 +20,10 @@ import ( "fmt" "github.com/golang/glog" + "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/watch" "k8s.io/kops/pkg/apis/kops" @@ -94,14 +96,13 @@ func (c *InstanceGroupVFS) Get(name string, options metav1.GetOptions) (*api.Ins return nil, fmt.Errorf("ResourceVersion not supported in InstanceGroupVFS::Get") } - o, err := c.get(name) + o, err := c.find(name) if err != nil { return nil, err } if o == nil { - return nil, nil + return nil, errors.NewNotFound(schema.GroupResource{Group: api.GroupName, Resource: "InstanceGroup"}, name) } - ig := o.(*api.InstanceGroup) c.addLabels(ig)