Documentation
¶
Index ¶
- Variables
- func ClusterIDValidator(clusterID *uint32) clusterServiceValidator
- func ClusterNameValidator(clusterName string) clusterServiceValidator
- func KeyCreator(validators ...clusterServiceValidator) store.KeyCreator
- func NamespacedNameValidator() clusterServiceValidator
- type BackendZone
- type ClusterService
- func (in *ClusterService) DeepCopy() *ClusterService
- func (in *ClusterService) DeepCopyInto(out *ClusterService)
- func (s *ClusterService) DeepKeyCopy() store.LocalKey
- func (s *ClusterService) GetKeyName() string
- func (s *ClusterService) Marshal() ([]byte, error)
- func (s *ClusterService) NamespaceServiceName() types.NamespacedName
- func (s *ClusterService) String() string
- func (s *ClusterService) Unmarshal(_ string, data []byte) error
- type ForZone
- type PortConfiguration
- type ServiceMerger
- type ValidatingClusterService
Constants ¶
This section is empty.
Variables ¶
var ( // ServiceStorePrefix is the kvstore prefix of the shared store // // WARNING - STABLE API: Changing the structure or values of this will // break backwards compatibility ServiceStorePrefix = path.Join(kvstore.BaseKeyPrefix, "state", "services", "v1") )
Functions ¶
func ClusterIDValidator ¶
func ClusterIDValidator(clusterID *uint32) clusterServiceValidator
ClusterIDValidator returns a validator enforcing that the cluster ID of the unmarshaled service matches the provided one. The access to the provided clusterID value is not synchronized, and it shall not be mutated concurrently.
func ClusterNameValidator ¶
func ClusterNameValidator(clusterName string) clusterServiceValidator
ClusterNameValidator returns a validator enforcing that the cluster field of the unmarshaled service matches the provided one.
func KeyCreator ¶
func KeyCreator(validators ...clusterServiceValidator) store.KeyCreator
KeyCreator returns a store.KeyCreator for ClusterServices, configuring the specified extra validators.
func NamespacedNameValidator ¶
func NamespacedNameValidator() clusterServiceValidator
NamespacedNameValidator returns a validator enforcing that the namespaced name of the unmarshaled service matches the kvstore key.
Types ¶
type BackendZone ¶ added in v1.19.0
type BackendZone struct {
// Zone where backend is located.
Zone string `json:"zone"`
// ForZones where this backend should be consumed in
ForZones []ForZone `json:"forZones"`
}
BackendZone locates the backend to a specific zone and specifies what zones the backend should be used in for topology aware routing.
WARNING - STABLE API: Changing the structure or values of this will break backwards compatibility
+k8s:deepcopy-gen=true
func (*BackendZone) DeepCopy ¶ added in v1.19.0
func (in *BackendZone) DeepCopy() *BackendZone
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendZone.
func (*BackendZone) DeepCopyInto ¶ added in v1.19.0
func (in *BackendZone) DeepCopyInto(out *BackendZone)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*BackendZone) ToLBBackendZone ¶ added in v1.19.0
func (bz *BackendZone) ToLBBackendZone() loadbalancer.BackendZone
type ClusterService ¶
type ClusterService struct {
// Cluster is the cluster name the service is configured in
Cluster string `json:"cluster"`
// Namespace is the cluster namespace the service is configured in
Namespace string `json:"namespace"`
// Name is the name of the service. It must be unique within the
// namespace of the cluster
Name string `json:"name"`
// Frontends is a map indexed by the frontend IP address
Frontends map[string]PortConfiguration `json:"frontends"`
// Backends is map indexed by the backend IP address
Backends map[string]PortConfiguration `json:"backends"`
// Hostnames is map indexed by the backend IP address
Hostnames map[string]string `json:"hostnames,omitempty"`
// Zones is map indexed by the backend IP address
Zones map[string]BackendZone `json:"zones,omitempty"`
// Labels are the labels of the service
Labels map[string]string `json:"labels"`
// Selector is the label selector used to select backends
Selector map[string]string `json:"selector"`
// IncludeExternal is true when external endpoints from other clusters
// should be included
IncludeExternal bool `json:"includeExternal"`
Shared bool `json:"shared"`
// ClusterID is the cluster ID the service is configured in
ClusterID uint32 `json:"clusterID"`
}
ClusterService is the definition of a service in a cluster
WARNING - STABLE API: Any change to this structure must be done in a backwards compatible way.
+k8s:deepcopy-gen=true
func NewClusterService ¶
func NewClusterService(name, namespace string) ClusterService
NewClusterService returns a new cluster service definition
func (*ClusterService) DeepCopy ¶
func (in *ClusterService) DeepCopy() *ClusterService
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterService.
func (*ClusterService) DeepCopyInto ¶
func (in *ClusterService) DeepCopyInto(out *ClusterService)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*ClusterService) DeepKeyCopy ¶
func (s *ClusterService) DeepKeyCopy() store.LocalKey
DeepKeyCopy creates a deep copy of the LocalKey
func (*ClusterService) GetKeyName ¶
func (s *ClusterService) GetKeyName() string
GetKeyName returns the kvstore key to be used for the global service
func (*ClusterService) Marshal ¶
func (s *ClusterService) Marshal() ([]byte, error)
Marshal returns the global service object as JSON byte slice
func (*ClusterService) NamespaceServiceName ¶
func (s *ClusterService) NamespaceServiceName() types.NamespacedName
NamespaceServiceName returns the namespace and service name
func (*ClusterService) String ¶
func (s *ClusterService) String() string
type ForZone ¶ added in v1.19.0
type ForZone struct {
Name string `json:"name"`
}
ForZone provides information about which zones should consume this endpoint. We are using a struct similar to Kubernetes API to reduce the likelihood of introducing a breaking change.
WARNING - STABLE API: Changing the structure or values of this will break backwards compatibility
+k8s:deepcopy-gen=true
func (*ForZone) DeepCopy ¶ added in v1.19.0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ForZone.
func (*ForZone) DeepCopyInto ¶ added in v1.19.0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type PortConfiguration ¶
type PortConfiguration map[string]*loadbalancer.L4Addr
PortConfiguration is the L4 port configuration of a frontend or backend. The map is indexed by the name of the port and the value constains the L4 port and protocol.
+deepequal-gen=true
func (*PortConfiguration) DeepEqual ¶
func (in *PortConfiguration) DeepEqual(other *PortConfiguration) bool
DeepEqual is an autogenerated deepequal function, deeply comparing the receiver with other. in must be non-nil.
type ServiceMerger ¶
type ServiceMerger interface {
MergeClusterServiceUpdate(service *ClusterService, swg *lock.StoppableWaitGroup)
MergeClusterServiceDelete(service *ClusterService, swg *lock.StoppableWaitGroup)
}
ServiceMerger is the interface to be implemented by the owner of local services. The functions have to merge service updates and deletions with local services to provide a shared view.
type ValidatingClusterService ¶
type ValidatingClusterService struct {
ClusterService
// contains filtered or unexported fields
}
ValidatingClusterService wraps a ClusterService to perform additional validation at unmarshal time.