Documentation
¶
Overview ¶
Package provider implements the stackpath virtual kubelet provider
Package provider implements the stackpath virtual kubelet provider ¶
Package provider implements the stackpath virtual kubelet provider ¶
Package provider implements the stackpath virtual kubelet provider
Index ¶
- func HTTPStatusFromCode(code int32) int
- func NewStackPathError(err error) error
- type APIError
- type ContainerRunner
- type ErrNotFound
- type InvalidClientIDError
- type InvalidClientSecretError
- type PodsTracker
- type PodsTrackerHandler
- type StackpathProvider
- func (p *StackpathProvider) AttachToContainer(ctx context.Context, namespace, podName, containerName string, ...) error
- func (p *StackpathProvider) ConfigureNode(ctx context.Context, node *v1.Node)
- func (p *StackpathProvider) CreatePod(ctx context.Context, pod *v1.Pod) error
- func (p *StackpathProvider) DeletePod(ctx context.Context, pod *v1.Pod) error
- func (p *StackpathProvider) GetContainerLogs(ctx context.Context, namespace, podName, containerName string, ...) (io.ReadCloser, error)
- func (p *StackpathProvider) GetMetricsResource(context.Context) ([]*dto.MetricFamily, error)
- func (p *StackpathProvider) GetPod(ctx context.Context, namespace, name string) (*v1.Pod, error)
- func (p *StackpathProvider) GetPodStatus(ctx context.Context, namespace, name string) (*v1.PodStatus, error)
- func (p *StackpathProvider) GetPods(ctx context.Context) ([]*v1.Pod, error)
- func (p *StackpathProvider) GetStatsSummary(ctx context.Context) (*stats.Summary, error)
- func (p *StackpathProvider) NotifyPods(ctx context.Context, notifierCallback func(*v1.Pod))
- func (p *StackpathProvider) RunInContainer(ctx context.Context, namespace, podName, containerName string, cmd []string, ...) error
- func (p *StackpathProvider) UpdatePod(ctx context.Context, pod *v1.Pod) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HTTPStatusFromCode ¶
HTTPStatusFromCode converts a gRPC error code into the corresponding HTTP response status. See: https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto
This method is adapted from https://github.com/grpc-ecosystem/grpc-gateway/blob/master/runtime/errors.go to prevent having to import the entire grpc-gateway package.
func NewStackPathError ¶
NewStackPathError factories common StackPath error scenarios into their own error types, or returns the original error.
Types ¶
type APIError ¶
type APIError struct { ErrNotFound // contains filtered or unexported fields }
APIError models an error received from the StackPath API.
type ContainerRunner ¶
type ContainerRunner struct {
// contains filtered or unexported fields
}
func NewContainerRunner ¶
func NewContainerRunner(sshClient *ssh.Client, attachIO api.AttachIO) *ContainerRunner
NewContainerRunner creates a new ContainerRunner object.
type ErrNotFound ¶
ErrNotFound is an error interface which denotes whether the opration failed due to a the resource not being found.
type InvalidClientIDError ¶
type InvalidClientIDError struct{}
InvalidClientSecretError models when a StackPath API OAuth 2 client ID is invalid, either due to an invalid format or because the client ID does not exist at StackPath.
func NewInvalidClientIDError ¶
func NewInvalidClientIDError() *InvalidClientIDError
NewInvalidClientIDError wraps an existing error as an invalid client ID error.
func (*InvalidClientIDError) Error ¶
func (e *InvalidClientIDError) Error() string
Error returns a human-readable invalid client ID error message.
type InvalidClientSecretError ¶
type InvalidClientSecretError struct{}
InvalidClientSecretError models when a StackPath API OAuth 2 client ID is correct, but the client secret is incorrect.
func NewInvalidClientSecretError ¶
func NewInvalidClientSecretError() *InvalidClientSecretError
NewInvalidClientSecretError wraps an existing error as an invalid client secret error.
func (*InvalidClientSecretError) Error ¶
func (e *InvalidClientSecretError) Error() string
Error returns a human-readable invalid client secret error message.
type PodsTracker ¶
type PodsTracker struct {
// contains filtered or unexported fields
}
PodsTracker manages the tracking of pod statuses and updates within a Kubernetes cluster
func (*PodsTracker) BeginPodTracking ¶
func (pt *PodsTracker) BeginPodTracking(ctx context.Context)
BeginPodTracking initializes and manages background tracking for created pods
type PodsTrackerHandler ¶
type StackpathProvider ¶
type StackpathProvider struct {
// contains filtered or unexported fields
}
StackpathProvider is a struct that implements the virtual-kubelet provider interface
func NewStackpathProvider ¶
func NewStackpathProvider(ctx context.Context, stackpathClient *workload_client.EdgeCompute, apiConfig *config.Config, providerConfig nodeutil.ProviderConfig, internalIP string, daemonEndpointPort int32) (*StackpathProvider, error)
NewStackpathProvider creates a stackpath virtual kubelet provider
func (*StackpathProvider) AttachToContainer ¶
func (p *StackpathProvider) AttachToContainer(ctx context.Context, namespace, podName, containerName string, attach api.AttachIO) error
AttachToContainer attaches to the executing process of a container in the pod, copying data between in/out/err and the container's stdin/stdout/stderr.
NOP. Not Implemented in this version
func (*StackpathProvider) ConfigureNode ¶
func (p *StackpathProvider) ConfigureNode(ctx context.Context, node *v1.Node)
func (*StackpathProvider) CreatePod ¶
CreatePod takes a Kubernetes Pod and deploys it within the provider.
func (*StackpathProvider) DeletePod ¶
DeletePod takes a Kubernetes Pod and deletes it from the provider.
func (*StackpathProvider) GetContainerLogs ¶
func (p *StackpathProvider) GetContainerLogs(ctx context.Context, namespace, podName, containerName string, opts api.ContainerLogOpts) (io.ReadCloser, error)
GetContainerLogs returns the logs of a pod by name that is running as a StackPath workload
func (*StackpathProvider) GetMetricsResource ¶
func (p *StackpathProvider) GetMetricsResource(context.Context) ([]*dto.MetricFamily, error)
GetMetricsResource gets the metrics for the node, including running pods
NOP. Not Implemented in this version
func (*StackpathProvider) GetPod ¶
GetPod retrieves a pod by its name and namespace running on StackPath Edge Compute and updates the cluster's pod status to match the provider's. If a pod with the specified name is not found, it returns nil and an error.
func (*StackpathProvider) GetPodStatus ¶
func (p *StackpathProvider) GetPodStatus(ctx context.Context, namespace, name string) (*v1.PodStatus, error)
GetPodStatus retrieves the status of a pod by name and namespace from the provider.
func (*StackpathProvider) GetStatsSummary ¶
GetStatsSummary gets the stats for the node, including running pods
NOP. Not implemented in this version
func (*StackpathProvider) NotifyPods ¶
func (p *StackpathProvider) NotifyPods(ctx context.Context, notifierCallback func(*v1.Pod))
NotifyPods instructs the notifier to call the passed in function when the pod status changes. The provided pointer to a Pod is guaranteed to be used in a read-only fashion.
NOP. Not implemented in this version.
func (*StackpathProvider) RunInContainer ¶
func (p *StackpathProvider) RunInContainer(ctx context.Context, namespace, podName, containerName string, cmd []string, attach api.AttachIO) error
RunInContainer executes a command in a container in the pod, copying data between in/out/err and the container's stdin/stdout/stderr.