feat: stamp Queue shard status with availability zones

Resolves each shard topic's replica broker IDs (internal/kafka.Admin.
ReplicaBrokerIDs) to the topology.kubernetes.io/zone labels of the nodes
hosting those brokers (ZoneLocator), and writes the result into
ShardStatus.AvailabilityZones each reconcile. Uses mgr.GetAPIReader()
rather than the cached client for the Pod/Node lookups, since the cached
client would otherwise require cluster-wide list/watch RBAC on Pods just
to serve occasional point Gets.
This commit is contained in:
riotpiaole
2026-06-22 17:30:26 -07:00
parent 1ff1ecd563
commit c7eeed2617
12 changed files with 227 additions and 0 deletions
+10
View File
@@ -67,6 +67,16 @@ func main() {
Admin: admin,
Redis: rdb,
Now: time.Now,
Zones: &operator.ZoneLocator{
// GetAPIReader(), not GetClient(): the latter is cache-backed and
// would make controller-runtime List+Watch all Pods/Nodes
// cluster-wide just to serve occasional point Gets here. A direct
// (uncached) reader needs only "get" RBAC, not "list"/"watch".
Client: mgr.GetAPIReader(),
Namespace: getEnv("KMSVC_NAMESPACE", "sqs"),
ClusterName: getEnv("KMSVC_KAFKA_CLUSTER_NAME", "kmsvc"),
PoolName: getEnv("KMSVC_KAFKA_POOL_NAME", "kmsvc-pool"),
},
}
err = ctrl.NewControllerManagedBy(mgr).