types

package
v1.17.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
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 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 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"`

	// 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"`
}

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

func (*MCSAPIServiceSpec) Unmarshal

func (s *MCSAPIServiceSpec) Unmarshal(_ string, data []byte) error

Unmarshal parses the JSON byte slice and updates the MCS-API Service Spec receiver

type ValidatingMCSAPIServiceSpec

type ValidatingMCSAPIServiceSpec struct {
	MCSAPIServiceSpec
	// contains filtered or unexported fields
}

ValidatingMCSAPIServiceSpec wraps a MCSAPIServiceSpec to perform additional validation at unmarshal time.

func (*ValidatingMCSAPIServiceSpec) Unmarshal

func (vcs *ValidatingMCSAPIServiceSpec) Unmarshal(key string, data []byte) error

Jump to

Keyboard shortcuts

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