Skip to content

Commit

Permalink
[DCA] [orchestrator] add pv and pvc rbac (#365)
Browse files Browse the repository at this point in the history
* [DCA] [orchestrator] add pv and pvc rbac
* Add kubebuilder comment for PV and PVC

Co-authored-by: cedric lamoriniere <cedric.lamoriniere@datadoghq.com>
  • Loading branch information
Nam Nguyen and clamoriniere committed Aug 26, 2021
1 parent c388bdc commit bf28eca
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions controllers/datadogagent/clusteragent.go
Original file line number Diff line number Diff line change
Expand Up @@ -1359,6 +1359,17 @@ func buildClusterAgentClusterRole(dda *datadoghqv1alpha1.DatadogAgent, name, age
datadoghqv1alpha1.GetVerb,
},
})

// PV and PVC
rbacRules = append(rbacRules, rbacv1.PolicyRule{
APIGroups: []string{datadoghqv1alpha1.CoreAPIGroup},
Resources: []string{datadoghqv1alpha1.PersistentVolumesResource, datadoghqv1alpha1.PersistentVolumeClaimsResource},
Verbs: []string{
datadoghqv1alpha1.ListVerb,
datadoghqv1alpha1.WatchVerb,
datadoghqv1alpha1.GetVerb,
},
})
}

if isComplianceEnabled(&dda.Spec) {
Expand Down
2 changes: 2 additions & 0 deletions controllers/datadogagent_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ type DatadogAgentReconciler struct {
// +kubebuilder:rbac:groups=apps,resources=daemonsets,verbs=get;list;watch
// +kubebuilder:rbac:groups=batch,resources=jobs,verbs=get;list;watch
// +kubebuilder:rbac:groups=batch,resources=cronjobs,verbs=get;list;watch
// +kubebuilder:rbac:groups="",resources=persistentvolumeclaims,verbs=list;watch
// +kubebuilder:rbac:groups="",resources=persistentvolumes,verbs=list;watch

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

0 comments on commit bf28eca

Please sign in to comment.