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.
18 lines
626 B
Go
18 lines
626 B
Go
package operator
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/rockliang/kafka-management-service/internal/kafka"
|
|
)
|
|
|
|
// TopicAdmin is the subset of internal/kafka.Admin the reconciler needs,
|
|
// abstracted so tests can substitute a fake instead of a real Kafka cluster.
|
|
type TopicAdmin interface {
|
|
CreateTopic(ctx context.Context, topic string, cfg kafka.TopicConfig) error
|
|
DeleteTopic(ctx context.Context, topic string) error
|
|
LogEndOffsetSum(ctx context.Context, topic string) (int64, error)
|
|
ConsumerLag(ctx context.Context, group, topic string) (int64, error)
|
|
ReplicaBrokerIDs(ctx context.Context, topic string) ([]int32, error)
|
|
}
|