mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 12:43:23 +00:00
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:
commit
5719eb0e31
@ -19,8 +19,8 @@ package kubectl
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/kubernetes/pkg/api"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// NamespaceGeneratorV1 supports stable generation of a namespace
|
// NamespaceGeneratorV1 supports stable generation of a namespace
|
||||||
@ -65,7 +65,7 @@ func (g *NamespaceGeneratorV1) StructuredGenerate() (runtime.Object, error) {
|
|||||||
if err := g.validate(); err != nil {
|
if err := g.validate(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
namespace := &api.Namespace{}
|
namespace := &v1.Namespace{}
|
||||||
namespace.Name = g.Name
|
namespace.Name = g.Name
|
||||||
return namespace, nil
|
return namespace, nil
|
||||||
}
|
}
|
||||||
|
@ -20,14 +20,14 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/kubernetes/pkg/api"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestNamespaceGenerate(t *testing.T) {
|
func TestNamespaceGenerate(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
params map[string]interface{}
|
params map[string]interface{}
|
||||||
expected *api.Namespace
|
expected *v1.Namespace
|
||||||
expectErr bool
|
expectErr bool
|
||||||
index int
|
index int
|
||||||
}{
|
}{
|
||||||
@ -35,7 +35,7 @@ func TestNamespaceGenerate(t *testing.T) {
|
|||||||
params: map[string]interface{}{
|
params: map[string]interface{}{
|
||||||
"name": "foo",
|
"name": "foo",
|
||||||
},
|
},
|
||||||
expected: &api.Namespace{
|
expected: &v1.Namespace{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
},
|
},
|
||||||
@ -92,8 +92,8 @@ func TestNamespaceGenerate(t *testing.T) {
|
|||||||
case !test.expectErr && err == nil:
|
case !test.expectErr && err == nil:
|
||||||
// do nothing and drop through
|
// do nothing and drop through
|
||||||
}
|
}
|
||||||
if !reflect.DeepEqual(obj.(*api.Namespace), test.expected) {
|
if !reflect.DeepEqual(obj.(*v1.Namespace), test.expected) {
|
||||||
t.Errorf("\nexpected:\n%#v\nsaw:\n%#v", test.expected, obj.(*api.Namespace))
|
t.Errorf("\nexpected:\n%#v\nsaw:\n%#v", test.expected, obj.(*v1.Namespace))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user