domain

package
v0.0.0-...-25adb8f Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigureSiteCredentials

func ConfigureSiteCredentials(site Site, ingressHosts ...string)

func CreateRouterServiceConfig

func CreateRouterServiceConfig(site Site, parentRouterConfig *qdr.RouterConfig, service Service) (*qdr.RouterConfig, string, error)

func GenerateLinkName

func GenerateLinkName(linkHandler LinkHandler) string

func GetTokenEndpoint

func GetTokenEndpoint(site Site, secret *corev1.Secret) (string, string)

func RouterConnectorNamesForEgress

func RouterConnectorNamesForEgress(address string, target AddressEgress) map[int]string

func ServiceRouterConfigAddTargets

func ServiceRouterConfigAddTargets(site Site, svcRouterConfig *qdr.RouterConfig, service Service, egressResolver EgressResolver) error

func ServiceRouterConfigRemoveTargets

func ServiceRouterConfigRemoveTargets(svcRouterConfig *qdr.RouterConfig, service Service, egressResolver EgressResolver) error

func ValidateService

func ValidateService(service Service) error

func VerifyNotSelfOrDuplicate

func VerifyNotSelfOrDuplicate(secret corev1.Secret, self string, linkHandler LinkHandler) error

func VerifySecretCompatibility

func VerifySecretCompatibility(localSiteVersion string, secret corev1.Secret) error

VerifySecretCompatibility returns nil if current site version is compatible with the token or cert provided. If sites are not compatible an error is returned with the appropriate information

func VerifySiteCompatibility

func VerifySiteCompatibility(localSiteVersion, remoteSiteVersion string) error

VerifySiteCompatibility returns nil if current site version is compatible with the provided version, otherwise it returns a clear error.

func VerifyToken

func VerifyToken(secret *v1.Secret) error

Types

type AddressEgress

type AddressEgress interface {
	GetHost() string
	SetHost(host string)
	GetPorts() map[int]int
	SetPorts(ports map[int]int)
}

type AddressEgressCommon

type AddressEgressCommon struct {
	Host  string
	Ports map[int]int
}

func (*AddressEgressCommon) GetHost

func (a *AddressEgressCommon) GetHost() string

func (*AddressEgressCommon) GetPorts

func (a *AddressEgressCommon) GetPorts() map[int]int

func (*AddressEgressCommon) SetHost

func (a *AddressEgressCommon) SetHost(host string)

func (*AddressEgressCommon) SetPorts

func (a *AddressEgressCommon) SetPorts(ports map[int]int)

type AddressIngress

type AddressIngress interface {
	GetHost() string
	SetHost(host string)
	GetPorts() map[int]int
	SetPorts(ports map[int]int)
}

type AddressIngressCommon

type AddressIngressCommon struct {
	Host  string
	Ports map[int]int
}

func (*AddressIngressCommon) GetHost

func (a *AddressIngressCommon) GetHost() string

func (*AddressIngressCommon) GetPorts

func (a *AddressIngressCommon) GetPorts() map[int]int

func (*AddressIngressCommon) SetHost

func (a *AddressIngressCommon) SetHost(host string)

func (*AddressIngressCommon) SetPorts

func (a *AddressIngressCommon) SetPorts(ports map[int]int)

type ClaimRedeemer

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

func NewClaimRedeemer

func NewClaimRedeemer(name, siteId, siteVersion string, secretUpdater SecretUpdateFn, event EventLogger) *ClaimRedeemer

func (*ClaimRedeemer) RedeemClaim

func (c *ClaimRedeemer) RedeemClaim(claim *corev1.Secret) error

type Controller

type Controller struct {
	Image         string
	Env           map[string]string
	Labels        map[string]string
	SiteIngresses []SiteIngress
	MemoryLimit   int64
	Cpus          int
}

func (*Controller) GetCpus

func (s *Controller) GetCpus() int

func (*Controller) GetEnv

func (s *Controller) GetEnv() map[string]string

func (*Controller) GetImage

func (s *Controller) GetImage() string

func (*Controller) GetLabels

func (s *Controller) GetLabels() map[string]string

