controllers

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2022 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	K8sVersionAttr            = "K8S_CONTROLLER"
	ServiceExportFinalizer    = "multicluster.k8s.aws/service-export-finalizer"
	EndpointSliceServiceLabel = "kubernetes.io/service-name"
)
View Source
const (
	// DerivedServiceAnnotation annotates a ServiceImport with derived Service name
	DerivedServiceAnnotation = "multicluster.k8s.aws/derived-service"

	// LabelServiceImportName indicates the name of the multi-cluster service that an EndpointSlice belongs to.
	LabelServiceImportName = "multicluster.kubernetes.io/service-name"
)

Variables

This section is empty.

Functions

func CreateDerivedServiceStruct added in v0.2.2

func CreateDerivedServiceStruct(svcImport *v1alpha1.ServiceImport, importedSvcPorts []*model.Port) *v1.Service

CreateDerivedServiceStruct creates struct representation of a derived service

func CreateEndpointForSlice added in v0.2.2

func CreateEndpointForSlice(svc *v1.Service, ip string) discovery.Endpoint

func CreateEndpointSliceStruct added in v0.2.2

func CreateEndpointSliceStruct(svc *v1.Service, svcImportName string) *discovery.EndpointSlice

func CreateServiceImportStruct added in v0.2.2

func CreateServiceImportStruct(namespace string, name string, servicePorts []*model.Port) *v1alpha1.ServiceImport

CreateServiceImportStruct creates struct representation of a ServiceImport

func DerivedName

func DerivedName(namespace string, name string) string

DerivedName computes the "placeholder" name for an imported service

func EndpointPortToPort added in v0.2.0

func EndpointPortToPort(port discovery.EndpointPort) model.Port

EndpointPortToPort converts a k8s endpoint port to an internal model port

func ExtractEndpointPorts added in v0.2.2

func ExtractEndpointPorts(endpoints []*model.Endpoint) (endpointPorts []*model.Port)

ExtractEndpointPorts extracts all unique endpoint ports from a slice of endpoints

func ExtractServicePorts added in v0.2.2

func ExtractServicePorts(endpoints []*model.Endpoint) (servicePorts []*model.Port)

ExtractServicePorts extracts all unique service ports from a slice of endpoints

func PortToEndpointPort added in v0.2.0

func PortToEndpointPort(port model.Port) discovery.EndpointPort

PortToEndpointPort converts an internal model port to a k8s endpoint port

func PortToServiceImportPort added in v0.2.2

func PortToServiceImportPort(port model.Port) v1alpha1.ServicePort

PortToServiceImportPort converts an internal model port to a service import port

func PortToServicePort added in v0.2.0

func PortToServicePort(port model.Port) v1.ServicePort

PortToServicePort converts an internal model port to a k8s service port

func PortsEqualIgnoreOrder added in v0.2.2

func PortsEqualIgnoreOrder(a, b []*model.Port) (equal bool)

func ServiceImportPortToPort added in v0.2.2

func ServiceImportPortToPort(svcPort v1alpha1.ServicePort) model.Port

ServiceImportPortToPort converts a service import port to an internal model port

func ServicePortToPort added in v0.2.0

func ServicePortToPort(svcPort v1.ServicePort) model.Port

ServicePortToPort converts a k8s service port to internal model port

Types

type CloudMapReconciler

type CloudMapReconciler struct {
	Client   client.Client
	Cloudmap cloudmap.ServiceDiscoveryClient
	Log      common.Logger
}

CloudMapReconciler reconciles state of Cloud Map services with local ServiceImport objects

func (*CloudMapReconciler) Reconcile

func (r *CloudMapReconciler) Reconcile(ctx context.Context) error

Reconcile triggers a single reconciliation round

func (*CloudMapReconciler) Start

func (r *CloudMapReconciler) Start(ctx context.Context) error

Start implements manager.Runnable

type EndpointSliceChanges added in v0.2.2

type EndpointSliceChanges struct {
	// Create: List of EndpointSlices that need to be created
	Create []*discovery.EndpointSlice
	// Update: List of EndpointSlices that need to be updated
	Update []*discovery.EndpointSlice
	// Delete: List of EndpointSlices that need to be deleted
	Delete []*discovery.EndpointSlice
	// Unmodified: List of EndpointSlices that do not need to be changed
	Unmodified []*discovery.EndpointSlice
}

type EndpointSlicePlan added in v0.2.2

type EndpointSlicePlan struct {

	// Service to reconcile endpoints in
	Service *v1.Service

	// ServiceImportName name used to create new EndpointSlices
	ServiceImportName string

	// Current EndpontSlices
	Current []*discovery.EndpointSlice

	// Desired Endpoints
	Desired []*model.Endpoint
	// contains filtered or unexported fields
}

func (*EndpointSlicePlan) CalculateChanges added in v0.2.2

func (p *EndpointSlicePlan) CalculateChanges() EndpointSliceChanges

CalculateChanges returns list of EndpointSlice Changes that need to applied

type ServiceExportReconciler

type ServiceExportReconciler struct {
	Client   client.Client
	Log      common.Logger
	Scheme   *runtime.Scheme
	CloudMap cloudmap.ServiceDiscoveryClient
}

ServiceExportReconciler reconciles a ServiceExport object

func (*ServiceExportReconciler) Reconcile

func (r *ServiceExportReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*ServiceExportReconciler) SetupWithManager

func (r *ServiceExportReconciler) SetupWithManager(mgr ctrl.Manager) error

Jump to

Keyboard shortcuts

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