Documentation ¶
Index ¶
- type ClientConfig
- type VirtualK8S
- func (v *VirtualK8S) ConfigureNode(ctx context.Context, node *corev1.Node)
- func (v *VirtualK8S) CreatePod(ctx context.Context, pod *corev1.Pod) error
- func (v *VirtualK8S) DeletePod(ctx context.Context, pod *corev1.Pod) error
- func (v *VirtualK8S) GetClient() kubernetes.Interface
- func (v *VirtualK8S) GetContainerLogs(ctx context.Context, namespace string, podName string, containerName string, ...) (io.ReadCloser, error)
- func (v *VirtualK8S) GetMaster() kubernetes.Interface
- func (v *VirtualK8S) GetNameSpaceLister() v1.NamespaceLister
- func (v *VirtualK8S) GetPod(ctx context.Context, namespace string, name string) (*corev1.Pod, error)
- func (v *VirtualK8S) GetPodStatus(ctx context.Context, namespace string, name string) (*corev1.PodStatus, error)
- func (v *VirtualK8S) GetPods(_ context.Context) ([]*corev1.Pod, error)
- func (v *VirtualK8S) GetStatsSummary(ctx context.Context) (*stats.Summary, error)
- func (v *VirtualK8S) NotifyNodeStatus(ctx context.Context, f func(*corev1.Node))
- func (v *VirtualK8S) NotifyPods(ctx context.Context, f func(*corev1.Pod))
- func (v *VirtualK8S) Ping(ctx context.Context) error
- func (v *VirtualK8S) RunInContainer(ctx context.Context, namespace string, podName string, containerName string, ...) error
- func (v *VirtualK8S) UpdatePod(ctx context.Context, pod *corev1.Pod) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientConfig ¶
type ClientConfig struct { // allowed qps of the kube client KubeClientQPS int // allowed burst of the kube client KubeClientBurst int // config path of the kube client ClientKubeConfigPath string }
ClientConfig defines the configuration of a lower cluster
type VirtualK8S ¶
type VirtualK8S struct {
// contains filtered or unexported fields
}
VirtualK8S is the key struct to implement the tensile kubernetes
func NewVirtualK8S ¶
func NewVirtualK8S(cfg provider.InitConfig, cc *ClientConfig, ignoreLabelsStr string, enableServiceAccount bool, opts *opts.Opts) (*VirtualK8S, error)
NewVirtualK8S reads a kubeconfig file and sets up a client to interact with lower cluster
func (*VirtualK8S) ConfigureNode ¶
func (v *VirtualK8S) ConfigureNode(ctx context.Context, node *corev1.Node)
ConfigureNode enables a provider to configure the node object that will be used for Kubernetes.
func (*VirtualK8S) GetClient ¶
func (v *VirtualK8S) GetClient() kubernetes.Interface
GetClient return the kube client of lower cluster
func (*VirtualK8S) GetContainerLogs ¶
func (v *VirtualK8S) GetContainerLogs(ctx context.Context, namespace string, podName string, containerName string, opts api.ContainerLogOpts) (io.ReadCloser, error)
GetContainerLogs retrieves the logs of a container by name from the provider.
func (*VirtualK8S) GetMaster ¶
func (v *VirtualK8S) GetMaster() kubernetes.Interface
GetMaster return the kube client of upper cluster
func (*VirtualK8S) GetNameSpaceLister ¶
func (v *VirtualK8S) GetNameSpaceLister() v1.NamespaceLister
GetNameSpaceLister returns the namespace cache
func (*VirtualK8S) GetPod ¶
func (v *VirtualK8S) GetPod(ctx context.Context, namespace string, name string) (*corev1.Pod, error)
GetPod retrieves a pod by name from the provider (can be cached). The Pod returned is expected to be immutable, and may be accessed concurrently outside of the calling goroutine. Therefore it is recommended to return a version after DeepCopy.
func (*VirtualK8S) GetPodStatus ¶
func (v *VirtualK8S) GetPodStatus(ctx context.Context, namespace string, name string) (*corev1.PodStatus, error)
GetPodStatus retrieves the status of a pod by name from the provider. The PodStatus returned is expected to be immutable, and may be accessed concurrently outside of the calling goroutine. Therefore it is recommended to return a version after DeepCopy.
func (*VirtualK8S) GetPods ¶
GetPods retrieves a list of all pods running on the provider (can be cached). The Pods returned are expected to be immutable, and may be accessed concurrently outside of the calling goroutine. Therefore it is recommended to return a version after DeepCopy.
func (*VirtualK8S) GetStatsSummary ¶
GetStatsSummary summaries the cluster metrics which represented by the provider
func (*VirtualK8S) NotifyNodeStatus ¶
func (v *VirtualK8S) NotifyNodeStatus(ctx context.Context, f func(*corev1.Node))
NotifyNodeStatus is used to asynchronously monitor the node. The passed in callback should be called any time there is a change to the node's status. This will generally trigger a call to the Kubernetes API server to update the status.
NotifyNodeStatus should not block callers.
func (*VirtualK8S) NotifyPods ¶
func (v *VirtualK8S) NotifyPods(ctx context.Context, f func(*corev1.Pod))
NotifyPods instructs the notifier to call the passed in function when the pod status changes. It should be called when a pod's status changes.
The provided pointer to a Pod is guaranteed to be used in a read-only fashion. The provided pod's PodStatus should be up to date when this function is called.
NotifyPods will not block callers.
func (*VirtualK8S) Ping ¶
func (v *VirtualK8S) Ping(ctx context.Context) error
Ping tries to connect to client cluster implement node.NodeProvider
func (*VirtualK8S) RunInContainer ¶
func (v *VirtualK8S) RunInContainer(ctx context.Context, namespace string, podName string, containerName 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.