Merge pull request #54559 from zjj2wry/create-ns-dep

Automatic merge from submit-queue (batch tested with PRs 52003, 54559, 54518). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Remove kubectl create namespace dependencies on kubernetes/pkg/api

**What this PR does / why we need it**:
ref https://github.com/kubernetes/kubectl/issues/83

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
This commit is contained in:
Kubernetes Submit Queue 2017-10-25 11:38:39 -07:00 committed by GitHub
commit 5719eb0e31
2 changed files with 7 additions and 7 deletions

View File

@ -19,8 +19,8 @@ package kubectl
import (
"fmt"
"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/kubernetes/pkg/api"
)
// NamespaceGeneratorV1 supports stable generation of a namespace
@ -65,7 +65,7 @@ func (g *NamespaceGeneratorV1) StructuredGenerate() (runtime.Object, error) {
if err := g.validate(); err != nil {
return nil, err
}
namespace := &api.Namespace{}
namespace := &v1.Namespace{}
namespace.Name = g.Name
return namespace, nil
}

View File

@ -20,14 +20,14 @@ import (
"reflect"
"testing"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/kubernetes/pkg/api"
)
func TestNamespaceGenerate(t *testing.T) {
tests := []struct {
params map[string]interface{}
expected *api.Namespace
expected *v1.Namespace
expectErr bool
index int
}{
@ -35,7 +35,7 @@ func TestNamespaceGenerate(t *testing.T) {
params: map[string]interface{}{
"name": "foo",
},
expected: &api.Namespace{
expected: &v1.Namespace{
ObjectMeta: metav1.ObjectMeta{
Name: "foo",
},
@ -92,8 +92,8 @@ func TestNamespaceGenerate(t *testing.T) {
case !test.expectErr && err == nil:
// do nothing and drop through
}
if !reflect.DeepEqual(obj.(*api.Namespace), test.expected) {
t.Errorf("\nexpected:\n%#v\nsaw:\n%#v", test.expected, obj.(*api.Namespace))
if !reflect.DeepEqual(obj.(*v1.Namespace), test.expected) {
t.Errorf("\nexpected:\n%#v\nsaw:\n%#v", test.expected, obj.(*v1.Namespace))
}
}
}