model

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClusterIdPropertyName    = "cluster.clusterset.k8s.io"
	ClusterSetIdPropertyName = "clusterset.k8s.io"
)
View Source
const (
	EndpointIpv4Attr          = "AWS_INSTANCE_IPV4"
	EndpointPortAttr          = "AWS_INSTANCE_PORT"
	EndpointPortNameAttr      = "ENDPOINT_PORT_NAME"
	EndpointProtocolAttr      = "ENDPOINT_PROTOCOL"
	EndpointReadyAttr         = "READY"
	EndpointHostnameAttr      = "HOSTNAME"
	EndpointNodeNameAttr      = "NODENAME"
	ClusterIdAttr             = "CLUSTER_ID"
	ClusterSetIdAttr          = "CLUSTERSET_ID"
	ServicePortNameAttr       = "SERVICE_PORT_NAME"
	ServicePortAttr           = "SERVICE_PORT"
	ServiceTargetPortAttr     = "SERVICE_TARGET_PORT"
	ServiceProtocolAttr       = "SERVICE_PROTOCOL"
	ServiceTypeAttr           = "SERVICE_TYPE"
	ServiceExportCreationAttr = "SERVICE_EXPORT_CREATION_TIMESTAMP"
	K8sVersionAttr            = "K8S_CONTROLLER"
)

Cloudmap Instances IP and Port is supposed to be AWS_INSTANCE_IPV4 and AWS_INSTANCE_PORT Rest are custom attributes

Variables

This section is empty.

Functions

func EndpointIdFromIPAddressAndPort added in v0.2.0

func EndpointIdFromIPAddressAndPort(address string, port Port) string

EndpointIdFromIPAddressAndPort converts an IP address to human-readable identifier.

Types

type Changes

type Changes struct {
	// List of endpoints that need to be created
	Create []*Endpoint
	// List of endpoints that need to be updated
	Update []*Endpoint
	// List of endpoints that need to be deleted
	Delete []*Endpoint
}

func (*Changes) HasDeletes added in v0.2.0

func (c *Changes) HasDeletes() bool

func (*Changes) HasUpdates added in v0.2.0

func (c *Changes) HasUpdates() bool

func (*Changes) IsNone added in v0.2.0

func (c *Changes) IsNone() bool

type ClusterUtils added in v0.3.0

type ClusterUtils struct {
	// contains filtered or unexported fields
}

ClusterUtils provides utility functions for working with clusters

func NewClusterUtils added in v0.3.0

func NewClusterUtils(client client.Client) ClusterUtils

func NewClusterUtilsWithValues added in v0.3.0

func NewClusterUtilsWithValues(clusterId string, clusterSetId string) ClusterUtils

func (*ClusterUtils) GetClusterProperties added in v0.3.0

func (r *ClusterUtils) GetClusterProperties(ctx context.Context) (*clusterProperties, error)

func (*ClusterUtils) LoadClusterProperties added in v0.3.0

func (r *ClusterUtils) LoadClusterProperties(ctx context.Context) error

type Endpoint

type Endpoint struct {
	Id                             string
	IP                             string
	EndpointPort                   Port
	ServicePort                    Port
	ClusterId                      string
	ClusterSetId                   string
	ServiceType                    ServiceType
	ServiceExportCreationTimestamp int64
	Ready                          bool
	Hostname                       string
	Nodename                       string
	Attributes                     map[string]string
}

Endpoint holds basic values and attributes for an endpoint.

func NewEndpointFromInstance

func NewEndpointFromInstance(inst *types.HttpInstanceSummary) (*Endpoint, error)

NewEndpointFromInstance converts a Cloud Map HttpInstanceSummary to an endpoint.

func (*Endpoint) Equals

func (e *Endpoint) Equals(other *Endpoint) bool

Equals evaluates if two Endpoints are "deeply equal" (including all fields).

func (*Endpoint) GetCloudMapAttributes added in v0.1.1

func (e *Endpoint) GetCloudMapAttributes() map[string]string

GetCloudMapAttributes extracts endpoint attributes for Cloud Map service instance registration.

func (*Endpoint) String

func (e *Endpoint) String() string

String gives a string representation for an endpoint.

type Namespace added in v0.1.1

type Namespace struct {
	Id   string
	Name string
	Type NamespaceType
}

Namespace hold namespace attributes

type NamespaceType added in v0.1.1

type NamespaceType string
const (
	HttpNamespaceType       NamespaceType = "HTTP"
	DnsPrivateNamespaceType NamespaceType = "DNS_PRIVATE"
	// UnsupportedNamespaceType Placeholder NamespaceType to denote not supported values
	UnsupportedNamespaceType NamespaceType = ""
)

func ConvertNamespaceType added in v0.1.1

func ConvertNamespaceType(nsType types.NamespaceType) (namespaceType NamespaceType)

func (*NamespaceType) IsUnsupported added in v0.1.1

func (namespaceType *NamespaceType) IsUnsupported() bool

type Plan

type Plan struct {
	// List of current instances
	Current []*Endpoint

	// List of desired instances
	Desired []*Endpoint
}

func (*Plan) CalculateChanges

func (p *Plan) CalculateChanges() Changes

CalculateChanges returns list of Changes that need to applied

type Port added in v0.2.0

type Port struct {
	Name       string
	Port       int32
	TargetPort string
	Protocol   string // TCP, UDP, SCTP
}

func (*Port) Equals added in v0.2.2

func (p *Port) Equals(other *Port) bool

Equals evaluates if two Ports are "deeply equal" (including all fields).

func (*Port) GetID added in v0.2.0

func (p *Port) GetID() string

type Service

type Service struct {
	Namespace string
	Name      string
	Endpoints []*Endpoint
}

Service holds namespace and endpoint state for a named service.

func (*Service) GetEndpoints added in v0.3.1

func (svc *Service) GetEndpoints(clusterId string) (endpts []*Endpoint)

type ServiceType added in v0.3.0

type ServiceType string
const (
	HeadlessType     ServiceType = "Headless"
	ClusterSetIPType ServiceType = "ClusterSetIP"
)

func (ServiceType) String added in v0.3.0

func (serviceType ServiceType) String() string

Gives string representation for ServiceType

Jump to

Keyboard shortcuts

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