mock

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 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 MockLegacyProvider added in v0.10.0

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

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

func NewMockLegacyProvider added in v0.10.0

func NewMockLegacyProvider(providerConfig, nodeName, operatingSystem string, internalIP string, daemonEndpointPort int32) (*MockLegacyProvider, error)

NewMockLegacyProvider creates a new MockLegacyProvider

func NewMockLegacyProviderMockConfig added in v0.10.0

func NewMockLegacyProviderMockConfig(config MockConfig, nodeName, operatingSystem string, internalIP string, daemonEndpointPort int32) (*MockLegacyProvider, error)

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

func (*MockLegacyProvider) Capacity added in v0.10.0

Capacity returns a resource list containing the capacity limits.

func (*MockLegacyProvider) CreatePod added in v0.10.0

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

CreatePod accepts a Pod definition and stores it in memory.

func (*MockLegacyProvider) DeletePod added in v0.10.0

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

DeletePod deletes the specified pod out of memory.

func (*MockLegacyProvider) GetContainerLogs added in v0.10.0

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

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

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

func (*MockLegacyProvider) GetPodFullName added in v0.10.0

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

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

func (*MockLegacyProvider) GetPodStatus added in v0.10.0

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

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

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

func (*MockLegacyProvider) GetStatsSummary added in v0.10.0

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

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

func (*MockLegacyProvider) NodeAddresses added in v0.10.0

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

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

func (*MockLegacyProvider) NodeConditions added in v0.10.0

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

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

func (*MockLegacyProvider) NodeDaemonEndpoints added in v0.10.0

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

NodeDaemonEndpoints returns NodeDaemonEndpoints for the node status within Kubernetes.

func (*MockLegacyProvider) OperatingSystem added in v0.10.0

func (p *MockLegacyProvider) OperatingSystem() string

func (*MockLegacyProvider) RunInContainer added in v0.10.0

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

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

UpdatePod accepts a Pod definition and updates its reference.

type MockProvider

type MockProvider struct {
	*MockLegacyProvider
}

MockProvider is like MockLegacyProvider, 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.

Jump to

Keyboard shortcuts

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