← Back to Pull requests

feat(helm/agent): add rbac.extraRules and rbac.extraClusterRules #1156

Open
unknown opened this pull request with 650 lines diff across 8 files
View on GitHub
unknown unknown commented on Oct 16, 2026 16:07 UTC
Author

What does this PR do / why we need it:

By default the agent's Role and ClusterRole only cover Argo CD's own resources, so the resource proxy cannot serve live resources of application workloads (e.g. "Live Manifest" in the Argo CD UI). Granting that access today requires creating a separate ClusterRole and binding outside the chart, so their lifecycle is not tied to the agent release.

This PR adds two opt-in values to the argocd-agent-agent chart, both empty by default:

  • rbac.extraRules: extra rules for the namespaced Role

  • rbac.extraClusterRules: extra rules for the ClusterRole
  • Extra rules are merged with the defaults: rules that differ only in their verbs are combined, and verbs containing are reduced to .

    The default RBAC is unchanged; nothing is granted unless the values are set.

    This PR also bumps appVersion to v0.10.0, which changes the default agent image tag. It is independent of this feature and can be split out if preferred.

    Which issue(s) this PR fixes:

    N/A (no existing issue)
    Related to #1047

    How to test changes / Special notes to the reviewer:

    The chart has no unit tests, so the merge logic is verified by rendering with the values below. Each case can be checked with:

    cd ./install/helm-repo/argocd-agent-agent
    helm template . -n argocd \
      -f <values-file> \
      -s templates/agent-clusterrole.yaml -s templates/agent-role.yaml
    

    <details>
    <summary>Test value and expected output</summary>

    1. Default (empty extra rules): RBAC output is unchanged

    rbac:
      extraRules: []
      extraClusterRules: []
    

    # ClusterRole, identical to main
    rules:
    - apiGroups:
      - ""
      resources:
      - namespaces
      verbs:
      - create
      - get
      - list
      - watch
    - apiGroups:
      - argoproj.io
      resources:
      - applications
      verbs:
      - create
      - get
      - list
      - watch
      - update
      - delete
      - patch
    

    The rendered Roles and ClusterRoles are identical to main.

    2. Non-conflicting rule is added as a separate entry

    rbac:
      extraClusterRules:
      - apiGroups:
        - ""
        resources:
        - pods
        - pods/log
        verbs:
        - get
        - list
        - watch
    

    rules:
    # ... the two default rules
    - apiGroups:
      - ""
      resources:
      - pods
      - pods/log
      verbs:
      - get
      - list
      - watch
    

    3. Same apiGroups and resources as a default rule: verbs are unioned

    rbac:
      extraClusterRules:
      - apiGroups:
        - ""
        resources:
        - namespaces
        verbs:
        - get
        - delete
      - apiGroups:
        - argoproj.io
        resources:
        - applications
        verbs:
        - get
        - deletecollection
    

    rules:
    - apiGroups:
      - ""
      resources:
      - namespaces
      verbs:
      - create
      - get
      - list
      - watch
      - delete
    - apiGroups:
      - argoproj.io
      resources:
      - applications
      verbs:
      - create
      - get
      - list
      - watch
      - update
      - delete
      - patch
      - deletecollection
    

    4. Order and duplicates of resources are ignored

    rbac:
      extraClusterRules:
      - apiGroups:
        - ""
        resources:
        - pods
        - services
        verbs:
        - get
      - apiGroups:
        - ""
        resources:
        - services
        - pods
        verbs:
        - list
      - apiGroups:
        - ""
        resources:
        - pods
        - services
        - services
        verbs:
        - watch
      - apiGroups:
        - ""
        resources:
        - pods
        verbs:
        - delete
    

    rules:
    # ... the two default rules
    - apiGroups:
      - ""
      resources:
      - pods
      - services
      verbs:
      - get
      - list
      - watch
    - apiGroups:
      - ""
      resources:
      - pods
      verbs:
      - delete
    

    5. resourceNames and nonResourceURLs are respected

    rbac:
      extraClusterRules:
      - apiGroups:
        - apps
        resources:
        - deployments
        resourceNames:
        - b
        - a
        verbs:
        - get
      - apiGroups:
        - apps
        resources:
        - deployments
        resourceNames:
        - a
        - b
        verbs:
        - patch
      - apiGroups:
        - apps
        resources:
        - deployments
        verbs:
        - get
      - nonResourceURLs:
        - /healthz
        - /version
        verbs:
        - get
      - nonResourceURLs:
        - /version
        - /healthz
        verbs:
        - head
    

    rules:
    # ... the two default rules
    - apiGroups:
      - apps
      resourceNames:
      - b
      - a
      resources:
      - deployments
      verbs:
      - get
      - patch
    - apiGroups:        # not merged: no resourceNames
      - apps
      resources:
      - deployments
      verbs:
      - get
    - nonResourceURLs:
      - /healthz
      - /version
      verbs:
      - get
      - head
    

    *6. Verbs containing are reduced to

    rbac:
      extraClusterRules:
      - apiGroups:
        - ""
        resources:
        - namespaces
        verbs:
        - '*'
      - apiGroups:
        - apps
        resources:
        - deployments
        verbs:
        - get
        - '*'
        - list
      - apiGroups:
        - apps
        resources:
        - statefulsets
        verbs:
        - get
      - apiGroups:
        - apps
        resources:
        - statefulsets
        verbs:
        - '*'
      - apiGroups:
        - apps
        resources:
        - daemonsets
        verbs:
        - get
        - list
    

    rules:
    - apiGroups:
      - ""
      resources:
      - namespaces
      verbs:
      - '*'
    # ... the argoproj.io/applications default rule
    - apiGroups:
      - apps
      resources:
      - deployments
      verbs:
      - '*'
    - apiGroups:
      - apps
      resources:
      - statefulsets
      verbs:
      - '*'
    - apiGroups:
      - apps
      resources:
      - daemonsets
      verbs:
      - get
      - list
    

    7. extraRules is merged into the Role

    rbac:
      extraRules:
      - apiGroups:
        - ""
        resources:
        - events
        verbs:
        - get
        - watch
      - apiGroups:
        - ""
        resources:
        - configmaps
        - secrets
        verbs:
        - deletecollection
    

    rules:
    # ... the argoproj.io default rule
    - apiGroups:
      - ""
      resources:
      - secrets
      - configmaps
      verbs:
      - create
      - get
      - list
      - watch
      - update
      - patch
      - delete
      - deletecollection
    - apiGroups:
      - ""
      resources:
      - events
      verbs:
      - create
      - list
      - get
      - watch
    

    8. Other checks

  • --set rbac.createClusterRole=false: no ClusterRole is rendered.

  • --set agentMode=autonomous: same output as managed.

  • --set rbac.extraRules=oops: rejected by the schema (got string, want array).
  • </details>

    Also verified with helm lint and make validate-values-schema.

    Checklist

    [x] Documentation update is required by this PR (and has been updated) OR no documentation update is required.

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    Summary by CodeRabbit

    New Features
    Added Helm chart settings for extending the agent’s namespace-scoped and cluster-wide permissions. Rules with matching scopes are combined, with their verbs merged.
    Added guidance for granting live-resource read access without access to Secrets, including the built-in view role as an alternative.

    Updates
    * Updated the agent chart version to 0.2.9 and the application version to v0.10.0.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: jannfis Review duration: 16290m
    All Vouch review confidence checks passed
    Residual risk 0.40 = Change Risk (0.75) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.75 · 650 lines diff across 8 files
    0.75
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.344
    Sensitive Paths sensitive_paths
    0.075
    Real PR Conversation Timeline
    1 comments
    "Review active on #1156"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: medium confidence: 46.7% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 75.2% (HIGH) · Higher = larger blast radius
    75.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 40.1% · Moderate risk
    40.1%