55
66 "golang.org/x/mod/semver"
77
8+ argoproj "github.com/argoproj-labs/argocd-operator/api/v1beta1"
89 "github.com/argoproj-labs/argocd-operator/common"
910
1011 v1 "k8s.io/api/rbac/v1"
@@ -148,8 +149,8 @@ func policyRuleForDexServer() []v1.PolicyRule {
148149 }
149150}
150151
151- func policyRuleForServer () []v1.PolicyRule {
152- return []v1.PolicyRule {
152+ func policyRuleForServer (cr * argoproj. ArgoCD ) []v1.PolicyRule {
153+ policyRules := []v1.PolicyRule {
153154 {
154155 APIGroups : []string {
155156 "*" ,
@@ -226,6 +227,20 @@ func policyRuleForServer() []v1.PolicyRule {
226227 },
227228 },
228229 }
230+ if isWebTerminalEnabled (cr ) {
231+ policyRules = append (policyRules , v1.PolicyRule {
232+ APIGroups : []string {
233+ "" ,
234+ },
235+ Resources : []string {
236+ "pods/exec" ,
237+ },
238+ Verbs : []string {
239+ "create" ,
240+ },
241+ })
242+ }
243+ return policyRules
229244}
230245
231246func policyRuleForNotificationsController () []v1.PolicyRule {
@@ -399,7 +414,7 @@ func policyRuleForServerClusterRole() []v1.PolicyRule {
399414 }
400415}
401416
402- func getPolicyRuleList (client client.Client ) []struct {
417+ func getPolicyRuleList (client client.Client , cr * argoproj. ArgoCD ) []struct {
403418 name string
404419 policyRule []v1.PolicyRule
405420} {
@@ -415,7 +430,7 @@ func getPolicyRuleList(client client.Client) []struct {
415430 policyRule : policyRuleForDexServer (),
416431 }, {
417432 name : common .ArgoCDServerComponent ,
418- policyRule : policyRuleForServer (),
433+ policyRule : policyRuleForServer (cr ),
419434 }, {
420435 name : common .ArgoCDRedisHAComponent ,
421436 policyRule : policyRuleForRedisHa (client ),
0 commit comments