func (*Controller) GetMemoryLimit

func (s *Controller) GetMemoryLimit() int64

func (*Controller) GetSiteIngresses

func (s *Controller) GetSiteIngresses() []SiteIngress

func (*Controller) Name

func (s *Controller) Name() string

func (*Controller) SetImage

func (s *Controller) SetImage(image string)

type EgressResolver

type EgressResolver interface {
	// String returns an expression representing selectable targets
	String() string
	Resolve() ([]AddressEgress, error)
}

func EgressResolverFromString

func EgressResolverFromString(data string) EgressResolver

EgressResolverFromString returns an EgressResolver based on provided string representation

type EgressResolverHost

type EgressResolverHost struct {
	Host  string      `json:"host"`
	Ports map[int]int `json:"ports"`
}

func (*EgressResolverHost) Resolve

func (e *EgressResolverHost) Resolve() ([]AddressEgress, error)

func (*EgressResolverHost) String

func (e *EgressResolverHost) String() string

type EventLogger

type EventLogger func(name string, format string, args ...interface{})

type FlowCollector

type FlowCollector struct {
	Image         string
	Env           map[string]string
	Labels        map[string]string
	SiteIngresses []SiteIngress
	MemoryLimit   int64
	Cpus          int
}

func (*FlowCollector) GetCpus

func (r *FlowCollector) GetCpus() int

func (*FlowCollector) GetEnv

func (r *FlowCollector) GetEnv() map[string]string

func (*FlowCollector) GetImage

func (r *FlowCollector) GetImage() string

func (*FlowCollector) GetLabels

func (r *FlowCollector) GetLabels() map[string]string

func (*FlowCollector) GetMemoryLimit

func (r *FlowCollector) GetMemoryLimit() int64

func (*FlowCollector) GetSiteIngresses

func (r *FlowCollector) GetSiteIngresses() []SiteIngress

func (*FlowCollector) Name

func (r *FlowCollector) Name() string

func (*FlowCollector) SetImage

func (r *FlowCollector) SetImage(image string)

type LinkHandler

type LinkHandler interface {
	Create(secret *corev1.Secret, name string, cost int) error
	Delete(name string) error
	List() ([]*corev1.Secret, error)
	StatusAll() ([]types.LinkStatus, error)
	Status(name string) (types.LinkStatus, error)
	Detail(link types.LinkStatus) (map[string]string, error)
	RemoteLinks(ctx context.Context) ([]*network.RemoteLinkInfo, error)
}

type Port

type Port interface {
	GetName() string
	GetPort() int
}

type PortCommon

type PortCommon struct {
	Name string
	Port int
}

func (*PortCommon) GetName

func (p *PortCommon) GetName() string

func (*PortCommon) GetPort

func (p *PortCommon) GetPort() int

type Prometheus

type Prometheus struct {
	Image         string
	Env           map[string]string
	Labels        map[string]string
	SiteIngresses []SiteIngress
	MemoryLimit   int64
	Cpus          int
}

func (*Prometheus) GetCpus

func (s *Prometheus) GetCpus() int

func (*Prometheus) GetEnv

func (s *Prometheus) GetEnv() map[string]string

func (*Prometheus) GetImage

func (s *Prometheus) GetImage() string

func (*Prometheus) GetLabels

func (s *Prometheus) GetLabels() map[string]string

func (*Prometheus) GetMemoryLimit

func (s *Prometheus) GetMemoryLimit() int64

func (*Prometheus) GetSiteIngresses

func (s *Prometheus) GetSiteIngresses() []SiteIngress

func (*Prometheus) Name

func (s *Prometheus) Name() string

func (*Prometheus) SetImage

func (s *Prometheus) SetImage(image string)

type Router

type Router struct {
	Image         string
	Env           map[string]string
	Labels        map[string]string
	SiteIngresses []SiteIngress
	MemoryLimit   int64
	Cpus          int
}

func (*Router) GetCpus

func (r *Router) GetCpus() int

func (*Router) GetEnv

func (r *Router) GetEnv() map[string]string

func (*Router) GetImage

