Adds some package docs (#479)
Was just browing godoc and noticed we are missing some docs that would be quite useful.
This commit is contained in:
7
manager/doc.go
Normal file
7
manager/doc.go
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
// Package manager provides access to kubernetes resources for providers.
|
||||||
|
//
|
||||||
|
// DEPRECATION WARNING:
|
||||||
|
// Though this package is still in use, it should be considered deprecated as it
|
||||||
|
// is just wrapping a k8s client and not much else.
|
||||||
|
// Implementers should look at replacing their use of this with something else.
|
||||||
|
package manager
|
||||||
3
vkubelet/api/doc.go
Normal file
3
vkubelet/api/doc.go
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
// Package api implements HTTP handlers for handling requests that the kubelet
|
||||||
|
// would normally implement, such as pod logs, exec, etc.
|
||||||
|
package api
|
||||||
44
vkubelet/doc.go
Normal file
44
vkubelet/doc.go
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
Package vkubelet implements the core virtual-kubelet framework.
|
||||||
|
It contains everything reuired to implement a virtuak-kubelet, including the
|
||||||
|
core controller which reconciles pod states and API endpoints for things like
|
||||||
|
pod logs, exec, attach, etc.
|
||||||
|
|
||||||
|
To get started, call the `New` with the appropriate config. When you are ready
|
||||||
|
to start the controller, which registers the node and starts watching for pod
|
||||||
|
changes, call `Run`. Taints can be used ensure the sceduler only schedules
|
||||||
|
certain workloads to your virtual-kubelet.
|
||||||
|
|
||||||
|
vk := vkubelet.New(...)
|
||||||
|
// setup other things
|
||||||
|
...
|
||||||
|
vk.Run(ctx, ...)
|
||||||
|
|
||||||
|
After calling start, cancelling the passed in context will shutdown the
|
||||||
|
controller.
|
||||||
|
|
||||||
|
Up to this point you have a running virtual kubelet controller, but no HTTP
|
||||||
|
handlers to deal with requests forwarded from the API server for things like
|
||||||
|
pod logs (e.g. user calls `kubectl logs myVKPod`). This package provides some
|
||||||
|
helpers for this: `AttachPodRoutes` and `AttachMetricsRoutes`.
|
||||||
|
|
||||||
|
mux := http.NewServeMux()
|
||||||
|
vkubelet.AttachPodRoutes(provider, mux)
|
||||||
|
|
||||||
|
You must configure your own HTTP server, but these helpers will add handlers at
|
||||||
|
the correct URI paths to your serve mux. You are not required to use go's
|
||||||
|
built-in `*http.ServeMux`, but it does implement the `ServeMux` interface
|
||||||
|
defined in this package which is used for these helpers.
|
||||||
|
|
||||||
|
Note: The metrics routes may need to be attached to a different HTTP server,
|
||||||
|
depending on your configuration.
|
||||||
|
|
||||||
|
For more fine-grained control over the API, see the `vkubelet/api` package which
|
||||||
|
only implements the HTTP handlers that you can use in whatever way you want.
|
||||||
|
|
||||||
|
This uses open-cenesus to implement tracing (but no internal metrics yet) which
|
||||||
|
is propagated through the context. This is passed on even to the providers. We
|
||||||
|
may look at supporting custom propagaters for providers who would like to use a
|
||||||
|
different tracing format.
|
||||||
|
*/
|
||||||
|
package vkubelet
|
||||||
Reference in New Issue
Block a user