Skip to content

fix(manifests): wire ambient-control-plane-rbac.yaml into mpp-openshift kustomization#1167

Merged
markturansky merged 1 commit intoalphafrom
fix/cp-tenant-namespace-rbac
Apr 2, 2026
Merged

fix(manifests): wire ambient-control-plane-rbac.yaml into mpp-openshift kustomization#1167
markturansky merged 1 commit intoalphafrom
fix/cp-tenant-namespace-rbac

Conversation

@markturansky
Copy link
Copy Markdown
Contributor

@markturansky markturansky commented Apr 2, 2026

Summary

  • ambient-control-plane-rbac.yaml already existed in the mpp-openshift overlay with the correct Role/RoleBinding granting the CP service account get/list/watch/create/delete on tenantnamespaces.tenant.paas.redhat.com in ambient-code--config
  • The file was never listed in kustomization.yaml, so it was never applied — causing Forbidden errors when the MPPNamespaceProvisioner tried to manage TenantNamespace CRs
  • Fix: add - ambient-control-plane-rbac.yaml to the resources: list

Root Cause

Error observed after PR #1162 merged:

tenantnamespaces.tenant.paas.redhat.com "test" is forbidden:
User "system:serviceaccount:ambient-code--ambient-s0:ambient-control-plane"
cannot get resource "tenantnamespaces" in API group "tenant.paas.redhat.com"
in the namespace "ambient-code--config"

Test plan

  • Apply kustomize overlay to MPP cluster and confirm no Forbidden errors on tenantnamespaces operations
  • CP pod logs should show successful project namespace provisioning

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Updated infrastructure configuration to include additional role-based access control settings for enhanced security management.

…ft kustomization

The RBAC Role/RoleBinding granting the control-plane SA get/list/watch/create/delete
on tenantnamespaces.tenant.paas.redhat.com in ambient-code--config already existed
but was never referenced in kustomization.yaml, causing Forbidden errors when the
MPP provisioner tried to manage TenantNamespace CRs.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 2, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

A Kustomize overlay configuration for mpp-openshift was updated to include a new RBAC resource file reference without altering other configuration sections.

Changes

Cohort / File(s) Summary
Kustomize Configuration
components/manifests/overlays/mpp-openshift/kustomization.yaml
Added ambient-control-plane-rbac.yaml to the resources list.
🚥 Pre-merge checks | ✅ 5 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Kubernetes Resource Safety ❓ Inconclusive Cannot execute shell commands to examine Kubernetes manifests and RBAC configurations in the repository. Provide the actual content of kustomization.yaml and ambient-control-plane-rbac.yaml files to assess Kubernetes resource safety and RBAC permission concerns.
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Title follows Conventional Commits format (fix(manifests):) and accurately describes the main change: adding ambient-control-plane-rbac.yaml to the kustomization resources.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Performance And Algorithmic Complexity ✅ Passed Pull request modifies only a Kustomization YAML configuration file, adding a single resource reference with no algorithmic logic, loops, API calls, caching, pagination, or frontend impact.
Security And Secret Handling ✅ Passed PR adds RBAC manifest reference with proper secret handling via Kubernetes Secrets; no credentials embedded.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/cp-tenant-namespace-rbac
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix/cp-tenant-namespace-rbac

Warning

Review ran into problems

🔥 Problems

Timed out fetching pipeline failures after 30000ms


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@markturansky markturansky merged commit 0445893 into alpha Apr 2, 2026
38 checks passed
@markturansky markturansky deleted the fix/cp-tenant-namespace-rbac branch April 2, 2026 18:24
markturansky added a commit that referenced this pull request Apr 2, 2026
…cement (#1168)

## Summary

Follow-up to #1167. The wired-in RBAC had two issues:

1. **Wrong subject namespace**: `subjects[0].namespace` was hardcoded to
`ambient-code--runtime-int`, but the CP runs in whatever namespace the
overlay deploys to. When deployed to `ambient-code--ambient-s0`, the
binding was silently wrong.
2. **Duplicate ClusterRole/ClusterRoleBinding**: The overlay had its own
`ClusterRole`/`ClusterRoleBinding` duplicating what
`base/rbac/control-plane-clusterrole.yaml` already provides.

## Fix

- Remove the duplicated `ClusterRole`/`ClusterRoleBinding` from
`ambient-control-plane-rbac.yaml`
- Keep only the MPP-specific `Role`/`RoleBinding` for
`tenantnamespaces.tenant.paas.redhat.com`
- Add a Kustomize `replacement` that sources `subjects[0].namespace`
from the `ambient-control-plane` ServiceAccount's `metadata.namespace` —
which Kustomize automatically rewrites to match the overlay's
`namespace:` field. Any future overlay deploying to a different
namespace gets the correct binding automatically, with zero duplication.

## Verification

```
kustomize build components/manifests/overlays/mpp-openshift/
# RoleBinding subjects[0].namespace == ambient-code--runtime-int ✓
```

## Test plan
- [ ] Apply to MPP cluster and confirm no Forbidden errors on
`tenantnamespaces` operations
- [ ] CP pod logs show successful project namespace provisioning

🤖 Generated with [Claude Code](https://claude.ai/code)

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

## Summary by CodeRabbit

* **Chores**
  * Simplified permissions by removing unused role declarations.
  * Improved namespace configuration synchronization for role bindings.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant