mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-26 21:17:23 +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 (
|
||||
"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
|
||||
}
|
||||
|
@ -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))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user