mock

package
v0.1.3-elotl1 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2020 License: Apache-2.0 Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	CPU    string `json:"cpu,omitempty"`
	Memory string `json:"memory,omitempty"`
	Pods   string `json:"pods,omitempty"`
}

Config contains a mock virtual-kubelet's configurable parameters.

type Provider

type Provider struct {
	*ProviderV0
}

Provider is like ProviderV0, but implements the PodNotifier interface

func NewProvider

func NewProvider(providerConfig, nodeName, operatingSystem string, internalIP string, daemonEndpointPort int32) (*Provider, error)

NewProvider creates a new Provider, which implements the PodNotifier interface

func NewProviderConfig

func NewProviderConfig(config Config, nodeName, operatingSystem string, internalIP string, daemonEndpointPort int32) (*Provider, error)

NewProviderConfig creates a new Provider with the given config

func (*Provider) NotifyPods

func (p *Provider) NotifyPods(ctx context.Context, notifier func(*v1.Pod))

NotifyPods is called to set a pod notifier callback function. This should be called before any operations are done within the provider.

type ProviderV0

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

ProviderV0 implements the virtual-kubelet provider interface and stores pods in memory.

func NewProviderV0

func NewProviderV0(providerConfig, nodeName, operatingSystem string, internalIP string, daemonEndpointPort int32) (*ProviderV0, error)

NewProviderV0 creates a new ProviderV0

func NewProviderV0Config

func NewProviderV0Config(config Config, nodeName, operatingSystem string, internalIP string, daemonEndpointPort int32) (*ProviderV0, error)

NewProviderConfig creates a new ProviderV0. Mock legacy provider does not implement the new asynchronous podnotifier interface

func (*ProviderV0) ConfigureNode

func (p *ProviderV0) ConfigureNode(ctx context.Context, n *v1.Node)

func (*ProviderV0) CreatePod

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

CreatePod accepts a Pod definition and stores it in memory.

func (*ProviderV0) DeletePod

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

DeletePod deletes the specified pod out of memory.

func (*ProviderV0) GetContainerLogs

func (p *ProviderV0) GetContainerLogs(ctx context.Context, namespace, podName, containerName string, opts api.ContainerLogOpts) (io.ReadCloser, error)

GetContainerLogs retrieves the logs of a container by name from the provider.

func (*ProviderV0) GetPod

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

GetPod returns a pod by name that is stored in memory.

func (*ProviderV0) GetPodStatus

func (p *ProviderV0) GetPodStatus(ctx context.Context, namespace, name string) (*v1.PodStatus, error)

GetPodStatus returns the status of a pod by name that is "running". returns nil if a pod by that name is not found.

func (*ProviderV0) GetPods

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

GetPods returns a list of all pods known to be "running".

func (*ProviderV0) GetStatsSummary

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

GetStatsSummary returns dummy stats for all pods known by this provider.

func (*ProviderV0) RunInContainer

func (p *ProviderV0) RunInContainer(ctx context.Context, namespace, name, container 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 (*ProviderV0) UpdatePod

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

UpdatePod accepts a Pod definition and updates its reference.

Jump to

Keyboard shortcuts

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