Documentation ¶
Index ¶
- Constants
- Variables
- func AddSessionContext(req *http.Request, sessionContext string)
- func CheckIfAnnotationExists(pod *v1.Pod, key string) bool
- func GetResources(config Config) v1.ResourceList
- func GetSessionContextMessage(sessionContext string) string
- func LogRetrieval(ctx context.Context, config Config, logsRequest types.LogStruct, ...) (io.ReadCloser, error)
- func NodeCondition(ready bool) []v1.NodeCondition
- func PingInterLink(ctx context.Context, config Config) (bool, int, error)
- func PodPhase(p Provider, phase string) (v1.PodStatus, error)
- func RemoteExecution(ctx context.Context, config Config, p *Provider, pod *v1.Pod, mode int8) error
- func SetDefaultResource(config *Config)
- func TracerUpdate(ctx *context.Context, name string, pod *v1.Pod)
- type Config
- type Crtretriever
- type HTTP
- type Provider
- func (p *Provider) CreatePod(ctx context.Context, pod *v1.Pod) error
- func (p *Provider) DeletePod(ctx context.Context, pod *v1.Pod) (err error)
- func (p *Provider) GetLogs(ctx context.Context, namespace, podName, containerName string, ...) (io.ReadCloser, error)
- func (p *Provider) GetNode() *v1.Node
- func (p *Provider) GetPod(ctx context.Context, namespace, name string) (pod *v1.Pod, err error)
- func (p *Provider) GetPodStatus(ctx context.Context, namespace, name string) (*v1.PodStatus, error)
- func (p *Provider) GetPods(ctx context.Context) ([]*v1.Pod, error)
- func (p *Provider) GetStatsSummary(ctx context.Context) (*stats.Summary, error)
- func (p *Provider) NotifyNodeStatus(ctx context.Context, f func(*v1.Node))
- func (p *Provider) NotifyPods(ctx context.Context, f func(*v1.Pod))
- func (p *Provider) Ping(_ context.Context) error
- func (p *Provider) RetrievePodsFromCluster(ctx context.Context) error
- func (p *Provider) 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 )
const PodPhaseInitialize = "Initializing"
Variables ¶
var (
KubeletVersion = "test"
)
Functions ¶
func AddSessionContext ¶
func CheckIfAnnotationExists ¶
CheckIfAnnotationExists checks if a specific annotation (key) is available between the annotation of a pod
func GetResources ¶
func GetResources(config Config) v1.ResourceList
func LogRetrieval ¶
func LogRetrieval(ctx context.Context, config Config, logsRequest types.LogStruct, sessionContext string) (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 NodeCondition ¶
func NodeCondition(ready bool) []v1.NodeCondition
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 ¶
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
func SetDefaultResource ¶
func SetDefaultResource(config *Config)
Types ¶
type Config ¶
type Config 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"` HTTP HTTP `yaml:"HTTP"` KubeletHTTP HTTP `yaml:"KubeletHTTP"` CPU string `yaml:"CPU,omitempty"` Memory string `yaml:"Memory,omitempty"` Pods string `yaml:"Pods,omitempty"` GPU string `yaml:"nvidia.com/gpu,omitempty"` }
Config holds the whole configuration
type Crtretriever ¶
type Crtretriever func(*tls.ClientHelloInfo) (*tls.Certificate, 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 ¶
func NewSelfSignedCertificateRetriever(nodeName string, nodeIP net.IP) Crtretriever
newSelfSignedCertificateRetriever creates a new retriever for self-signed certificates.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider defines the properties of the virtual kubelet provider
func NewProvider ¶
func NewProvider( ctx context.Context, providerConfig, nodeName, nodeVersion, operatingSystem string, internalIP string, daemonEndpointPort int32, ) (*Provider, error)
NewProvider creates a new Provider, which implements the PodNotifier and other virtual-kubelet interfaces
func NewProviderConfig ¶
func NewProviderConfig( config Config, nodeName string, nodeVersion string, operatingSystem string, internalIP string, daemonEndpointPort int32, ) (*Provider, error)
NewProviderConfig takes user-defined configuration and fills the Virtual Kubelet provider struct
func (*Provider) GetLogs ¶
func (p *Provider) GetLogs(ctx context.Context, namespace, podName, containerName string, opts api.ContainerLogOpts) (io.ReadCloser, error)
GetLogs implements the logic for interLink pod logs retrieval.
func (*Provider) GetPodStatus ¶
GetPodStatus returns the status of a pod by name that is "running". returns nil if a pod by that name is not found.
func (*Provider) GetStatsSummary ¶
GetStatsSummary returns dummy stats for all pods known by this provider.
func (*Provider) NotifyNodeStatus ¶
NotifyNodeStatus runs once at initiation time and set the function to be used for node change notification (native of vk) it also starts a go routine for continously checking the node status and availability
func (*Provider) NotifyPods ¶
NotifyPods is called to set a pod notifier callback function. Also starts the go routine to monitor all vk pods
func (*Provider) Ping ¶
Ping the kubelet from the cluster, this will always be ok by design probably
func (*Provider) RetrievePodsFromCluster ¶
RetrievePodsFromCluster scans all pods registered to the K8S cluster and re-assigns the ones with a valid JobID to the Virtual Kubelet. This will run at the initiation time only