Fix tenant service account binding

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
pull/525/head
Stefan Prodan 4 years ago
parent 182928002b
commit ffdaa9dfe9
No known key found for this signature in database
GPG Key ID: 3299AEB0E4085BAF

@ -56,7 +56,6 @@ reconcilers scope to the tenant namespaces.`,
const (
tenantLabel = "toolkit.fluxcd.io/tenant"
tenantRoleBinding = "gotk-reconciler"
)
var (
@ -123,18 +122,20 @@ func createTenantCmdRun(cmd *cobra.Command, args []string) error {
roleBinding := rbacv1.RoleBinding{
ObjectMeta: metav1.ObjectMeta{
Name: tenantRoleBinding,
Name: fmt.Sprintf("%s-reconciler", tenant),
Namespace: ns,
Labels: objLabels,
},
Subjects: []rbacv1.Subject{
{
APIGroup: "rbac.authorization.k8s.io",
Kind: "User",
Name: fmt.Sprintf("gotk:%s:reconciler", ns),
},
{
Kind: "ServiceAccount",
Name: tenant,
Namespace: ns,
},
},
RoleRef: rbacv1.RoleRef{
@ -290,7 +291,7 @@ func exportTenant(namespace corev1.Namespace, account corev1.ServiceAccount, rol
fmt.Println(resourceToString(data))
account.TypeMeta = metav1.TypeMeta{
APIVersion: "",
APIVersion: "v1",
Kind: "ServiceAccount",
}
data, err = yaml.Marshal(account)

Loading…
Cancel
Save