Documentation ¶
Index ¶
- type MockConfig
- type MockProvider
- func (p *MockProvider) ConfigureNode(ctx context.Context, n *v1.Node)
- func (p *MockProvider) CreatePod(ctx context.Context, pod *v1.Pod) error
- func (p *MockProvider) DeletePod(ctx context.Context, pod *v1.Pod) (err error)
- func (p *MockProvider) GetContainerLogs(ctx context.Context, namespace, podName, containerName string, ...) (io.ReadCloser, error)
- func (p *MockProvider) GetPod(ctx context.Context, namespace, name string) (pod *v1.Pod, err error)
- func (p *MockProvider) GetPodStatus(ctx context.Context, namespace, name string) (*v1.PodStatus, error)
- func (p *MockProvider) GetPods(ctx context.Context) ([]*v1.Pod, error)
- func (p *MockProvider) GetStatsSummary(ctx context.Context) (*stats.Summary, error)
- func (p *MockProvider) NotifyPods(ctx context.Context, notifier func(*v1.Pod))
- func (p *MockProvider) RunInContainer(ctx context.Context, namespace, name, container string, cmd []string, ...) error
- func (p *MockProvider) UpdatePod(ctx context.Context, pod *v1.Pod) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockConfig ¶
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, which implements the PodNotifier interface
func NewMockProviderMockConfig ¶
func NewMockProviderMockConfig(config MockConfig, nodeName, operatingSystem string, internalIP string, daemonEndpointPort int32) (*MockProvider, error)
NewMockProviderMockConfig creates a new MockV0Provider. Mock legacy provider does not implement the new asynchronous podnotifier interface
func (*MockProvider) ConfigureNode ¶
func (p *MockProvider) ConfigureNode(ctx context.Context, n *v1.Node)
func (*MockProvider) GetContainerLogs ¶
func (p *MockProvider) 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 (*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) GetStatsSummary ¶
GetStatsSummary returns dummy stats for all pods known by this provider.
func (*MockProvider) NotifyPods ¶
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.
func (*MockProvider) RunInContainer ¶
func (p *MockProvider) 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.