clusterutil

package
v0.0.0-...-511f086 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MetadataClusterVerificationLabelKey is the key of the cluster verification label gRPC metadata.
	MetadataClusterVerificationLabelKey = "x-cluster"
)

Variables

View Source
var (
	ErrNoClusterVerificationLabel = fmt.Errorf("no cluster verification label in context")
)

Functions

func GetClusterFromIncomingContext

func GetClusterFromIncomingContext(ctx context.Context) (string, error)

GetClusterFromIncomingContext returns a single metadata value corresponding to the MetadataClusterVerificationLabelKey key from the incoming context, if it exists. In all other cases an error is returned.

func PutClusterIntoOutgoingContext

func PutClusterIntoOutgoingContext(ctx context.Context, cluster string) context.Context

PutClusterIntoOutgoingContext returns a new context with the provided value for MetadataClusterVerificationLabelKey, merged with any existing metadata in the context. Empty values are ignored.

Types

type ClusterValidationConfig

type ClusterValidationConfig struct {
	Label string
	GRPC  ClusterValidationProtocolConfig
}

func (*ClusterValidationConfig) RegisterFlagsWithPrefix

func (cfg *ClusterValidationConfig) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet)

func (*ClusterValidationConfig) Validate

func (cfg *ClusterValidationConfig) Validate() error

type ClusterValidationProtocolConfig

type ClusterValidationProtocolConfig struct {
	Enabled        bool
	SoftValidation bool
}

func (*ClusterValidationProtocolConfig) RegisterFlagsWithPrefix

func (cfg *ClusterValidationProtocolConfig) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet)

func (*ClusterValidationProtocolConfig) Validate

func (cfg *ClusterValidationProtocolConfig) Validate(prefix string, label string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL