Skip to content

Commit

Permalink
Update RBACs for storageclass and limitrange collection (#1159) (#1161)
Browse files Browse the repository at this point in the history
(cherry picked from commit cc16328)

Co-authored-by: Xavier Lucas <xavier.lucas@datadoghq.com>
  • Loading branch information
fanny-jiang and xlucas committed Apr 30, 2024
1 parent f113d7a commit abcb587
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
9 changes: 9 additions & 0 deletions controllers/datadogagent/orchestrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ func buildOrchestratorExplorerRBAC(dda *datadoghqv1alpha1.DatadogAgent, name, ve
rbac.PodsResource,
rbac.ServicesResource,
rbac.NodesResource,
rbac.LimitRangesResource,
},
},
{
Expand Down Expand Up @@ -227,6 +228,14 @@ func buildOrchestratorExplorerRBAC(dda *datadoghqv1alpha1.DatadogAgent, name, ve
rbac.WatchVerb,
},
},
{
APIGroups: []string{rbac.StorageAPIGroup},
Resources: []string{rbac.StorageClassesResource},
Verbs: []string{
rbac.ListVerb,
rbac.WatchVerb,
},
},
}

clusterRole.Rules = rbacRules
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ rules:
- pods
- services
- nodes
- limitranges
verbs:
- list
- watch
Expand Down Expand Up @@ -91,3 +92,10 @@ rules:
verbs:
- list
- watch
- apigroups:
- "storage.k8s.io"
resources:
- storageclasses
verbs:
- list
- watch
2 changes: 2 additions & 0 deletions controllers/datadogagent_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ type DatadogAgentReconciler struct {
// +kubebuilder:rbac:groups="",resources=nodes,verbs=get;list;watch
// +kubebuilder:rbac:groups="",resources=namespaces,verbs=get;list;watch
// +kubebuilder:rbac:groups="",resources=deployments,verbs=get;list;watch
// +kubebuilder:rbac:groups="",resources=limitranges,verbs=list;watch
// +kubebuilder:rbac:groups=apps,resources=deployments,verbs=get;list;watch
// +kubebuilder:rbac:groups=apps,resources=replicasets,verbs=get;list;watch
// +kubebuilder:rbac:groups=apps,resources=statefulsets,verbs=get;list;watch
Expand All @@ -140,6 +141,7 @@ type DatadogAgentReconciler struct {
// +kubebuilder:rbac:groups="",resources=serviceaccounts,verbs=list;watch
// +kubebuilder:rbac:groups="networking.k8s.io",resources=ingresses,verbs=list;watch
// +kubebuilder:rbac:groups=autoscaling.k8s.io,resources=verticalpodautoscalers,verbs=list;watch
// +kubebuilder:rbac:groups=storage.k8s.io,resources=storageclasses,verbs=list;watch

// Kubernetes_state_core
// +kubebuilder:rbac:groups="",resources=configmaps,verbs=list;watch
Expand Down

0 comments on commit abcb587

Please sign in to comment.