mock

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: May 6, 2019 License: Apache-2.0 Imports: 18 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 {
	// contains filtered or unexported fields
}

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

func NewMockProvider

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

NewMockProvider creates a new MockProvider

func (*MockProvider) Capacity

func (p *MockProvider) Capacity(ctx context.Context) v1.ResourceList

Capacity returns a resource list containing the capacity limits.

func (*MockProvider) CreatePod

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

CreatePod accepts a Pod definition and stores it in memory.

func (*MockProvider) DeletePod

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

DeletePod deletes the specified pod out of memory.

func (*MockProvider) ExecInContainer added in v0.4.1

func (p *MockProvider) ExecInContainer(name string, uid types.UID, container string, cmd []string, in io.Reader, out, err io.WriteCloser, tty bool, resize <-chan remotecommand.TerminalSize, timeout time.Duration) error

ExecInContainer executes a command in a container in the pod, copying data between in/out/err and the container's stdin/stdout/stderr.

func (*MockProvider) GetContainerLogs

func (p *MockProvider) GetContainerLogs(ctx context.Context, namespace, podName, containerName string, tail int) (string, error)

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

func (*MockProvider) GetPod

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

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

func (*MockProvider) GetPodFullName added in v0.4.1

func (p *MockProvider) GetPodFullName(namespace string, pod string) string

Get full pod name as defined in the provider context TODO: Implementation

func (*MockProvider) GetPodStatus

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

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

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

func (*MockProvider) GetStatsSummary added in v0.7.3

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

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

func (*MockProvider) NodeAddresses

func (p *MockProvider) NodeAddresses(ctx context.Context) []v1.NodeAddress

NodeAddresses returns a list of addresses for the node status within Kubernetes.

func (*MockProvider) NodeConditions

func (p *MockProvider) NodeConditions(ctx context.Context) []v1.NodeCondition

NodeConditions returns a list of conditions (Ready, OutOfDisk, etc), for updates to the node status within Kubernetes.

func (*MockProvider) NodeDaemonEndpoints

func (p *MockProvider) NodeDaemonEndpoints(ctx context.Context) *v1.NodeDaemonEndpoints

NodeDaemonEndpoints returns NodeDaemonEndpoints for the node status within Kubernetes.

func (*MockProvider) OperatingSystem

func (p *MockProvider) OperatingSystem() string

OperatingSystem returns the operating system for this provider. This is a noop to default to Linux for now.

func (*MockProvider) UpdatePod

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