fix(aws-eks): Controller CRD-read RBAC independent of chart ordering + pin k8s-firewall - #75
Open
cmchenr wants to merge 1 commit into
Open
fix(aws-eks): Controller CRD-read RBAC independent of chart ordering + pin k8s-firewall#75cmchenr wants to merge 1 commit into
cmchenr wants to merge 1 commit into
Conversation
…ring + pin k8s-firewall The Controller logged "firewallpolicies.networking.aviatrix.com is forbidden ... cannot list at the cluster scope" and clusters showed partial status, even though the access entry correctly maps the Controller role into the avx-controller group. Root cause was layer ordering, not config: aviatrix_kubernetes_cluster onboards the cluster in the cluster layer, and the Controller's first CRD-read poll fires before the nodes-layer k8s-firewall chart installs the avx-controller ClusterRoleBinding that grants networking.aviatrix.com read. The first poll hits forbidden and the status sticks. Fix: the shared aws-eks-cluster module now creates a Terraform-managed avx-controller-crd-reader ClusterRole + binding in the cluster layer, so the grant is live at onboarding time regardless of when the chart lands. RBAC rules may reference CRD kinds before the CRDs are registered, so this is safe. Named distinctly from the chart's own avx-controller objects to avoid Helm collisions. Applies to both aws-eks-singlecluster and aws-eks-multicluster (shared module). Also pin the k8s-firewall Helm chart (was unpinned -> silently tracked latest) via a new k8s_firewall_chart_version variable defaulting to 9.0.0, matching the existing *_chart_version pattern. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On freshly deployed
aws-eks-multiclusterclusters, the Aviatrix Controller logged:and the onboarded clusters showed partial status, even though the EKS access entry correctly maps the Controller role into the
avx-controllergroup.Root cause: layer ordering, not config
aviatrix_kubernetes_cluster(onboarding) and the access entry live in the cluster layer. Theavx-controllerClusterRoleBinding that actually grantsnetworking.aviatrix.comread is created by thek8s-firewallHelm chart in the later nodes layer. In a clean multi-layer deploy the Controller's first CRD-read poll fires ~1 min before that binding exists →forbidden, and the status sticks. This is structural, and is the only reason the previously-workingavx-controlleraccess-entry fix appeared to regress in multi-layer deploys.Verified on the live clusters: access entry groups
[avx-controller, view-nodes]✅, chart binding present ✅,can-i list firewallpolicies --as-group=avx-controller→ yes ✅ — i.e. RBAC was correct, just established too late for the first poll.Fix
Decouple the grant from chart timing. The shared
modules/aws-eks-clusternow creates a Terraform-managedavx-controller-crd-readerClusterRole + binding in the cluster layer (mirroring the existingview-nodespattern), granting theavx-controllergroupget/list/watchonnetworking.aviatrix.com/*. The grant is live at onboarding, independent of when/whether the chart lands. RBAC rules may reference CRD kinds before the CRDs are registered, so this is safe. Named distinctly from the chart's ownavx-controllerobjects to avoid Helm ownership collisions; the duplicate grant to the same group is harmless. Fixes bothaws-eks-singleclusterandaws-eks-multicluster(shared module).Pin the chart.
k8s-firewallwas installed unpinned (silently tracking latest). Added ak8s_firewall_chart_versionvariable (default9.0.0, the current release) matching the existing*_chart_versionpattern, across both blueprints' nodes layers.Validation
-replaceonaviatrix_kubernetes_clusterfor both frontend and backend (re-onboards → fresh poll with RBAC already present). Both applied clean.avx-controller-crd-readerbinding present;can-i list firewallpolicies/webgrouppolicies(groupavx-controller) → yes.terraform validatepasses on the nodes layer;terraform fmtclean.Notes
dcf-crd/manifests are manual examples), so post-fix the Controller lists the CRDs successfully but returns empty — status clears with nothing to sync. Deploy a sampleFirewallPolicyCR to see rulesets populate.azure-aks-multiclusterworking-tree changes were intentionally left out of this PR.🤖 Generated with Claude Code