Skip to content

Commit

Permalink
Watch namespaced RBAC via ns and cluster scoped via label
Browse files Browse the repository at this point in the history
Signed-off-by: Douglas Camata <[email protected]>
  • Loading branch information
douglascamata committed May 31, 2024
1 parent c8cd888 commit 55be122
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func generateHubInfoSecret(client client.Client, obsNamespace string,
var err error
alertmanagerRouterCA, err = config.GetAlertmanagerCA(client)
if err != nil {
log.Error(err, "Failed to CA of the Alertmanager")
log.Error(err, "Failed to get CA of Alertmanager")
return nil, err
}
}
Expand Down
12 changes: 10 additions & 2 deletions operators/multiclusterobservability/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,16 @@ func main() {
&addonv1alpha1.ManagedClusterAddOn{}: {
Field: fields.Set{"metadata.name": util.ManagedClusterAddonName}.AsSelector(),
},
&rbacv1.Role{}: byObjectWithOwnerLabel,
&rbacv1.RoleBinding{}: byObjectWithOwnerLabel,
&rbacv1.Role{}: {
Namespaces: map[string]cache.Config{
defaultNamespace: {},
},
},
&rbacv1.RoleBinding{}: {
Namespaces: map[string]cache.Config{
defaultNamespace: {},
},
},
&rbacv1.ClusterRole{}: byObjectWithOwnerLabel,
&rbacv1.ClusterRoleBinding{}: byObjectWithOwnerLabel,
&addonv1alpha1.ManagedClusterAddOn{}: byObjectWithOwnerLabel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
app.kubernetes.io/component: controller
app.kubernetes.io/name: observatorium-operator
app.kubernetes.io/version: v0.1
owner: multicluster-observability-operator
name: open-cluster-management:observatorium-operator
rules:
- apiGroups:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
app.kubernetes.io/component: controller
app.kubernetes.io/name: observatorium-operator
app.kubernetes.io/version: v0.1
owner: multicluster-observability-operator
name: open-cluster-management:observatorium-operator
roleRef:
apiGroup: rbac.authorization.k8s.io
Expand All @@ -14,4 +15,3 @@ subjects:
- kind: ServiceAccount
name: observatorium
namespace: open-cluster-management-observability

Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ subjects:
- kind: ServiceAccount
name: prometheus-k8s
namespace: openshift-monitoring

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: aggregate-observabilityaddons-edit
labels:
rbac.authorization.k8s.io/aggregate-to-admin: "true"
owner: "multicluster-observability-operator"
owner: multicluster-observability-operator
rules:
- verbs:
- get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: ClusterRole
metadata:
name: open-cluster-management:endpoint-observability-operator
labels:
owner: "multicluster-observability-operator"
owner: multicluster-observability-operator
rules:
- apiGroups:
- apiextensions.k8s.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: open-cluster-management:endpoint-observability-operator-rb
labels:
owner: "multicluster-observability-operator"
owner: multicluster-observability-operator
subjects:
- kind: ServiceAccount
name: endpoint-observability-operator-sa
Expand Down

0 comments on commit 55be122

Please sign in to comment.