Skip to content

Commit 6e8e2bd

Browse files
PeterYurkovichjgbernalp
authored andcommitted
fix: add perses clusterrole and binding
1 parent e0d1171 commit 6e8e2bd

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

pkg/controllers/uiplugin/components.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ func pluginComponentReconcilers(plugin *uiv1alpha1.UIPlugin, pluginInfo UIPlugin
125125
persesServiceAccountName := "perses" + serviceAccountSuffix
126126
components = append(components, reconciler.NewUpdater(newServiceAccount("perses", namespace), plugin))
127127
components = append(components, reconciler.NewUpdater(newClusterRoleBinding(namespace, persesServiceAccountName, "system:auth-delegator", persesServiceAccountName+":system:auth-delegator"), plugin))
128+
components = append(components, reconciler.NewUpdater(newPersesClusterRole(), plugin))
129+
components = append(components, reconciler.NewUpdater(newClusterRoleBinding(namespace, persesServiceAccountName, "perses-cr", persesServiceAccountName+":perses-cr"), plugin))
128130
components = append(components, reconciler.NewUpdater(newPerses(namespace, pluginInfo.PersesImage), plugin))
129131
components = append(components, reconciler.NewUpdater(newAcceleratorsDatasource(namespace), plugin))
130132
components = append(components, reconciler.NewUpdater(newAcceleratorsDashboard(namespace), plugin))

pkg/controllers/uiplugin/monitoring.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
persesrole "github.com/rhobs/perses/pkg/model/api/v1/role"
1414
"golang.org/x/mod/semver"
1515
corev1 "k8s.io/api/core/v1"
16+
rbacv1 "k8s.io/api/rbac/v1"
1617
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1718
"k8s.io/apimachinery/pkg/util/intstr"
1819

@@ -373,3 +374,27 @@ func newPerses(namespace string, persesImage string) *persesv1alpha1.Perses {
373374
},
374375
}
375376
}
377+
378+
func newPersesClusterRole() *rbacv1.ClusterRole {
379+
return &rbacv1.ClusterRole{
380+
TypeMeta: metav1.TypeMeta{
381+
APIVersion: rbacv1.SchemeGroupVersion.String(),
382+
Kind: "ClusterRole",
383+
},
384+
ObjectMeta: metav1.ObjectMeta{
385+
Name: "perses-cr",
386+
},
387+
Rules: []rbacv1.PolicyRule{
388+
{
389+
APIGroups: []string{""},
390+
Resources: []string{"namespaces"},
391+
Verbs: []string{"list", "get"},
392+
},
393+
{
394+
APIGroups: []string{"perses.dev"},
395+
Resources: []string{"persesdashboards", "persesdatasources"},
396+
Verbs: []string{"get", "list", "watch", "create", "update", "delete", "patch"},
397+
},
398+
},
399+
}
400+
}

0 commit comments

Comments
 (0)