func validateKubeContexts()

in grpc-xds/control-plane-go/pkg/config/informers.go [65:80]


func validateKubeContexts(contexts []informers.Kubecontext) error {
	if len(contexts) == 0 {
		return errNoContext
	}
	contextNames := map[string]bool{}
	for _, context := range contexts {
		if _, exists := contextNames[context.Context]; exists {
			return fmt.Errorf("%w: context=%s", errDuplicateContext, context.Context)
		}
		if err := validateInformerConfigs(context.Informers); err != nil {
			return fmt.Errorf("invalid informer config for context=%s: %w", context.Context, err)
		}
		contextNames[context.Context] = true
	}
	return nil
}