We're in effect testing the K8s scheduler logic in the test
by setting taints, as opposed to the actual VK itself. If we
want to make sure the taint is set, we can just observe the node
object.
Instead, bind to the pod to the VK node explicitly.
* Add the /runningpods/ api endpoint
This adds an API endpoint from the kubelet (/runningpods/). It is
an endpoint on kubelet which is considered a "debug" endpoint, so
it might be worth exposing through the options, but by default
it is exposed in most k8s configs AFAICT.
* Add tracing of the kubernetes cluster during testing
This adds tracing to the testing to get the kubelet's logs upon
failure. In addition, it keeps track of the pods, and the node
statuses throughout the test.
* Add arguments to make virtual kubelet's log more useful
This adds a 5 minute timeout to the end-to-end tests. The end-to-end
tests typically run in under 2 minutes. On Circle-CI the timeout is
10 minutes, at which point, Circle CI just shoots the tests in the
head so we don't get any logs.
All of Kubernetes logging is based on klog. Klog currently does
not output any logging information to logrus, so you're flying
somewhat blind to Kubernetes internals.
This exposes the full set of configurables that klog offers,
but decorates (prefixes) the klog configuration with "klog".
This adds two concepts, where one encompasses the other.
Startup timeout
Startup timeout is how long to wait for the entire kubelet
to get into a functional state. Right now, this only waits
for the pod informer cache for the pod controllerto become
in-sync with API server, but this could be extended to other
informers (like secrets informer).
Wait For Startup
This changes the behaviour of the virtual kubelet to wait
for the pod controller to start before registering the node.
It is to avoid the race condition where the node is registered,
but we cannot actually do any pod operations.
I ran into a bunch of problems running goreleasers, and
some differences with goimports. This locks the versions
to versions that appear to work.
The goimports version is newer than the latest version run
on the repo, but it matches the version of Go used on the rest of
the project.
Clientset.Coordination is deprecated. We are meant to use the specific
version of the client: CoordinationV1beta1. Clientset.Coordination is
going to be removed in future versions of the client API.
When setting up the http server we return a cancel function to close all
the listeners down.
The issue here is we set the cancel function to nil and thereby cause a
panic when there is an error and the `defer` attempts to call cancel.
This fix just don't set a named return value for the cancel function to
make sure we don't overwrite it with a `return nil, err`.
This ensures that the `defer` can still call `cancel()`.
This cleans up the CLI code significantly.
Also makes some of this re-usable for providers who want to do so.
This also removes the main.go from the top of the tree of the repro,
instead moving it into cmd/virtual-kubelet.
This allows us to better utilize the package namespace (and e.g. mv the
`vkubelet` package to the top of the tree).
Allows us to make use of of make's target deps instead of re-execing
make in our build target just for custom, one-shot environment changes.
Keeps e2e bin in bin/e2e/virtual-kubelet.
* Add documentation for OpenStack provider
Signed-off-by: Hongbin Lu <hongbin034@gmail.com>
* Add maintainer for OpenStack provider
Signed-off-by: Hongbin Lu <hongbin034@gmail.com>
node.ResourceVersion must not be set when creating a node.
This issue prevents vk from resolving issues after the vk node instance
has been deleted (for whatever reason).
* Remove unused lock from the resource manager.
* Add service lister to the resource manager.
This change adds a service lister in the
resource manager.
This will be used to set the service env vars.
Also added a List method to the resource manager
and a simple test to confirm it's a pass through.
* Patch the node status instead of updating it.
Virtual-kubelet updates the node status periodically.
This change proposes we use the `Patch` API instead of `Update`,
to update the node status.
This avoids overwriting any node updates made by other controllers
in the system, for example a attach-detach controller.
Patch API does a strategic merge instead of overwriting
the entire object, which ensures parallel updates don't overwrite
each other.
Note: `PatchNodeStatus` reduces the time precision to the seconds-level
and therefore I corrected the test for this.
consider two controllers:
CONTROLLER 1 (virtual kubelet) | CONTROLLER 2
oldNode := nodes.Get(nodename) |
| node := nodes.Get(nodename)
| // update status with attached volumes info
| updateNode := Nodes.UpdateStatus(node)
// update vkubelet info on node status |
latestNode := Nodes.UpdateStatus(oldNode) |
<-- latestNode does not contain the volume info added by second controller.
with my patch change:
CONTROLLER 1 (virtual kubelet) | CONTROLLER 2
oldNode := Nodes.Get(nodename) |
| node := Nodes.Get(nodename)
| // update status with attached volumes info
| updateNode := Nodes.UpdateStatus(node)
node := oldNode.DeepCopy() |
// update vkubelet info on node status |
latestNode := util.PatchNodeStatus(oldNode, node) |
<-- latestNode contains the volume info added by second controller.
Testing Done: make test
* Introduce PatchNodeStatus into vkubelet.
* Pass only the node interface.