This makes the concept of a `Provider` wholely implemented in the cli implementation in cmd/virtual-kubelet. It allows us to slim down the interfaces used in vkubelet (and vkubelet/api) to what is actually used there rather than a huge interface that is only there to serve the CLI's needs.
47 lines
1.7 KiB
Go
47 lines
1.7 KiB
Go
package providers
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
|
|
"github.com/virtual-kubelet/virtual-kubelet/vkubelet"
|
|
"github.com/virtual-kubelet/virtual-kubelet/vkubelet/api"
|
|
v1 "k8s.io/api/core/v1"
|
|
stats "k8s.io/kubernetes/pkg/kubelet/apis/stats/v1alpha1"
|
|
)
|
|
|
|
// Provider contains the methods required to implement a virtual-kubelet provider.
|
|
type Provider interface {
|
|
vkubelet.PodLifecycleHandler
|
|
|
|
// GetContainerLogs retrieves the logs of a container by name from the provider.
|
|
GetContainerLogs(ctx context.Context, namespace, podName, containerName string, opts api.ContainerLogOpts) (io.ReadCloser, error)
|
|
|
|
// RunInContainer executes a command in a container in the pod, copying data
|
|
// between in/out/err and the container's stdin/stdout/stderr.
|
|
RunInContainer(ctx context.Context, namespace, podName, containerName string, cmd []string, attach api.AttachIO) error
|
|
|
|
// Capacity returns a resource list with the capacity constraints of the provider.
|
|
Capacity(context.Context) v1.ResourceList
|
|
|
|
// NodeConditions returns a list of conditions (Ready, OutOfDisk, etc), which is
|
|
// polled periodically to update the node status within Kubernetes.
|
|
NodeConditions(context.Context) []v1.NodeCondition
|
|
|
|
// NodeAddresses returns a list of addresses for the node status
|
|
// within Kubernetes.
|
|
NodeAddresses(context.Context) []v1.NodeAddress
|
|
|
|
// NodeDaemonEndpoints returns NodeDaemonEndpoints for the node status
|
|
// within Kubernetes.
|
|
NodeDaemonEndpoints(context.Context) *v1.NodeDaemonEndpoints
|
|
|
|
// OperatingSystem returns the operating system the provider is for.
|
|
OperatingSystem() string
|
|
}
|
|
|
|
// PodMetricsProvider is an optional interface that providers can implement to expose pod stats
|
|
type PodMetricsProvider interface {
|
|
GetStatsSummary(context.Context) (*stats.Summary, error)
|
|
}
|