Skip to content

Commit 0912aa4

Browse files
committed
Stop creating rolebinding
Signed-off-by: Anish Asthana <anishasthana1@gmail.com>
1 parent 7eef7a0 commit 0912aa4

File tree

4 files changed

+29
-34
lines changed

4 files changed

+29
-34
lines changed

controllers/mcad_controller_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
const (
1313
mcadCRCase1 = "./testdata/mcad_test_cases/case_1.yaml"
1414
mcadConfigMap1 = "./testdata/mcad_test_results/case_1/configmap.yaml"
15-
mcadRolebinding1 = "./testdata/mcad_test_results/case_1/rolebinding.yaml"
1615
mcadService1 = "./testdata/mcad_test_results/case_1/service.yaml"
1716
mcadServiceAccount1 = "./testdata/mcad_test_results/case_1/serviceaccount.yaml"
1817
)
@@ -34,7 +33,6 @@ var _ = Describe("The MCAD Controller", func() {
3433
It("It should create a configmap", func() {
3534
deployMCAD(ctx, mcadCRCase1, opts)
3635
compareConfigMaps(mcadConfigMap1, opts)
37-
compareRoleBindings(mcadRolebinding1, opts)
3836
compareServiceAccounts(mcadServiceAccount1, opts)
3937
compareServices(mcadService1, opts)
4038
})

controllers/multi_cluster_app_dispatcher.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ var multiClusterAppDispatcherTemplates = []string{
1010
"mcad/configmap.yaml.tmpl",
1111
"mcad/service.yaml.tmpl",
1212
"mcad/serviceaccount.yaml.tmpl",
13-
"mcad/rolebinding_custom-metrics-auth-reader.yaml.tmpl", //Confirm is this rolebinding is actually required by MCAD
1413
}
1514

1615
func (r *MCADReconciler) ReconcileMCAD(ctx context.Context, mcad *codeflarev1alpha1.MCAD, req ctrl.Request, params *MCADParams) error {

controllers/suite_test.go

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"github.com/project-codeflare/codeflare-operator/controllers/util"
2222
"go.uber.org/zap/zapcore"
2323
corev1 "k8s.io/api/core/v1"
24-
k8srbacv1 "k8s.io/api/rbac/v1"
2524
"k8s.io/apimachinery/pkg/types"
2625
"path/filepath"
2726
"testing"
@@ -173,19 +172,19 @@ func compareConfigMaps(path string, opts mf.Option) {
173172
Expect(util.ConfigMapsAreEqual(*expectedConfigMap, *actualConfigMap)).Should(BeTrue())
174173
}
175174

176-
func compareRoleBindings(path string, opts mf.Option) {
177-
expectedRB := &k8srbacv1.RoleBinding{}
178-
Expect(convertToStructuredResource(path, expectedRB, opts)).NotTo(HaveOccurred())
179-
expectedRB.Subjects[0].Namespace = workingNamespace
180-
181-
actualRB := &k8srbacv1.RoleBinding{}
182-
Eventually(func() error {
183-
namespacedNamed := types.NamespacedName{Name: expectedRB.Name, Namespace: workingNamespace}
184-
return k8sClient.Get(ctx, namespacedNamed, actualRB)
185-
}, timeout, interval).ShouldNot(HaveOccurred())
186-
187-
Expect(util.RoleBindingsAreEqual(*expectedRB, *actualRB)).Should(BeTrue())
188-
}
175+
//func compareRoleBindings(path string, opts mf.Option) {
176+
// expectedRB := &k8srbacv1.RoleBinding{}
177+
// Expect(convertToStructuredResource(path, expectedRB, opts)).NotTo(HaveOccurred())
178+
// expectedRB.Subjects[0].Namespace = workingNamespace
179+
//
180+
// actualRB := &k8srbacv1.RoleBinding{}
181+
// Eventually(func() error {
182+
// namespacedNamed := types.NamespacedName{Name: expectedRB.Name, Namespace: workingNamespace}
183+
// return k8sClient.Get(ctx, namespacedNamed, actualRB)
184+
// }, timeout, interval).ShouldNot(HaveOccurred())
185+
//
186+
// Expect(util.RoleBindingsAreEqual(*expectedRB, *actualRB)).Should(BeTrue())
187+
//}
189188

190189
func compareServiceAccounts(path string, opts mf.Option) {
191190
expectedSA := &corev1.ServiceAccount{}

controllers/util/util.go

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"fmt"
55
appsv1 "k8s.io/api/apps/v1"
66
corev1 "k8s.io/api/core/v1"
7-
k8srbacv1 "k8s.io/api/rbac/v1"
87
"reflect"
98
)
109

@@ -25,22 +24,22 @@ func ConfigMapsAreEqual(expected corev1.ConfigMap, actual corev1.ConfigMap) bool
2524
return true
2625
}
2726

28-
func RoleBindingsAreEqual(rb1 k8srbacv1.RoleBinding, rb2 k8srbacv1.RoleBinding) bool {
29-
30-
if !reflect.DeepEqual(rb1.ObjectMeta.Labels, rb2.ObjectMeta.Labels) {
31-
notEqualMsg("Rolebinding labels")
32-
return false
33-
}
34-
if !reflect.DeepEqual(rb1.Subjects, rb2.Subjects) {
35-
notEqualMsg("Rolebinding subjects")
36-
return false
37-
}
38-
if !reflect.DeepEqual(rb1.RoleRef, rb2.RoleRef) {
39-
notEqualMsg("Rolebinding role references")
40-
return false
41-
}
42-
return true
43-
}
27+
//func RoleBindingsAreEqual(rb1 k8srbacv1.RoleBinding, rb2 k8srbacv1.RoleBinding) bool {
28+
//
29+
// if !reflect.DeepEqual(rb1.ObjectMeta.Labels, rb2.ObjectMeta.Labels) {
30+
// notEqualMsg("Rolebinding labels")
31+
// return false
32+
// }
33+
// if !reflect.DeepEqual(rb1.Subjects, rb2.Subjects) {
34+
// notEqualMsg("Rolebinding subjects")
35+
// return false
36+
// }
37+
// if !reflect.DeepEqual(rb1.RoleRef, rb2.RoleRef) {
38+
// notEqualMsg("Rolebinding role references")
39+
// return false
40+
// }
41+
// return true
42+
//}
4443

4544
func ServiceAccountsAreEqual(sa1 corev1.ServiceAccount, sa2 corev1.ServiceAccount) bool {
4645
if !reflect.DeepEqual(sa1.ObjectMeta.Labels, sa2.ObjectMeta.Labels) {

0 commit comments

Comments
 (0)