Skip to content

CP3: Add custom RBAC role definitions to app-baseline chart #8434

Description

Summary

The container-platform-environments repo handles RBAC bindings (RoleBindings via app-baseline) and authentication (EKS access entries via identity/terraform/), but has no mechanism for BU teams to define custom Kubernetes Roles or ClusterRoles. Teams can only reference built-in ClusterRoles (view, edit, admin).

Problem

BU teams will need scoped-down or purpose-built roles that don't match the broad built-in ones:

  • CI/CD deployer — can update Deployments and Services but not read Secrets
  • Readonly debugger — can view pods, logs, and events but not exec into containers
  • Namespace admin — full access within namespaces but no cluster-scoped permissions
  • Restricted editor — edit minus certain resources (e.g. NetworkPolicies, ResourceQuotas)

Without this, teams get overly broad access or must raise manual requests — defeating the self-service GitOps model.

Proposed Solution

Extend the app-baseline chart with an optional roles: field in product.yaml:

access:
  - group: ci-deployer
    role: my-product-deployer
    clusters:
      - container-platform-octo-nonlive

roles:
  - name: my-product-deployer
    rules:
      - apiGroups: ["apps"]
        resources: ["deployments", "replicasets"]
        verbs: ["get", "list", "watch", "create", "update", "patch"]
      - apiGroups: [""]
        resources: ["services", "configmaps"]
        verbs: ["get", "list", "watch", "create", "update", "patch"]

Implementation

  1. New template charts/app-baseline/templates/clusterrole.yaml — creates ClusterRoles from .Values.roles
  2. Naming convention — prefix with product name (<product>-<role-name>) to avoid collisions
  3. Gatekeeper constraint — block roles that grant wildcard * on all apiGroups/resources/verbs
  4. Documentation — update README with common role pattern examples

Why not a separate Terraform module?

  • Roles are product-driven and BU-specific — they belong in product.yaml
  • The platform AppProjects already permit ClusterRole creation
  • No new pipeline or infrastructure needed
  • Same self-service GitOps model as namespaces and RoleBindings

Acceptance Criteria

  • app-baseline chart supports optional roles: list in values
  • Custom ClusterRoles created with product-name prefix
  • RoleBindings can reference custom roles (not just built-in ones)
  • Gatekeeper constraint blocks overly permissive role definitions
  • README documents roles: field with common examples
  • Backwards compatible — products without roles: work unchanged
  • Integration test validates custom role creation and binding

Related

  • container-platform-environmentscharts/app-baseline/
  • container-platform-terraform-gatekeeper — guardrail constraint
  • ADR-015: GitOps Repository Structure

Metadata

Metadata

Labels

Type

Projects

Status
🏗 In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions