provider

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2020 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package provider handles the interaction with the virtual kubelet library (and node-cli)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsExpected

func IsExpected(err error) bool

IsExpected returns true if err is expected.

func NewProvider

func NewProvider(pods podmanager.PodManager, nodeStats *Stats, resources *scenario.NodeResources, cfg *provider.InitConfig, nodeInfo *node.Info, store *store.Store, disableTaints bool, environment env.ApateletEnvironment) provider.Provider

NewProvider returns the provider but with the vk type instead of our own.

Types

type ExpectedError

type ExpectedError interface {
	Expected() bool
}

ExpectedError is an error which is thrown during emulation.

type Provider

type Provider struct {
	Pods        podmanager.PodManager // the pods currently used
	Store       *store.Store          // the apatelet store
	Environment env.ApateletEnvironment

	Cfg           *provider.InitConfig // the initial provider config
	DisableTaints bool                 // whether to disable taints

	Stats *Stats // statistics contain static statistics

	Node      *corev1.Node            // the reference to "ourselves"
	NodeInfo  *node.Info              // static node information sent to kubernetes
	Resources *scenario.NodeResources // static resource information sent to kubernetes

	Conditions nodeConditions // a wrapper around kubernetes conditions
}

Provider implements the node-cli (virtual kubelet) interface for a virtual kubelet provider

func (*Provider) ConfigureNode

func (p *Provider) ConfigureNode(ctx context.Context, node *corev1.Node)

ConfigureNode enables a provider to configure the node object that will be used for Kubernetes.

func (*Provider) CreatePod

func (p *Provider) CreatePod(ctx context.Context, pod *corev1.Pod) error

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

func (*Provider) DeletePod

func (p *Provider) DeletePod(ctx context.Context, pod *corev1.Pod) error

DeletePod takes a Kubernetes Pod and deletes it from the provider.

func (*Provider) GetContainerLogs

func (p *Provider) GetContainerLogs(_ context.Context, ns, name, _ string, _ api.ContainerLogOpts) (io.ReadCloser, error)

GetContainerLogs retrieves the log of a specific container.

func (*Provider) GetPod

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

GetPod retrieves a pod by label.

func (*Provider) GetPodStatus

func (p *Provider) GetPodStatus(ctx context.Context, ns string, name string) (*corev1.PodStatus, error)

GetPodStatus retrieves the status of a pod by label.

func (*Provider) GetPods

func (p *Provider) GetPods(ctx context.Context) ([]*corev1.Pod, error)

GetPods retrieves a list of all pods running.

func (*Provider) GetStatsSummary

func (p *Provider) GetStatsSummary() (*stats.Summary, error)

GetStatsSummary should return a node level statistic report

func (*Provider) NotifyNodeStatus

func (p *Provider) NotifyNodeStatus(ctx context.Context, cb func(*corev1.Node))

NotifyNodeStatus sets the function we can use to update the status within kubernetes

func (*Provider) Ping

func (p *Provider) Ping(ctx context.Context) error

Ping will react to ping based on the given set flag

func (*Provider) RunInContainer

func (p *Provider) RunInContainer(_ context.Context, ns, name, _ string, _ []string, _ api.AttachIO) error

RunInContainer runs a command in a specific container.

func (*Provider) UpdatePod

func (p *Provider) UpdatePod(ctx context.Context, pod *corev1.Pod) error

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

type Stats

type Stats struct {
	// contains filtered or unexported fields
}

Stats is a simple wrapper for statistics fields

func NewStats

func NewStats() *Stats

NewStats creates a new Stats instance

type VirtualKubelet

type VirtualKubelet struct {
	// contains filtered or unexported fields
}

VirtualKubelet is a struct containing everything needed to start virtual kubelet

func CreateProvider

func CreateProvider(env *env.ApateletEnvironment, res *scenario.NodeResources, store *store.Store) (*VirtualKubelet, error)

CreateProvider creates the node-cli (virtual kubelet) command

func (*VirtualKubelet) Run

func (vk *VirtualKubelet) Run(ctx context.Context, originalCtx context.Context) (int, int, error)

nolint as lint does not recognise the first context is indeed the correct context Run starts the virtual kubelet

Directories

Path Synopsis
Package condition provides functions to more easily work with kubernetes node conditions
Package condition provides functions to more easily work with kubernetes node conditions
Package mock_cache is a generated GoMock package.
Package mock_cache is a generated GoMock package.
Package podmanager contains the pod manager interface and a simple thread safe map-based implementation
Package podmanager contains the pod manager interface and a simple thread safe map-based implementation
mock_podmanager
Package mock_podmanager is a generated GoMock package.
Package mock_podmanager is a generated GoMock package.

Jump to

Keyboard shortcuts

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