mock

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockConfig added in v0.4.1

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

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

type MockProvider

type MockProvider struct {
	*MockV0Provider
}

MockProvider is like MockV0Provider, but implements the PodNotifier interface

func NewMockProvider

func NewMockProvider(providerConfig, nodeName, operatingSystem string, internalIP string, daemonEndpointPort int32) (*MockProvider, error)

NewMockProvider creates a new MockProvider, which implements the PodNotifier interface

func NewMockProviderMockConfig added in v0.10.0

func NewMockProviderMockConfig(config MockConfig, nodeName, operatingSystem string, internalIP string, daemonEndpointPort int32) (*MockProvider, error)

NewMockProviderMockConfig creates a new MockProvider with the given config

func (*MockProvider) NotifyPods added in v0.10.0

func (p *MockProvider) 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 MockV0Provider added in v0.11.0

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

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

func NewMockV0Provider added in v0.11.0

func NewMockV0Provider(providerConfig, nodeName, operatingSystem string, internalIP string, daemonEndpointPort int32) (*MockV0Provider, error)

NewMockV0Provider creates a new MockV0Provider

func NewMockV0ProviderMockConfig added in v0.11.0

func NewMockV0ProviderMockConfig(config MockConfig, nodeName, operatingSystem string, internalIP string, daemonEndpointPort int32) (*MockV0Provider, error)

NewMockProviderMockConfig creates a new MockV0Provider. Mock legacy provider does not implement the new asynchronous podnotifier interface

func (*MockV0Provider) ConfigureNode added in v0.11.0

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

func (*MockV0Provider) CreatePod added in v0.11.0

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

CreatePod accepts a Pod definition and stores it in memory.

func (*MockV0Provider) DeletePod added in v0.11.0

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

DeletePod deletes the specified pod out of memory.

func (*MockV0Provider) GetContainerLogs added in v0.11.0

func (p *MockV0Provider) 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 (*MockV0Provider) GetPod added in v0.11.0

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

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

func (*MockV0Provider) GetPodStatus added in v0.11.0

func (p *MockV0Provider) 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 (*MockV0Provider) GetPods added in v0.11.0

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

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

func (*MockV0Provider) GetStatsSummary added in v0.11.0

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

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

func (*MockV0Provider) RunInContainer added in v0.11.0

func (p *MockV0Provider) 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 (*MockV0Provider) UpdatePod added in v0.11.0

func (p *MockV0Provider) 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