mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 05:27:21 +00:00
Remove kubectl create namespace dependencies on kubernetes/pkg/api
This commit is contained in:
parent
7f991a3b53
commit
d2bd6a7ff1
@ -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