$ show FairwindsOps/rbac-lookup
RBAC Lookup is a CLI tool for Kubernetes that enables users to find all RoleBindings and ClusterRoleBindings associated with a specific user, service account, or group. The tool connects to a Kubernetes cluster via kubeconfig, queries the RBAC API, and presents the results in a tabular format. It includes optional GKE integration to show Google Cloud IAM roles alongside native Kubernetes RBAC roles. The architecture follows a standard Cobra-based CLI pattern with command definitions in cmd/, core lookup logic in lookup/, and data structures defined in lookup/rbac_subject.go. The tool requires access to a Kubernetes cluster and optionally Google Cloud credentials for GKE features.
The LLM identified 1 files worth highlighting for reuse:
Implements the core RBAC lookup functionality: fetching RoleBindings and ClusterRoleBindings from the Kubernetes API, filtering by subject name and kind, optionally enriching with GKE IAM policies, and formatting output. This component demonstrates skill in handling both namespaced and cluster-scoped Kubernetes resources, optional cloud provider integration, and efficient data structuring for lookup operations. It could be extracted as a reusable library for Kubernetes RBAC querying with minimal modification (primarily requiring client-go and the accompanying rbac_subject types).