provider

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2023 License: MPL-2.0 Imports: 35 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTTPStatusFromCode

func HTTPStatusFromCode(code int32) int

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

func NewStackPathError(err error) error

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.

func (*APIError) Cause

func (e *APIError) Cause() error

func (*APIError) Error

func (e *APIError) Error() string

Error satisfies the error interface for APIError.

func (*APIError) NotFound

func (e *APIError) NotFound() bool

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.

func (*ContainerRunner) Exec

func (cr *ContainerRunner) Exec(ctx context.Context, cmd []string) error

Exec executes a command on a remote server via SSH protocol.

type ErrNotFound

type ErrNotFound interface {
	NotFound() bool
	error
}

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 PodsTrackerHandler interface {
	GetPods(ctx context.Context) ([]*v1.Pod, error)
	GetPodStatus(ctx context.Context, ns, name string) (*v1.PodStatus, error)
	DeletePod(ctx context.Context, pod *v1.Pod) error
}

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

func (p *StackpathProvider) CreatePod(ctx context.Context, pod *v1.Pod) error

CreatePod takes a Kubernetes Pod and deploys it within the provider.

func (*StackpathProvider) DeletePod

func (p *StackpathProvider) DeletePod(ctx context.Context, pod *v1.Pod) error

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

func (p *StackpathProvider) GetPod(ctx context.Context, namespace, name string) (*v1.Pod, error)

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) GetPods

func (p *StackpathProvider) GetPods(ctx context.Context) ([]*v1.Pod, error)

GetPods retrieves a list of all pods running on the provider.

func (*StackpathProvider) GetStatsSummary

func (p *StackpathProvider) GetStatsSummary(ctx context.Context) (*stats.Summary, error)

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.

func (*StackpathProvider) UpdatePod

func (p *StackpathProvider) UpdatePod(ctx context.Context, pod *v1.Pod) error

UpdatePod takes a Kubernetes Pod and updates it within the provider.

NOP. Not Implemented in this version

Jump to

Keyboard shortcuts

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