Documentation
¶
Index ¶
- Constants
- Variables
- func ErrorIsOkToSendToClient(err error) bool
- func NewServiceLog(name string, stream io.ReadCloser) *ctypes.ServiceLog
- func NewSimpleHostnames() ctypes.HostnameServiceClient
- func TieContextToChannel(parentCtx context.Context, donech <-chan struct{}) (context.Context, context.CancelFunc)
- type Client
- type Cluster
- type Config
- type ReadClient
- type ReservationResult
- type Service
- type SimpleHostnames
- func (sh *SimpleHostnames) CanReserveHostnames(hostnames []string, ownerAddr sdktypes.Address) error
- func (sh *SimpleHostnames) PrepareHostnamesForTransfer(ctx context.Context, hostnames []string, leaseID mtypes.LeaseID) error
- func (sh *SimpleHostnames) ReleaseHostnames(leaseID mtypes.LeaseID) error
- func (sh *SimpleHostnames) ReserveHostnames(ctx context.Context, hostnames []string, leaseID mtypes.LeaseID) ([]string, error)
- type StatusClient
Constants ¶
View Source
const HostnameSeparator = '.'
Variables ¶
View Source
var ( ErrExec = errors.New("remote command execute error") ErrExecNoServiceWithName = fmt.Errorf("%w: no such service exists with that name", ErrExec) ErrExecServiceNotRunning = fmt.Errorf("%w: service with that name is not running", ErrExec) ErrExecCommandExecutionFailed = fmt.Errorf("%w: command execution failed", ErrExec) ErrExecCommandDoesNotExist = fmt.Errorf("%w: command could not be executed because it does not exist", ErrExec) ErrExecDeploymentNotYetRunning = fmt.Errorf("%w: deployment is not yet active", ErrExec) ErrExecPodIndexOutOfRange = fmt.Errorf("%w: pod index out of range", ErrExec) ErrUnknownStorageClass = errors.New("inventory: unknown storage class") )
Errors types returned by the Exec function on the client interface
View Source
var ( ErrNotRunning = errors.New("not running") ErrInvalidResource = errors.New("invalid resource") )
ErrNotRunning is an error when service is not running
View Source
var ErrHostnameNotAllowed = errors.New("hostname not allowed")
View Source
var (
ErrLeaseInactive = errors.New("inactive Lease")
)
Functions ¶
func ErrorIsOkToSendToClient ¶
func NewServiceLog ¶
func NewServiceLog(name string, stream io.ReadCloser) *ctypes.ServiceLog
NewServiceLog creates and returns a service log with provided details
func NewSimpleHostnames ¶
func NewSimpleHostnames() ctypes.HostnameServiceClient
func TieContextToChannel ¶
Types ¶
type Client ¶
type Client interface {
ReadClient
Deploy(ctx context.Context, deployment ctypes.IDeployment) error
TeardownLease(context.Context, mtypes.LeaseID) error
Deployments(context.Context) ([]ctypes.IDeployment, error)
Exec(ctx context.Context,
lID mtypes.LeaseID,
service string,
podIndex uint,
cmd []string,
stdin io.Reader,
stdout io.Writer,
stderr io.Writer,
tty bool,
tsq remotecommand.TerminalSizeQueue) (ctypes.ExecResult, error)
// ConnectHostnameToDeployment Connect a given hostname to a deployment
ConnectHostnameToDeployment(ctx context.Context, directive chostname.ConnectToDeploymentDirective) error
// RemoveHostnameFromDeployment Remove a given hostname from a deployment
RemoveHostnameFromDeployment(ctx context.Context, hostname string, leaseID mtypes.LeaseID, allowMissing bool) error
// DeclareHostname Declare that a given deployment should be connected to a given hostname
DeclareHostname(ctx context.Context, lID mtypes.LeaseID, host string, serviceName string, externalPort uint32) error
// PurgeDeclaredHostnames Purge any hostnames associated with a given deployment
PurgeDeclaredHostnames(ctx context.Context, lID mtypes.LeaseID) error
PurgeDeclaredHostname(ctx context.Context, lID mtypes.LeaseID, hostname string) error
// KubeVersion returns the version information of kubernetes running in the cluster
KubeVersion() (*version.Info, error)
DeclareIP(ctx context.Context, lID mtypes.LeaseID, serviceName string, port uint32, externalPort uint32, proto mani.ServiceProtocol, sharingKey string, overwrite bool) error
PurgeDeclaredIP(ctx context.Context, lID mtypes.LeaseID, serviceName string, externalPort uint32, proto mani.ServiceProtocol) error
PurgeDeclaredIPs(ctx context.Context, lID mtypes.LeaseID) error
}
Client interface lease and deployment methods
type Cluster ¶
type Cluster interface {
Reserve(mtypes.OrderID, dtypes.ResourceGroup) (ctypes.Reservation, error)
Unreserve(mtypes.OrderID) error
}
Cluster is the interface that wraps Reserve and Unreserve methods
type Config ¶
type Config struct {
InventoryResourcePollPeriod time.Duration
InventoryResourceDebugFrequency uint
InventoryExternalPortQuantity uint
CPUCommitLevel float64
GPUCommitLevel float64
MemoryCommitLevel float64
StorageCommitLevel float64
BlockedHostnames []string
DeploymentIngressStaticHosts bool
DeploymentIngressDomain string
MonitorMaxRetries uint
MonitorRetryPeriod time.Duration
MonitorRetryPeriodJitter time.Duration
MonitorHealthcheckPeriod time.Duration
MonitorHealthcheckPeriodJitter time.Duration
ClusterSettings map[interface{}]interface{}
}
func NewDefaultConfig ¶
func NewDefaultConfig() Config
type ReadClient ¶
type ReadClient interface {
LeaseStatus(context.Context, mtypes.LeaseID) (map[string]*apclient.ServiceStatus, error)
ForwardedPortStatus(context.Context, mtypes.LeaseID) (map[string][]apclient.ForwardedPortStatus, error)
LeaseEvents(context.Context, mtypes.LeaseID, string, bool) (ctypes.EventsWatcher, error)
LeaseLogs(context.Context, mtypes.LeaseID, string, bool, *int64) ([]*ctypes.ServiceLog, error)
ServiceStatus(context.Context, mtypes.LeaseID, string) (*apclient.ServiceStatus, error)
AllHostnames(context.Context) ([]chostname.ActiveHostname, error)
GetManifestGroup(context.Context, mtypes.LeaseID) (bool, crd.ManifestGroup, error)
ObserveHostnameState(ctx context.Context) (<-chan chostname.ResourceEvent, error)
GetHostnameDeploymentConnections(ctx context.Context) ([]chostname.LeaseIDConnection, error)
ObserveIPState(ctx context.Context) (<-chan cip.ResourceEvent, error)
GetDeclaredIPs(ctx context.Context, leaseID mtypes.LeaseID) ([]crd.ProviderLeasedIPSpec, error)
}
type ReservationResult ¶
func (ReservationResult) Wait ¶
func (rr ReservationResult) Wait(wait <-chan struct{}) ([]string, error)
type Service ¶
type Service interface {
StatusClient
Cluster
Close() error
Ready() <-chan struct{}
Done() <-chan struct{}
HostnameService() ctypes.HostnameServiceClient
TransferHostname(ctx context.Context, leaseID mtypes.LeaseID, hostname string, serviceName string, externalPort uint32) error
}
Service manage compute cluster for the provider. Will eventually integrate with kubernetes, etc...
type SimpleHostnames ¶
type SimpleHostnames struct {
Hostnames map[string]hostnameID
// contains filtered or unexported fields
} /* Used in test code */
func (*SimpleHostnames) CanReserveHostnames ¶
func (sh *SimpleHostnames) CanReserveHostnames(hostnames []string, ownerAddr sdktypes.Address) error
func (*SimpleHostnames) PrepareHostnamesForTransfer ¶
func (*SimpleHostnames) ReleaseHostnames ¶
func (sh *SimpleHostnames) ReleaseHostnames(leaseID mtypes.LeaseID) error
func (*SimpleHostnames) ReserveHostnames ¶
type StatusClient ¶
type StatusClient interface {
Status(context.Context) (*apclient.ClusterStatus, error)
StatusV1(context.Context) (*provider.ClusterStatus, error)
FindActiveLease(ctx context.Context, owner sdktypes.Address, dseq uint64, gseq uint32) (bool, mtypes.LeaseID, crd.ManifestGroup, error)
}
StatusClient is the interface which includes status of service
Source Files
¶
Click to show internal directories.
Click to hide internal directories.