Support Groups as Subject Kind for Tenant Namespace RoleBindings created by Capsule (#71)

Modified CRD to support Owner struct.

Added Tenant name validation webhook.

Rewrote owner_reference hook logic.

Updated and added new e2e tests.

Co-authored-by: Maksim Fedotov <m_fedotov@wargaming.net>
This commit is contained in:
Maxim Fedotov
2020-09-10 18:02:22 +03:00
committed by GitHub
parent 10dcfeab82
commit 303fc4d69c
33 changed files with 752 additions and 84 deletions

View File

@@ -115,3 +115,14 @@ func ModifyCapsuleManagerPodArgs(args []string) {
// had to add sleep in order to manager be started
time.Sleep(defaultTimeoutInterval)
}
func GroupShouldBeUsedInTenantRoleBinding(ns *corev1.Namespace, t *v1alpha1.Tenant, timeout time.Duration) {
for _, roleBindingName := range tenantRoleBindingNames {
tenantRoleBindig := &rbacv1.RoleBinding{}
Eventually(func() string {
Expect(k8sClient.Get(context.TODO(), types.NamespacedName{Name: roleBindingName, Namespace: ns.GetName()}, tenantRoleBindig)).Should(Succeed())
return tenantRoleBindig.Subjects[0].Kind
}, timeout, defaultPollInterval).Should(BeIdenticalTo("Group"))
}
}