Documentation ¶
Index ¶
- Constants
- func BuildKey(pod *v1.Pod) (string, error)
- func BuildKeyFromNames(namespace string, name string) (string, error)
- func LogRetrieval(ctx context.Context, config VirtualKubeletConfig, ...) (io.ReadCloser, error)
- func NewCertificateRetriever(kubeClient kubernetes.Interface, signer, nodeName string, nodeIP net.IP) (crtretriever, error)
- func NewSelfSignedCertificateRetriever(nodeName string, nodeIP net.IP) crtretriever
- func PingInterLink(ctx context.Context, config VirtualKubeletConfig) (bool, int, error)
- func RemoteExecution(ctx context.Context, config VirtualKubeletConfig, p *VirtualKubeletProvider, ...) error
- type VirtualKubeletConfig
- type VirtualKubeletProvider
- func (p *VirtualKubeletProvider) CreatePod(ctx context.Context, pod *v1.Pod) error
- func (p *VirtualKubeletProvider) DeletePod(ctx context.Context, pod *v1.Pod) (err error)
- func (p *VirtualKubeletProvider) GetLogs(ctx context.Context, namespace, podName, containerName string, ...) (io.ReadCloser, error)
- func (p *VirtualKubeletProvider) GetNode() *v1.Node
- func (p *VirtualKubeletProvider) GetPod(ctx context.Context, namespace, name string) (pod *v1.Pod, err error)
- func (p *VirtualKubeletProvider) GetPodStatus(ctx context.Context, namespace, name string) (*v1.PodStatus, error)
- func (p *VirtualKubeletProvider) GetPods(ctx context.Context) ([]*v1.Pod, error)
- func (p *VirtualKubeletProvider) GetStatsSummary(ctx context.Context) (*stats.Summary, error)
- func (p *VirtualKubeletProvider) InitClientSet(ctx context.Context) error
- func (p *VirtualKubeletProvider) NotifyNodeStatus(ctx context.Context, f func(*v1.Node))
- func (p *VirtualKubeletProvider) NotifyPods(ctx context.Context, f func(*v1.Pod))
- func (p *VirtualKubeletProvider) Ping(ctx context.Context) error
- func (p *VirtualKubeletProvider) RetrievePodsFromInterlink(ctx context.Context) error
- func (p *VirtualKubeletProvider) UpdatePod(ctx context.Context, pod *v1.Pod) error
Constants ¶
const ( DefaultCPUCapacity = "100" DefaultMemoryCapacity = "3000G" DefaultPodCapacity = "10000" DefaultGPUCapacity = "0" DefaultListenPort = 10250 NamespaceKey = "namespace" NameKey = "name" CREATE = 0 DELETE = 1 )
Variables ¶
This section is empty.
Functions ¶
func LogRetrieval ¶
func LogRetrieval(ctx context.Context, config VirtualKubeletConfig, logsRequest commonIL.LogStruct) (io.ReadCloser, error)
LogRetrieval performs a REST call to the InterLink API when the user ask for a log retrieval. Compared to create/delete/status request, a way smaller struct is marshalled and sent. This struct only includes a minimum data set needed to identify the job/container to get the logs from. Returns the call response and/or the first encountered error
func NewCertificateRetriever ¶
func NewCertificateRetriever(kubeClient kubernetes.Interface, signer, nodeName string, nodeIP net.IP) (crtretriever, error)
NewCertificateManager creates a certificate manager for the kubelet when retrieving a server certificate, or returns an error. This function is inspired by Liqo implementation: https://github.com/liqotech/liqo/blob/master/cmd/virtual-kubelet/root/http.go#L149
func NewSelfSignedCertificateRetriever ¶
newSelfSignedCertificateRetriever creates a new retriever for self-signed certificates.
func PingInterLink ¶
PingInterLink pings the InterLink API and returns true if there's an answer. The second return value is given by the answer provided by the API.
func RemoteExecution ¶
func RemoteExecution(ctx context.Context, config VirtualKubeletConfig, p *VirtualKubeletProvider, pod *v1.Pod, mode int8) error
RemoteExecution is called by the VK everytime a Pod is being registered or deleted to/from the VK. Depending on the mode (CREATE/DELETE), it performs different actions, making different REST calls. Note: for the CREATE mode, the function gets stuck up to 5 minutes waiting for every missing ConfigMap/Secret. If after 5m they are not still available, the function errors out
Types ¶
type VirtualKubeletConfig ¶
type VirtualKubeletConfig struct { Interlinkurl string `yaml:"InterlinkURL"` Interlinkport string `yaml:"InterlinkPort"` VKConfigPath string `yaml:"VKConfigPath"` VKTokenFile string `yaml:"VKTokenFile"` ServiceAccount string `yaml:"ServiceAccount"` Namespace string `yaml:"Namespace"` PodIP string `yaml:"PodIP"` VerboseLogging bool `yaml:"VerboseLogging"` ErrorsOnlyLogging bool `yaml:"ErrorsOnlyLogging"` CPU string `yaml:"cpu,omitempty"` Memory string `yaml:"memory,omitempty"` Pods string `yaml:"pods,omitempty"` GPU string `yaml:"nvidia.com/gpu,omitempty"` }
VirtualKubeletConfig holds the whole configuration
func LoadConfig ¶
func LoadConfig(providerConfig, nodeName string, ctx context.Context) (config VirtualKubeletConfig, err error)
loadConfig loads the given json configuration files and yaml to communicate with InterLink.
type VirtualKubeletProvider ¶
type VirtualKubeletProvider struct {
// contains filtered or unexported fields
}
func NewProvider ¶
func NewProvider(providerConfig, nodeName, operatingSystem string, internalIP string, daemonEndpointPort int32, ctx context.Context) (*VirtualKubeletProvider, error)
NewProvider creates a new Provider, which implements the PodNotifier interface
func NewProviderConfig ¶
func NewProviderConfig( config VirtualKubeletConfig, nodeName string, operatingSystem string, internalIP string, daemonEndpointPort int32, ) (*VirtualKubeletProvider, error)
func (*VirtualKubeletProvider) CreatePod ¶
CreatePod accepts a Pod definition and stores it in memory.
func (*VirtualKubeletProvider) GetLogs ¶
func (p *VirtualKubeletProvider) GetLogs(ctx context.Context, namespace, podName, containerName string, opts api.ContainerLogOpts) (io.ReadCloser, error)
func (*VirtualKubeletProvider) GetNode ¶
func (p *VirtualKubeletProvider) GetNode() *v1.Node
func (*VirtualKubeletProvider) GetPod ¶
func (p *VirtualKubeletProvider) GetPod(ctx context.Context, namespace, name string) (pod *v1.Pod, err error)
GetPod returns a pod by name that is stored in memory.
func (*VirtualKubeletProvider) GetPodStatus ¶
func (p *VirtualKubeletProvider) 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 (*VirtualKubeletProvider) GetStatsSummary ¶
GetStatsSummary returns dummy stats for all pods known by this provider.
func (*VirtualKubeletProvider) InitClientSet ¶
func (p *VirtualKubeletProvider) InitClientSet(ctx context.Context) error
func (*VirtualKubeletProvider) NotifyNodeStatus ¶
func (p *VirtualKubeletProvider) NotifyNodeStatus(ctx context.Context, f func(*v1.Node))
func (*VirtualKubeletProvider) NotifyPods ¶
func (p *VirtualKubeletProvider) NotifyPods(ctx context.Context, f 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 (*VirtualKubeletProvider) Ping ¶
func (p *VirtualKubeletProvider) Ping(ctx context.Context) error
func (*VirtualKubeletProvider) RetrievePodsFromInterlink ¶
func (p *VirtualKubeletProvider) RetrievePodsFromInterlink(ctx context.Context) error
GetPods returns a list of all pods known to be "running".