Skip to content

Commit 9e844aa

Browse files
authored
Merge pull request #1642 from weaveworks/1602_tnancy_role_binding
fix tenancy deployment role binding name
2 parents 1ff00f0 + 90acfb0 commit 9e844aa

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

pkg/tenancy/tenancy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ func newServiceAccount(name, namespace string, labels map[string]string) *corev1
435435
}
436436

437437
func newDeploymentRBACRoleBinding(tenantName, namespace, serviceAccountName string, labels map[string]string) *rbacv1.RoleBinding {
438-
name := fmt.Sprintf("%s-service-account-deployment", tenantName)
438+
name := fmt.Sprintf("%s-service-account", tenantName)
439439
return newRoleBinding(
440440
name,
441441
namespace,

pkg/tenancy/tenancy_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -815,9 +815,9 @@ func Test_newDeploymentRBACRoleBinding(t *testing.T) {
815815
}
816816

817817
rb := newDeploymentRBACRoleBinding("test-tenant", "test-namespace", "test-tenant", labels)
818-
assert.Equal(t, rb.Name, "test-tenant-service-account-deployment")
818+
assert.Equal(t, rb.Name, "test-tenant-service-account")
819819
assert.Equal(t, rb.Namespace, "test-namespace")
820-
assert.Equal(t, rb.RoleRef.Name, "test-tenant-service-account-deployment")
820+
assert.Equal(t, rb.RoleRef.Name, "test-tenant-service-account")
821821
assert.Equal(t, rb.Labels["toolkit.fluxcd.io/tenant"], "test-tenant")
822822
assert.Equal(t, rb.Subjects, sub)
823823
}

pkg/tenancy/testdata/example.yaml.golden

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ metadata:
4141
creationTimestamp: null
4242
labels:
4343
toolkit.fluxcd.io/tenant: foo-tenant
44-
name: foo-tenant-service-account-deployment
44+
name: foo-tenant-service-account
4545
namespace: foo-ns
4646
roleRef:
4747
apiGroup: rbac.authorization.k8s.io
4848
kind: Role
49-
name: foo-tenant-service-account-deployment
49+
name: foo-tenant-service-account
5050
subjects:
5151
- kind: ServiceAccount
5252
name: foo-tenant
@@ -154,12 +154,12 @@ metadata:
154154
creationTimestamp: null
155155
labels:
156156
toolkit.fluxcd.io/tenant: bar-tenant
157-
name: bar-tenant-service-account-deployment
157+
name: bar-tenant-service-account
158158
namespace: bar-ns
159159
roleRef:
160160
apiGroup: rbac.authorization.k8s.io
161161
kind: Role
162-
name: bar-tenant-service-account-deployment
162+
name: bar-tenant-service-account
163163
subjects:
164164
- kind: ServiceAccount
165165
name: bar-tenant
@@ -246,12 +246,12 @@ metadata:
246246
creationTimestamp: null
247247
labels:
248248
toolkit.fluxcd.io/tenant: bar-tenant
249-
name: bar-tenant-service-account-deployment
249+
name: bar-tenant-service-account
250250
namespace: foobar-ns
251251
roleRef:
252252
apiGroup: rbac.authorization.k8s.io
253253
kind: Role
254-
name: bar-tenant-service-account-deployment
254+
name: bar-tenant-service-account
255255
subjects:
256256
- kind: ServiceAccount
257257
name: bar-tenant

pkg/tenancy/testdata/with_bind_roles.yaml.golden

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ metadata:
3939
creationTimestamp: null
4040
labels:
4141
toolkit.fluxcd.io/tenant: foo-tenant
42-
name: foo-tenant-service-account-deployment
42+
name: foo-tenant-service-account
4343
namespace: foo-ns
4444
roleRef:
4545
apiGroup: rbac.authorization.k8s.io
4646
kind: Role
47-
name: foo-tenant-service-account-deployment
47+
name: foo-tenant-service-account
4848
subjects:
4949
- kind: ServiceAccount
5050
name: foo-tenant

0 commit comments

Comments
 (0)