--- # ClusterRole for Backstage service account - allows managing environments apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: backstage-environment-manager rules: # Namespace management for environment lifecycle - apiGroups: [""] resources: ["namespaces"] verbs: ["get", "list", "watch", "delete"] # Read access to core resources for Kubernetes plugin - apiGroups: [""] resources: ["resourcequotas", "limitranges", "pods", "services", "configmaps", "secrets"] verbs: ["get", "list", "watch"] # Apps - deployments, replicasets, statefulsets, daemonsets - apiGroups: ["apps"] resources: ["deployments", "replicasets", "statefulsets", "daemonsets"] verbs: ["get", "list", "watch"] # Batch - jobs and cronjobs - apiGroups: ["batch"] resources: ["jobs", "cronjobs"] verbs: ["get", "list", "watch"] # Autoscaling - HorizontalPodAutoscalers - apiGroups: ["autoscaling"] resources: ["horizontalpodautoscalers"] verbs: ["get", "list", "watch"] # Networking - networkpolicies and ingresses - apiGroups: ["networking.k8s.io"] resources: ["networkpolicies", "ingresses"] verbs: ["get", "list", "watch"] # Metrics - for pod metrics - apiGroups: ["metrics.k8s.io"] resources: ["pods"] verbs: ["get", "list", "watch"] # ArgoCD Applications - for cleanup when deleting environments - apiGroups: ["argoproj.io"] resources: ["applications"] verbs: ["get", "list", "watch", "delete"] # Argo Workflows - for monitoring environment provisioning status - apiGroups: ["argoproj.io"] resources: ["workflows"] verbs: ["get", "list", "watch"] --- # Bind the role to backstage service account apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: backstage-environment-manager-binding roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: backstage-environment-manager subjects: - kind: ServiceAccount name: backstage namespace: backstage