Documentation
¶
Index ¶
- Variables
- func ClusterNameValidator(clusterName string) mcsAPIServiceSpecValidator
- func IPFamiliesFromString(s string) ([]corev1.IPFamily, error)
- func IPFamiliesToString(ipfamilies []corev1.IPFamily) string
- func KeyCreator(validators ...mcsAPIServiceSpecValidator) store.KeyCreator
- func NamespacedNameValidator() mcsAPIServiceSpecValidator
- type MCSAPIConfig
- type MCSAPIServiceSpec
- type ValidatingMCSAPIServiceSpec
Constants ¶
This section is empty.
Variables ¶
var DefaultMCSAPIConfig = MCSAPIConfig{ EnableMCSAPI: false, InstallCRDs: true, }
var ( // ServiceExportStorePrefix is the kvstore prefix of the shared store // // WARNING - STABLE API: Changing the structure or values of this will // break backwards compatibility ServiceExportStorePrefix = path.Join(kvstore.BaseKeyPrefix, "state", "serviceexports", "v1") )
Functions ¶
func ClusterNameValidator ¶
func ClusterNameValidator(clusterName string) mcsAPIServiceSpecValidator
ClusterNameValidator returns a validator enforcing that the cluster field of the unmarshaled service matches the provided one.
func IPFamiliesFromString ¶ added in v1.19.0
func IPFamiliesToString ¶ added in v1.19.0
func KeyCreator ¶
func KeyCreator(validators ...mcsAPIServiceSpecValidator) store.KeyCreator
KeyCreator returns a store.KeyCreator for MCSAPIServiceSpec, configuring the specified extra validators.
func NamespacedNameValidator ¶
func NamespacedNameValidator() mcsAPIServiceSpecValidator
NamespacedNameValidator returns a validator enforcing that the namespaced name of the unmarshaled mcs service spec matches the kvstore key.
Types ¶
type MCSAPIConfig ¶ added in v1.19.0
type MCSAPIConfig struct {
// EnableMCSAPI enables the MCS API support
EnableMCSAPI bool `mapstructure:"clustermesh-enable-mcs-api"`
// InstallCRDs control whether to automatically install the MCS API CRDs
// conditional on EnableMCSAPI being true
InstallCRDs bool `mapstructure:"clustermesh-mcs-api-install-crds"`
}
MCSAPIConfig contains the configuration for MCS-API
func (MCSAPIConfig) Flags ¶ added in v1.19.0
func (cfg MCSAPIConfig) Flags(flags *pflag.FlagSet)
Flags adds the flags used by ClientConfig.
func (MCSAPIConfig) ShouldInstallMCSAPICrds ¶ added in v1.19.0
func (cfg MCSAPIConfig) ShouldInstallMCSAPICrds() bool
type MCSAPIServiceSpec ¶
type MCSAPIServiceSpec struct {
// Cluster is the cluster name the service is configured in
Cluster string `json:"cluster"`
// Name is the name of the ServiceImport or ServiceExport parent resources.
Name string `json:"name"`
// Namespace is the cluster namespace the service is configured in
Namespace string `json:"namespace"`
// Annotations contains the exported annotations
Annotations map[string]string `json:"annotations,omitempty"`
// Labels contains the exported labels
Labels map[string]string `json:"labels,omitempty"`
// LegacyLabels contains the exported labels.
// Deprecated: Use Labels instead, this is kept for backward compatibility
LegacyLabels map[string]string `json:"Labels,omitempty"`
// LegacyAnnotations contains the exported annotations.
// Deprecated: Use Annotations instead, this is kept for backward compatibility
LegacyAnnotations map[string]string `json:"Annotations,omitempty"`
// ExportCreationTimestamp is the timestamp representing when the
// ServiceExport object was created. It is used for conflict resolution.
ExportCreationTimestamp metav1.Time `json:"exportCreationTimestamp"`
// Ports are the list of ports of the Service in MCS API format
Ports []mcsapiv1alpha1.ServicePort `json:"ports"`
// Type defines the type of this service.
// Must be ClusterSetIP or Headless.
Type mcsapiv1alpha1.ServiceImportType `json:"type"`
// Supports "ClientIP" and "None". Used to maintain session affinity.
// Enable client IP based session affinity.
// Must be ClientIP or None.
// Defaults to None.
// Ignored when type is Headless
// More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies
SessionAffinity corev1.ServiceAffinity `json:"sessionAffinity"`
// SessionAffinityConfig contains session affinity configuration.
SessionAffinityConfig *corev1.SessionAffinityConfig `json:"sessionAffinityConfig,omitempty"`
// IPFamilies identifies all the IPFamilies assigned for this ServiceImport.
IPFamilies []corev1.IPFamily `json:"ipFamilies,omitempty"`
// InternalTrafficPolicy describes how nodes distribute service traffic they
// receive on the ClusterIP. If set to "Local", the proxy will assume that pods
// only want to talk to endpoints of the service on the same node as the pod,
// dropping the traffic if there are no local endpoints. The default value,
// "Cluster", uses the standard behavior of routing to all endpoints evenly
// (possibly modified by topology and other features).
InternalTrafficPolicy *corev1.ServiceInternalTrafficPolicy `json:"internalTrafficPolicy,omitempty"`
// TrafficDistribution offers a way to express preferences for how traffic
// is distributed to Service endpoints. Implementations can use this field
// as a hint, but are not required to guarantee strict adherence. If the
// field is not set, the implementation will apply its default routing
// strategy. If set to "PreferClose", implementations should prioritize
// endpoints that are in the same zone.
TrafficDistribution *string `json:"trafficDistribution,omitempty"`
}
func FromCiliumServiceToMCSAPIServiceSpec ¶
func FromCiliumServiceToMCSAPIServiceSpec(clusterName string, svc *slim_corev1.Service, svcExport *mcsapiv1alpha1.ServiceExport) *MCSAPIServiceSpec
func NewEmptyMCSAPIServiceSpec ¶
func NewEmptyMCSAPIServiceSpec(clusterName, namespace, name string) *MCSAPIServiceSpec
NewEmptyMCSAPIServiceSpec returns a MCSAPIServiceSpec with only the fields needed to retrieve from the kvstore
func (*MCSAPIServiceSpec) GetKeyName ¶
func (s *MCSAPIServiceSpec) GetKeyName() string
GetKeyName returns the kvstore key to be used for MCSAPIServiceSpec
func (*MCSAPIServiceSpec) Marshal ¶
func (s *MCSAPIServiceSpec) Marshal() ([]byte, error)
Marshal returns the MCS-API Service Spec object as JSON byte slice
func (*MCSAPIServiceSpec) NamespacedName ¶
func (s *MCSAPIServiceSpec) NamespacedName() types.NamespacedName
NamespaceServiceName returns the namespace and service name
type ValidatingMCSAPIServiceSpec ¶
type ValidatingMCSAPIServiceSpec struct {
MCSAPIServiceSpec
// contains filtered or unexported fields
}
ValidatingMCSAPIServiceSpec wraps a MCSAPIServiceSpec to perform additional validation at unmarshal time.