diff --git a/e2e/custom_capsule_group_test.go b/e2e/custom_capsule_group_test.go index dd8f96e2f..0a98b257e 100644 --- a/e2e/custom_capsule_group_test.go +++ b/e2e/custom_capsule_group_test.go @@ -32,10 +32,13 @@ import ( var _ = Describe("creating a Namespace as Tenant owner with custom --capsule-group", func() { tnt := &v1alpha1.Tenant{ ObjectMeta: metav1.ObjectMeta{ - Name: "tenant-assigned-custom-group", + Name: "tenantassignedcustomgroup", }, Spec: v1alpha1.TenantSpec{ - Owner: "alice", + Owner: v1alpha1.OwnerSpec{ + Name: "alice", + Kind: "User", + }, StorageClasses: []string{}, IngressClasses: []string{}, LimitRanges: []corev1.LimitRangeSpec{}, diff --git a/e2e/force_tenant_prefix_test.go b/e2e/force_tenant_prefix_test.go index 3659d6456..3d17e7b81 100644 --- a/e2e/force_tenant_prefix_test.go +++ b/e2e/force_tenant_prefix_test.go @@ -78,7 +78,7 @@ var _ = Describe("creating a Namespace with --force-tenant-name flag", func() { args := append(defaulManagerPodArgs, []string{"--force-tenant-prefix"}...) ModifyCapsuleManagerPodArgs(args) ns := NewNamespace("test") - NamespaceCreationShouldFail(ns, t1, podRecreationTimeoutInterval) + NamespaceCreationShouldNotSucceed(ns, t1, podRecreationTimeoutInterval) }) It("should be assigned to the second Tenant", func() { ns := NewNamespace("second-test") diff --git a/e2e/protected_namespace_regex_test.go b/e2e/protected_namespace_regex_test.go index dce578135..5cb3acf84 100644 --- a/e2e/protected_namespace_regex_test.go +++ b/e2e/protected_namespace_regex_test.go @@ -32,7 +32,10 @@ var _ = Describe("creating a Namespace with --protected-namespace-regex enabled" Name: "tenantprotectednamespace", }, Spec: v1alpha1.TenantSpec{ - Owner: "alice", + Owner: v1alpha1.OwnerSpec{ + Name: "alice", + Kind: "User", + }, StorageClasses: []string{}, IngressClasses: []string{}, LimitRanges: []corev1.LimitRangeSpec{}, diff --git a/e2e/tenant_resources_test.go b/e2e/tenant_resources_test.go index da49ea115..73f5ef6d5 100644 --- a/e2e/tenant_resources_test.go +++ b/e2e/tenant_resources_test.go @@ -28,7 +28,6 @@ import ( . "github.com/onsi/gomega" corev1 "k8s.io/api/core/v1" networkingv1 "k8s.io/api/networking/v1" - v1 "k8s.io/api/networking/v1" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" @@ -109,7 +108,7 @@ var _ = Describe("creating namespaces within a Tenant with resources", func() { PodSelector: &metav1.LabelSelector{}, }, { - IPBlock: &v1.IPBlock{ + IPBlock: &networkingv1.IPBlock{ CIDR: "192.168.0.0/12", }, }, @@ -120,7 +119,7 @@ var _ = Describe("creating namespaces within a Tenant with resources", func() { { To: []networkingv1.NetworkPolicyPeer{ { - IPBlock: &v1.IPBlock{ + IPBlock: &networkingv1.IPBlock{ CIDR: "0.0.0.0/0", Except: []string{ "192.168.0.0/12", @@ -131,9 +130,9 @@ var _ = Describe("creating namespaces within a Tenant with resources", func() { }, }, PodSelector: metav1.LabelSelector{}, - PolicyTypes: []v1.PolicyType{ - v1.PolicyTypeIngress, - v1.PolicyTypeEgress, + PolicyTypes: []networkingv1.PolicyType{ + networkingv1.PolicyTypeIngress, + networkingv1.PolicyTypeEgress, }, }, }, diff --git a/pkg/webhook/tenant_name/validating.go b/pkg/webhook/tenant_name/validating.go index 7c3959c16..4cdd200fc 100644 --- a/pkg/webhook/tenant_name/validating.go +++ b/pkg/webhook/tenant_name/validating.go @@ -56,8 +56,8 @@ func (r *handler) OnCreate(ctx context.Context, req admission.Request, clt clien matched, _ := regexp.MatchString(`^[a-z0-9]([a-z0-9]*[a-z0-9])?$`, tnt.GetName()) if !matched { - fmt.Printf("%s not mached", tnt.GetName()) - return admission.Denied("Tenant name had forbidden characters") + fmt.Printf("%s not matched", tnt.GetName()) + return admission.Denied("Tenant name has forbidden characters") } return admission.Allowed("") }