Commit Graph

697 Commits

Author SHA1 Message Date
Brian Goff
196e1eda27 Merge branch 'master' into make-mock-provider-async2 2019-06-05 15:01:13 -07:00
Brian Goff
eeab8f9b1b Merge pull request #628 from sargun/use-running-pods
Use Running Pods Endpoint for testing
2019-06-05 14:59:52 -07:00
Brian Goff
9cc9ccea1a Merge branch 'master' into make-mock-provider-async2 2019-06-05 14:42:11 -07:00
Jeremy Rickard
a67b19310f Merge pull request #633 from cpuguy83/pod_status_error_handling
Handle not found case for status update
2019-06-04 17:41:50 -06:00
Brian Goff
73e44ddc68 Merge branch 'master' into pod_status_error_handling 2019-06-04 16:33:53 -07:00
Brian Goff
72de24d3c4 Merge pull request #651 from cpuguy83/fix_causal_lookup
Fix bad recursion in errdefs check
2019-06-04 16:33:19 -07:00
Brian Goff
f414dc8bf2 Fix bad recursion in errdefs check 2019-06-04 15:06:41 -07:00
Brian Goff
98ca5c8398 Handle not found case for status update
If we don't handle the "pod not found" case then we end up with the pod
getting re-queued over and over until the max retries are hit. It also
blocks the queue for other pod status updates for that pod
namespace/name.
2019-06-04 14:39:58 -07:00
Brian Goff
20e710043f Merge pull request #635 from cpuguy83/define_errdefs_package
Define errdefs package
2019-06-04 14:35:54 -07:00
Brian Goff
ece39fde19 Remove strongerrors dep 2019-06-04 14:29:25 -07:00
Brian Goff
d6b5ae3710 Remove usage of ocstatus package
This changes the tracing package to accept an error on SetStatus, which
is really what we always want anyway.
This also decouples the trace package from opencensus.
2019-06-04 14:29:25 -07:00
Brian Goff
02623170cc Use errdefs package 2019-06-04 14:29:23 -07:00
Brian Goff
b9711abff3 Add errdefs package
Providers should use this package so the virtual kubelet core
controllers can understand the errors produced from the provider code.
2019-06-04 14:13:54 -07:00
Brian Goff
8340407f98 Support error handler callback for node status (#648)
This moves the logic for re-creating the a missing node up into the CLI.
We can make this optional, but for now I've just preserved existing
functionality.
2019-06-01 09:46:47 -07:00
Yash Desai
1542c4d2f4 Allow composing env var from existing env vars. (#643)
Example:
env name:  FOO
    value: "foo"
    name:  BAR
    value: "bar"
    name:  FOOBAR
    value: "${FOO}${BAR}" <-- should expand to: "foobar"

Added testcase for the same as well.
Change is based on kubelet_pods.go.
Simplified some of the existing code.
2019-06-01 09:41:10 -07:00
Brian Goff
71546a908f Remove Server object (#629)
This had some weird shared responsibility with the PodController.
Instead just move the functionality to the PodController.
2019-06-01 09:36:38 -07:00
Brian Goff
21d8ba2206 Don't use -a on build (#646)
This lets us utilize the go build cache and significantly speeds up
builds.
2019-05-29 08:15:34 -07:00
pmould
acb36b6342 #622 add support for new regions for aws fargate (#623)
* #622 add support for new regions for aws fargate
2019-05-28 10:16:06 -07:00
Jeremy Rickard
42061ea1bc Merge pull request #634 from cpuguy83/mock_provider_in_vkubelet
Use custom mock in vkubelet tests
2019-05-21 05:38:47 -06:00
Sargun Dhillon
ec8972fef3 Use Running Pods Endpoint for testing
* Use the VKUBELET API for fetching the pods during testing, which
   makes it easier to run testing without wiring up an entire cluster
 * Runningpods does not require each provider to implement the
   optional stats interface for testing.
2019-05-20 15:58:50 -07:00
Brian Goff
2c5952587a Use custom mock in vkubelet tests
Don't use actual "mock" provider in vkubelet to reduce awkward import
cycles.
Really the "mock" provider is for e2e tests. Instead create our own mock
in the vkubelet package specifically for unit tests which can also be
more easily customized to test edge cases.
2019-05-20 11:20:28 -07:00
Sargun Dhillon
d183dbbe17 Upgrade to Go 1.12 (#630) 2019-05-20 11:39:47 +01:00
Sargun Dhillon
42e83ab984 Work around https://github.com/virtual-kubelet/virtual-kubelet/issues/632 2019-05-19 14:36:06 -07:00
Sargun Dhillon
dd71a884b3 Convert mock provider to async provider 2019-05-19 14:36:06 -07:00
Sargun Dhillon
d0c0d90451 Revert caching go builds (#631)
It turns out that using gocache on circleci like this makes it
so that builds are not properly invalidated, and breaks a
whole load of things.
2019-05-17 21:07:51 -07:00
Brian Goff
7dd49516d8 Decouple vkubelet/* packages from providers (#626)
This makes the concept of a `Provider` wholely implemented in the cli
implementation in cmd/virtual-kubelet.

It allows us to slim down the interfaces used in vkubelet (and
vkubelet/api) to what is actually used there rather than a huge
interface that is only there to serve the CLI's needs.
2019-05-17 17:01:05 -07:00
Jeremy Rickard
87e72bf4df Light up UpdatePod (#613)
* Light up UpdatePod

This PR updates the vkublet/pod.go createOrUpdate(..) method to actually handle
updates. It gets the pod from the provider as before, but now if it exists the method
checks the hash of the spec against the spec of the new pod. If they've changed, it
calls UpdatePod(..).

Also makes a small change to the Server struct to swap from kuberentes.Clientset to kubernetes.Interface
to better facilitate testing with fake ClientSet.

Co-Authored-By: Brian Goff <cpuguy83@gmail.com>
2019-05-17 11:14:29 -07:00
Sargun Dhillon
a3f933d998 Fix permission denied warnings during tests (#617)
For some reason the kubelet tries to do things that it gets perm
denied. This changes the base.yml in the skaffold file to have
the permissions. In turn, this broke the node deletion test. So,
instead of looking for the deletion event (imperative), we wait
for the node UID to change (declarative).
2019-05-17 10:53:24 -07:00
Sargun Dhillon
9e659145c1 Find / stash (new) gocache (#620)
- (In)validate cache by branch
2019-05-17 10:50:37 -07:00
Sargun Dhillon
9bf05b525d Remove setting taint during e2e test (#621)
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.
2019-05-17 10:49:37 -07:00
Sargun Dhillon
5b3190acb5 Cache go build artifacts (#619) 2019-05-14 16:29:21 -07:00
Brian Goff
e820c905b7 Remove unused Azure scripts (#618)
This were previously used for setting up azure creds for ACI specific
tests, but are no longer needed since that has moved to a separate repo.
2019-05-14 16:02:33 -07:00
Sargun Dhillon
63fa4e124b Add the /runningpods/ api endpoint (#611)
* 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.
2019-05-13 15:10:31 -07:00
Sargun Dhillon
c50f33e701 Add tracing of the kubernetes cluster during testing (#608)
* 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
2019-05-13 13:23:32 -07:00
Brian Goff
ae5e7953fe Merge pull request #614 from hectorj2f/hectorj2f/fix_gobin_path
Makefile: fix gobin path
2019-05-13 09:36:31 -07:00
Hector Fernandez
49e3cafa76 Makefile: fix gobin path 2019-05-11 13:08:21 +02:00
Brian Goff
024b9e10c6 Merge pull request #607 from sargun/fix-port-setting
Fix being able to set the VK's listening port
2019-05-09 16:22:54 -07:00
Brian Goff
616776f927 Merge pull request #609 from sargun/add-test-timeout
Add timeout to e2e tests
2019-05-09 16:19:59 -07:00
Brian Goff
c88770f2d0 Merge pull request #610 from sargun/fix-mock-logging
Fix formatting logging calls in the mock provider
2019-05-08 19:39:12 -07:00
Sargun Dhillon
0a6fc26064 Fix formatting logging calls in the mock provider
There were a bunch of logging calls in the mock provider which had
formatting in them, but didn't use the log-with-formatting method.
2019-05-08 17:37:20 -07:00
Sargun Dhillon
7d9350e3dd Add timeout to e2e tests
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.
2019-05-08 17:24:56 -07:00
Sargun Dhillon
cdfb468f51 Fix being able to set the VK's listening port 2019-05-08 17:18:42 -07:00
Brian Goff
d6e945bb93 Merge pull request #574 from cpuguy83/streaming_logs
Use I/O stream for provider logs interface
2019-05-08 09:25:19 -07:00
Brian Goff
3cc051f7c2 Use I/O stream for provider logs interface
Providers must still update the implementaiton to actually gain any
benefit here, but this makes the provider interface a bit more sane.
2019-05-08 09:17:29 -07:00
Sargun Dhillon
ce5f049401 Add the ability to configure klog from VK (#595)
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".
2019-05-08 11:37:04 +01:00
Brian Goff
5b9ddadc69 Merge pull request #596 from sargun/error-on-zpages-failure
Do not swallow errors from the zpages server silently
2019-05-07 09:20:11 -07:00
Brian Goff
fad8f6d1d0 Merge branch 'master' into error-on-zpages-failure 2019-05-07 09:14:08 -07:00
Brian Goff
ac847cdb29 Merge pull request #606 from sargun/move-to-lowercase-logrus
Move to lowercase Sirupsen/logrus
2019-05-06 18:08:58 -07:00
Sargun Dhillon
5ef5910b2f re-vendor sirupsen/logrus 2019-05-06 17:26:08 -07:00
Sargun Dhillon
740bec9ea0 Remove old github.com/Sirupsen/logrus 2019-05-06 17:26:05 -07:00