Overview
When Tyk Operator is configured to watch multiple namespaces, authorization failures in any single watched namespace can halt reconciliation across the entire cluster, preventing newly created API definitions from syncing to the Tyk Dashboard.
Symptom
Tyk Operator logs authorization errors for one namespace, while newly applied custom resources in other healthy namespaces are completely ignored and remain unsynchronized without generating errors:
failed to list *v1alpha1.TykOasApiDefinition: User "system:serviceaccount:tyk-operator:tyk-operator-controller-manager" cannot list resource in API group in the namespace "team-e"Root Cause
The Tyk Operator is built with Kubernetes controller-runtime, which constructs a unified multi-namespace informer cache for all entries specified in watchNamespaces. When the Operator pod initializes or restarts:
- Controller-runtime attempts to synchronize informers across every listed namespace.
- If permissions are missing or out of date in even one watched namespace, the initial list request is rejected by the Kubernetes API server.
- The cache fails to report healthy synchronization, which prevents the controller manager from starting reconciliation loops for any namespace.
Resolution
- Use ClusterRole with Scoped RoleBindings: Retain the default
ClusterRole(e.g.tyk-operator-manager-role) from the official Helm chart to automatically inherit permissions for newly introduced CRDs. Rather than creating aClusterRoleBinding, create a namespace-scopedRoleBindingin each team namespace referencing the ClusterRole: - Pre-provision RBAC in Automation: Ensure all onboarding automation applies the required RoleBinding before adding a new namespace to the Operator
watchNamespacesconfiguration list.
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: tyk-operator-ns-binding
namespace: target-namespace
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: tyk-operator-manager-role
subjects:
- kind: ServiceAccount
name: tyk-operator-controller-manager
namespace: tyk-operator-system
Applies To
Tyk Operator v0.13+ and v1.0+ in multi-namespace deployments.
Comments
0 comments
Please sign in to leave a comment.