func (r *Router) GetImage() string

func (*Router) GetLabels

func (r *Router) GetLabels() map[string]string

func (*Router) GetMemoryLimit

func (r *Router) GetMemoryLimit() int64

func (*Router) GetSiteIngresses

func (r *Router) GetSiteIngresses() []SiteIngress

func (*Router) Name

func (r *Router) Name() string

func (*Router) SetImage

func (r *Router) SetImage(image string)

type RouterEntityManager

type RouterEntityManager interface {
	CreateSslProfile(sslProfile qdr.SslProfile) error
	DeleteSslProfile(name string) error
	CreateConnector(connector qdr.Connector) error
	DeleteConnector(name string) error
	QueryAllRouters() ([]qdr.Router, error)
	QueryRouterNodes() ([]qdr.RouterNode, error)
	QueryEdgeRouters() ([]qdr.Router, error)
	QueryConnections(routerId string, edge bool) ([]qdr.Connection, error)
	CreateTcpConnector(tcpConnector qdr.TcpEndpoint) error
	DeleteTcpConnector(name string) error
	CreateHttpConnector(httpConnector qdr.HttpEndpoint) error
	DeleteHttpConnector(name string) error
}

RouterEntityManager manipulates runtime entities

type SecretUpdateFn

type SecretUpdateFn func(claim *corev1.Secret) error

type Service

type Service interface {
	GetAddress() string
	SetAddress(address string)
	GetProtocol() string
	SetProtocol(protocol string)
	GetPorts() []int
	SetPorts(ports []int)
	IsEventChannel() bool
	SetEventChannel(eventChannel bool)
	GetAggregate() string
	SetAggregate(strategy string)
	GetLabels() map[string]string
	SetLabels(labels map[string]string)
	GetOrigin() string
	SetOrigin(origin string)
	IsTls() bool
	GetTlsCredentials() string
	SetTlsCredentials(credential string)
	GetTlsCertAuthority() string
	SetTlsCertAuthority(ca string)
	GetIngress() AddressIngress
	SetIngress(ingress AddressIngress)
	GetEgressResolvers() []EgressResolver
	AddEgressResolver(resolver EgressResolver)
	SetEgressResolvers(resolvers []EgressResolver)
}

Service defines a generic representation of a Skupper service

type ServiceCommon

type ServiceCommon struct {
	Address          string
	Protocol         string
	Ports            []int
	EventChannel     bool
	Aggregate        string
	Labels           map[string]string
	Origin           string
	TlsCredentials   string
	TlsCertAuthority string
	Ingress          AddressIngress
	EgressResolvers  []EgressResolver
}

func (*ServiceCommon) AddEgressResolver

func (s *ServiceCommon) AddEgressResolver(resolver EgressResolver)

func (*ServiceCommon) GetAddress

func (s *ServiceCommon) GetAddress() string

func (*ServiceCommon) GetAggregate

func (s *ServiceCommon) GetAggregate() string

func (*ServiceCommon) GetEgressResolvers

func (s *ServiceCommon) GetEgressResolvers() []EgressResolver

func (*ServiceCommon) GetIngress

func (s *ServiceCommon) GetIngress() AddressIngress

func (*ServiceCommon) GetLabels

func (s *ServiceCommon) GetLabels() map[string]string

func (*ServiceCommon) GetOrigin

func (s *ServiceCommon) GetOrigin() string

func (*ServiceCommon) GetPorts

func (s *ServiceCommon) GetPorts() []int

func (*ServiceCommon) GetProtocol

func (s *ServiceCommon) GetProtocol() string

func (*ServiceCommon) GetTlsCertAuthority

func (s *ServiceCommon) GetTlsCertAuthority() string

func (*ServiceCommon) GetTlsCredentials

func (s *ServiceCommon) GetTlsCredentials() string

func (*ServiceCommon) IsEventChannel

func (s *ServiceCommon) IsEventChannel() bool

func (*ServiceCommon) IsTls

func (s *ServiceCommon) IsTls() bool

func (*ServiceCommon) SetAddress

func (s *ServiceCommon) SetAddress(address string)

