Skip to content

Commit

Permalink
Fix tenant without clusters allowed access to all clusters (#274)
Browse files Browse the repository at this point in the history
Follow up of the cleanup in #272 .
  • Loading branch information
bastjan authored Jun 4, 2024
1 parent 3cd83e6 commit a5dd7bf
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions controllers/tenant/role.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,21 @@ func reconcileRole(obj pipeline.Object, data *pipeline.Context) pipeline.Result
Resources: []string{"tenants"},
ResourceNames: []string{tenant.Name},
},
{
APIGroups: []string{synv1alpha1.GroupVersion.Group},
Verbs: []string{"get"},
Resources: []string{"clusters"},
ResourceNames: clusterNames,
},
{
APIGroups: []string{synv1alpha1.GroupVersion.Group},
Verbs: []string{"get", "update", "patch"},
Resources: []string{"clusters/status"},
ResourceNames: clusterNames,
},
}
if len(clusterNames) > 0 {
role.Rules = append(role.Rules,
rbacv1.PolicyRule{
APIGroups: []string{synv1alpha1.GroupVersion.Group},
Verbs: []string{"get"},
Resources: []string{"clusters"},
ResourceNames: clusterNames,
},
rbacv1.PolicyRule{
APIGroups: []string{synv1alpha1.GroupVersion.Group},
Verbs: []string{"get", "update", "patch"},
Resources: []string{"clusters/status"},
ResourceNames: clusterNames,
})
}
return controllerutil.SetControllerReference(tenant, &role, data.Client.Scheme())
})
Expand Down

0 comments on commit a5dd7bf

Please sign in to comment.