provider

package
v0.0.0-...-dd6cbca Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2021 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultOperatingSystem       = "Linux" // systemd is only supported on Linux
	DefaultInformerResyncPeriod  = 1 * time.Minute
	DefaultMetricsAddr           = ":10255"
	DefaultListenAddr            = ":10250"
	DefaultPodSyncWorkers        = 10
	DefaultKubeClusterDomain     = "cluster.local"
	DefaultTaintKey              = "virtual-kubelet.io/provider"
	DefaultTaintValue            = "systemk"
	DefaultStreamIdleTimeout     = 30 * time.Second
	DefaultStreamCreationTimeout = 30 * time.Second
	DefaultAllowedPaths          = []string{"/var"}
)

Defaults for the provider.

View Source
var ErrExpired = errors.New("timeout expired")

Functions

func Container

func Container(name string) string

Container returns the <container> from the well formed name. See Name.

func Name

func Name(name string) string

Name returns <namespace>.<podname> from a well formed name. Units are named as 'systemk.<namespace>.<podname>.<container>'.

func Namespace

func Namespace(name string) string

Namespace returns <namespace> from the well formed name. See Name.

func Pod

func Pod(name string) string

Pod returns <podname> from the well formed name. See Name.

func SetDefaultOpts

func SetDefaultOpts(opts *Opts)

SetDefaultOpts sets default options for unset values of the passed in option struct. Fields that are already set will not be modified.

Types

type Opts

type Opts struct {
	// ServerCertPath is the path to the certificate to secure the kubelet API.
	ServerCertPath string

	// ServerKeyPath is the path to the private key to sign the kubelet API.
	ServerKeyPath string

	// NodeInternalIP is the desired Node internal IP.
	NodeInternalIP net.IP

	// NodeExternalIP is the desired Node external IP.
	NodeExternalIP net.IP

	// AllowedHostPaths is a list of host paths that are allowed to be mounted.
	AllowedHostPaths []string

	// KubeConfigPath is the path to the Kubernetes client configuration.
	KubeConfigPath string

	// KubeClusterDomain is the suffix to append to search domains for the Pods.
	KubeClusterDomain string

	// KubernetesURL is the value to set for the KUBERNETES_SERVICE_* Pod env vars.
	KubernetesURL string

	// ListenAddress is the address to bind for serving requests from the Kubernetes API server.
	ListenAddress string

	// NodeName identifies the Node in the cluster.
	NodeName string

	// DisableTaint disables systemk default taint.
	DisableTaint bool

	// MetricsAddr is the address to bind for serving metrics.
	MetricsAddr string

	// PodSyncWorkers is the number of workers that handle Pod events.
	PodSyncWorkers int

	// InformerResyncPeriod is the interval between relisting of Kubernetes resources.
	// This is important as it serves as a recovery mechanism in case systemk lost any
	// events related to the resources it's watching, eg due to network partition.
	InformerResyncPeriod time.Duration

	// StartupTimeout is how long to wait for systemk to start.
	StartupTimeout time.Duration

	// StreamIdleTimeout is the maximum time a streaming connection
	// can be idle before the connection is automatically closed.
	StreamIdleTimeout time.Duration

	// StreamCreationTimeout is the maximum time for streaming connection.
	StreamCreationTimeout time.Duration

	// UserMode is whether to use the user's systemd or the system's.
	UserMode bool

	// Version carries the systemk version.
	Version string
}

Opts stores all the configuration options. It is used for setting flag values.

You can set the default options by creating a new `Opts` struct and passing it into `SetDefaultOpts`

type Provider

type Provider interface {
	node.PodLifecycleHandler

	kubernetes.ResourceUpdater

	// GetContainerLogsHandler handles a Pod's container log retrieval.
	GetContainerLogsHandler(w http.ResponseWriter, r *http.Request)

	// 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 api.AttachIO) error

	// ConfigureNode enables a provider to configure the Node object that
	// will be used for Kubernetes.
	ConfigureNode(context.Context, *Opts) (*corev1.Node, error)
}

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

Errors produced by these methods should implement an interface from github.com/virtual-kubelet/virtual-kubelet/errdefs package in order for the core logic to be able to understand the type of failure.

func New

func New(ctx context.Context, config *Opts, podWatcher kubernetes.PodResourceManager) (Provider, error)

New returns a new systemd provider. informerFactory is the basis for ConfigMap and Secret retrieval and event handling.

type Volume

type Volume int

Volume describes what volumes should be created.

Jump to

Keyboard shortcuts

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