func (*ServiceCommon) SetAggregate

func (s *ServiceCommon) SetAggregate(strategy string)

func (*ServiceCommon) SetEgressResolvers

func (s *ServiceCommon) SetEgressResolvers(resolvers []EgressResolver)

func (*ServiceCommon) SetEventChannel

func (s *ServiceCommon) SetEventChannel(eventChannel bool)

func (*ServiceCommon) SetIngress

func (s *ServiceCommon) SetIngress(ingress AddressIngress)

func (*ServiceCommon) SetLabels

func (s *ServiceCommon) SetLabels(labels map[string]string)

func (*ServiceCommon) SetOrigin

func (s *ServiceCommon) SetOrigin(origin string)

func (*ServiceCommon) SetPorts

func (s *ServiceCommon) SetPorts(ports []int)

func (*ServiceCommon) SetProtocol

func (s *ServiceCommon) SetProtocol(protocol string)

func (*ServiceCommon) SetTlsCertAuthority

func (s *ServiceCommon) SetTlsCertAuthority(ca string)

func (*ServiceCommon) SetTlsCredentials

func (s *ServiceCommon) SetTlsCredentials(credential string)

type ServiceHandler

type ServiceHandler interface {
	Create(service Service) error
	Delete(address string) error
	Get(address string) (Service, error)
	List() ([]Service, error)
	AddEgressResolver(address string, egressResolver EgressResolver) error
	RemoveEgressResolver(address string, egressResolver EgressResolver) error
	RemoveAllEgressResolvers(address string) error
}

ServiceHandler generic interface to manipulate services across platforms

type Site

type Site interface {
	GetName() string
	GetId() string
	GetVersion() string
	GetMode() string
	GetPlatform() string
	GetCertAuthorities() []types.CertAuthority
	SetCertAuthorities(cas []types.CertAuthority)
	GetCredentials() []types.Credential
	SetCredentials(credentials []types.Credential)
	GetIngressClasses() []string
	GetDeployments() []SkupperDeployment
	SetDeployments(deployments []SkupperDeployment)
}

type SiteCommon

type SiteCommon struct {
	Name            string
	Id              string
	Version         string
	Mode            string
	Platform        string
	CertAuthorities []types.CertAuthority
	Credentials     []types.Credential
	Deployments     []SkupperDeployment
}

SiteCommon base implementation of the Site interface

func (*SiteCommon) GetCertAuthorities

func (s *SiteCommon) GetCertAuthorities() []types.CertAuthority

func (*SiteCommon) GetCredentials

func (s *SiteCommon) GetCredentials() []types.Credential

func (*SiteCommon) GetDeployments

func (s *SiteCommon) GetDeployments() []SkupperDeployment

func (*SiteCommon) GetId

func (s *SiteCommon) GetId() string

func (*SiteCommon) GetMode

func (s *SiteCommon) GetMode() string

func (*SiteCommon) GetName

func (s *SiteCommon) GetName() string

func (*SiteCommon) GetVersion

func (s *SiteCommon) GetVersion() string

func (*SiteCommon) IsEdge

func (s *SiteCommon) IsEdge() bool

func (*SiteCommon) SetCertAuthorities

func (s *SiteCommon) SetCertAuthorities(cas []types.CertAuthority)

func (*SiteCommon) SetCredentials

func (s *SiteCommon) SetCredentials(credentials []types.Credential)

func (*SiteCommon) SetDeployments

func (s *SiteCommon) SetDeployments(deployments []SkupperDeployment)

func (*SiteCommon) ValidateMinimumRequirements

func (s *SiteCommon) ValidateMinimumRequirements() error

type SiteHandler

type SiteHandler interface {
	Create(ctx context.Context, s Site) error
	Get() (Site, error)
	Delete() error
	Update() error
	RevokeAccess() error
}

type SiteIngress

type SiteIngress interface {
	GetName() string
	GetHost() string
	GetPort() int
	GetTarget() Port
}

type SiteIngressCommon

type SiteIngressCommon struct {
	Name   string
	Host   string
	Port   int
	Target *PortCommon
}

