providers

package
v0.0.0-...-0deb509 Latest Latest
Warning

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

Go to latest
Published: May 17, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

README

Follow these steps to be accepted as a provider within the Virtual Kubelet repo.

  1. Replicate the life-cycle of a pod for example creation and deletion of a pod and how that maps to your service.
  2. Create a new provider folder with a descriptive name and the necessary code.
  3. When committing your code add a README.md, helm chart, dockerfile and specify a maintainer of the provider.
  4. Within the PR itself add a justification for why the provider should be accepted, as well as customer use cases if applicable.

Some providers are translations of Virtual Kubelet to allow others to adapt their service or applications that are written in other languages.

Documentation

Index

Constants

View Source
const (
	// OperatingSystemLinux is the configuration value for defining Linux.
	OperatingSystemLinux = "Linux"
	// OperatingSystemWindows is the configuration value for defining Windows.
	OperatingSystemWindows = "Windows"
)

Variables

View Source
var (
	// ValidOperatingSystems defines the group of operating systems
	// that can be used as a kubelet node.
	ValidOperatingSystems = OperatingSystems{
		OperatingSystemLinux:   true,
		OperatingSystemWindows: true,
	}
)

Functions

This section is empty.

Types

type AttachIO

type AttachIO interface {
	Stdin() io.Reader
	Stdout() io.WriteCloser
	Stderr() io.WriteCloser
	TTY() bool
	Resize() <-chan TermSize
}

AttachIO is used to pass in streams to attach to a container process

type ContainerLogOpts

type ContainerLogOpts struct {
	Tail       int
	Since      time.Duration
	LimitBytes int
	Timestamps bool
}

ContainerLogOpts are used to pass along options to be set on the container log stream.

type NodeProvider

type NodeProvider interface {
	// Ping checks if the node is still active.
	// This is intended to be lightweight as it will be called periodically as a
	// heartbeat to keep the node marked as ready in Kubernetes.
	Ping(context.Context) error

	// NotifyNodeStatus is used to asynchronously monitor the node.
	// The passed in callback should be called any time there is a change to the
	// node's status.
	// This will generally trigger a call to the Kubernetes API server to update
	// the status.
	//
	// NotifyNodeStatus should not block callers.
	NotifyNodeStatus(ctx context.Context, cb func(*v1.Node))
}

NodeProvider is the interface used for registering a node and updating its status in Kubernetes.

Note: Implementers can choose to manage a node themselves, in which case it is not needed to provide an implementation for this interface.

type OperatingSystems

type OperatingSystems map[string]bool

func (OperatingSystems) Names

func (o OperatingSystems) Names() []string

type PodMetricsProvider

type PodMetricsProvider interface {
	GetStatsSummary(context.Context) (*stats.Summary, error)
}

PodMetricsProvider is an optional interface that providers can implement to expose pod stats

type PodNotifier

type PodNotifier interface {
	// NotifyPods instructs the notifier to call the passed in function when
	// the pod status changes.
	//
	// NotifyPods should not block callers.
	NotifyPods(context.Context, func(*v1.Pod))
}

PodNotifier notifies callers of pod changes. Providers should implement this interface to enable callers to be notified of pod status updates asyncronously.

type Provider

type Provider interface {
	// CreatePod takes a Kubernetes Pod and deploys it within the provider.
	CreatePod(ctx context.Context, pod *v1.Pod) error

	// UpdatePod takes a Kubernetes Pod and updates it within the provider.
	UpdatePod(ctx context.Context, pod *v1.Pod) error

	// DeletePod takes a Kubernetes Pod and deletes it from the provider.
	DeletePod(ctx context.Context, pod *v1.Pod) error

	// GetPod retrieves a pod by name from the provider (can be cached).
	GetPod(ctx context.Context, namespace, name string) (*v1.Pod, error)

	// GetContainerLogs retrieves the logs of a container by name from the provider.
	GetContainerLogs(ctx context.Context, namespace, podName, containerName string, opts ContainerLogOpts) (io.ReadCloser, error)

	// RunInContainer executes a command in a container in the pod, copying data
	// between in/out/err and the container's stdin/stdout/stderr.
	RunInContainer(ctx context.Context, namespace, podName, containerName string, cmd []string, attach AttachIO) error

	// GetPodStatus retrieves the status of a pod by name from the provider.
	GetPodStatus(ctx context.Context, namespace, name string) (*v1.PodStatus, error)

	// GetPods retrieves a list of all pods running on the provider (can be cached).
	GetPods(context.Context) ([]*v1.Pod, error)

	// Capacity returns a resource list with the capacity constraints of the provider.
	Capacity(context.Context) v1.ResourceList

	// NodeConditions returns a list of conditions (Ready, OutOfDisk, etc), which is
	// polled periodically to update the node status within Kubernetes.
	NodeConditions(context.Context) []v1.NodeCondition

	// NodeAddresses returns a list of addresses for the node status
	// within Kubernetes.
	NodeAddresses(context.Context) []v1.NodeAddress

	// NodeDaemonEndpoints returns NodeDaemonEndpoints for the node status
	// within Kubernetes.
	NodeDaemonEndpoints(context.Context) *v1.NodeDaemonEndpoints

	// OperatingSystem returns the operating system the provider is for.
	OperatingSystem() string
}

Provider contains the methods required to implement a virtual-kubelet provider.

type TermSize

type TermSize struct {
	Width  uint16
	Height uint16
}

TermSize is used to set the terminal size from attached clients.

Directories

Path Synopsis
eci
aws
Package web provides an implementation of the virtual kubelet provider interface by forwarding all calls to a web endpoint.
Package web provides an implementation of the virtual kubelet provider interface by forwarding all calls to a web endpoint.

Jump to

Keyboard shortcuts

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