SiteIngressCommon Partial implementation of SiteIngress

func (*SiteIngressCommon) GetHost

func (s *SiteIngressCommon) GetHost() string

func (*SiteIngressCommon) GetName

func (s *SiteIngressCommon) GetName() string

func (*SiteIngressCommon) GetPort

func (s *SiteIngressCommon) GetPort() int

func (*SiteIngressCommon) GetTarget

func (s *SiteIngressCommon) GetTarget() Port

type SkupperComponent

type SkupperComponent interface {
	Name() string
	GetImage() string
	SetImage(image string)
	GetEnv() map[string]string
	GetLabels() map[string]string
	GetSiteIngresses() []SiteIngress
	GetMemoryLimit() int64
	GetCpus() int
}

type SkupperComponentHandler

type SkupperComponentHandler interface {
	Get(name string) (SkupperComponent, error)
	List() ([]SkupperComponent, error)
}

type SkupperDeployment

type SkupperDeployment interface {
	GetName() string
	GetComponents() []SkupperComponent
}

type SkupperDeploymentCommon

type SkupperDeploymentCommon struct {
	Components []SkupperComponent
}

func (*SkupperDeploymentCommon) GetComponents

func (s *SkupperDeploymentCommon) GetComponents() []SkupperComponent

type SkupperDeploymentHandler

type SkupperDeploymentHandler interface {
	Deploy(ctx context.Context, deployment SkupperDeployment) error
	List() ([]SkupperDeployment, error)
	Undeploy(name string) error
}

type TokenCertHandler

type TokenCertHandler interface {
	Create(filename, subject string, info *TokenCertInfo, site Site, credHandler types.CredentialHandler) error
}

type TokenCertInfo

type TokenCertInfo struct {
	InterRouterHost string
	InterRouterPort string
	EdgeHost        string
	EdgePort        string
}

func (*TokenCertInfo) GetHosts

func (t *TokenCertInfo) GetHosts() string

type UpdatePriority

type UpdatePriority int
const (
	PriorityFirst UpdatePriority = iota
	PriorityNormal
	PriorityLast
)

type UpdateProcessor

type UpdateProcessor struct {
	Verbose bool
	DryRun  bool
	Timeout time.Duration
	// contains filtered or unexported fields
}

func (*UpdateProcessor) Printf

func (p *UpdateProcessor) Printf(format string, a ...any)

func (*UpdateProcessor) Println

func (p *UpdateProcessor) Println(a ...any)

func (*UpdateProcessor) Process

func (p *UpdateProcessor) Process(ctx context.Context, siteVersion string) error

func (*UpdateProcessor) RegisterTasks

func (p *UpdateProcessor) RegisterTasks(task ...UpdateTask)

RegisterTasks registers tasks to be evaluated and processed

type UpdateResult

type UpdateResult struct {
	Errors []error

	PostTasks []UpdateTask
	// contains filtered or unexported fields
}

UpdateResult contains errors, warnings and changes applied by tasks. It also contains a set of PostTasks that can be populated by tasks. The PostTasks will only be evaluated after all main tasks complete.

func (*UpdateResult) AddChange

func (u *UpdateResult) AddChange(change ...string)

func (*UpdateResult) AddErrors

func (u *UpdateResult) AddErrors(err ...error)

func (*UpdateResult) AddWarnings

func (u *UpdateResult) AddWarnings(msg ...string)

func (*UpdateResult) Changed

func (u *UpdateResult) Changed() bool

func (*UpdateResult) GetChanges

func (u *UpdateResult) GetChanges() []string

func (*UpdateResult) GetWarnings

func (u *UpdateResult) GetWarnings() []string

type UpdateTask

type UpdateTask interface {
	// Info describes the update task
	Info() string
	// AppliesTo determines whether it should be executed or not
	AppliesTo(siteVersion string) bool
	// Version returns the version it has been introduced (use * when not constrained to a given version)
	Version() string
	// Priority determines how tasks will be sorted by the UpdateProcessor
	Priority() UpdatePriority
	// Run method is where the update task is done
	Run(ctx context.Context) *UpdateResult
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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