Commit Graph

814 Commits

Author SHA1 Message Date
Sargun Dhillon
258e809721 Remove $Q Makefile command surpression
The whole $Q thing is unintuitive and that's not how Makefiles
typically act. It's confusing.
2020-11-16 10:30:30 -08:00
Sargun Dhillon
79d2ef1f12 Merge pull request #910 from sargun/fix-env-empty-env-var-2
Fix empty environment variables
2020-11-13 11:43:27 -08:00
Sargun Dhillon
21ffe6f0ae Merge pull request #905 from sargun/fix-env-empty-env-var-2
Refactor env.go
2020-11-13 10:41:56 -08:00
Sargun Dhillon
af77bc8364 Fix empty environment variables 2020-11-13 10:36:17 -08:00
Sargun Dhillon
9883707707 Split out each of getEnvironmentVariableValueWithValueFrom*
This takes the multiple mechanisms to do getEnvironmentVariableValueWithValueFrom*
and splits them out into their own functions.
2020-11-13 10:29:33 -08:00
Sargun Dhillon
afe0f52689 Split out getEnvironmentVariableValueWithValueFrom
This splits out all of the ValueFrom environment variable derivation
code into its own function: getEnvironmentVariableValueWithValueFrom
2020-11-13 10:29:33 -08:00
Sargun Dhillon
06c089843e Refactor env.go
This copies and pastes the loop that used to exist in

func populateEnvironmentVariables(..) {
	...
	for _, env := range container.Env {
		... <--- This code
	}
}

Into getEnvironmentVariableValue. getEnvironmentVariableValue
returns val, err, where val is a pointer to a string
to indicate optionality.
2020-11-13 10:29:29 -08:00
Brian Goff
affbd27827 Merge pull request #909 from feiskyer/fix-label
Ensure label node.kubernetes.io/exclude-from-external-load-balancers is added to virtual node
2020-11-13 10:14:25 -08:00
Pengfei Ni
5f1a53c580 Ensure label node.kubernetes.io/exclude-from-external-load-balancers is added to virtual node 2020-11-13 13:16:23 +08:00
Brian Goff
05e9aa2858 Merge pull request #870 from sargun/add-envtest
Add envtest
2020-11-12 15:37:23 -08:00
Sargun Dhillon
1c581260d5 Add envtest
I know it's not an impressive test. It just brings up a node, and
makes sure it registers. Let's do more in the future.

Signed-off-by: Sargun Dhillon <sargun@sargun.me>
2020-11-06 20:37:35 -08:00
Sargun Dhillon
cd68e70627 Merge pull request #904 from sargun/upgrade-golint-to-v1.32.2
Upgrade golint to v1.32.2
2020-11-06 17:24:36 -08:00
Sargun Dhillon
5f63e9d30a Upgrade to golangci-lint v1.32.2 2020-11-06 17:09:47 -08:00
Sargun Dhillon
544cca975f Fix error handling behaviour in nodeutil
Golang Lint v1.32.2 detects this case:
node/nodeutil/client.go:28:12: ineffectual assignment to `err` (ineffassign)
			config, err = rest.InClusterConfig()
			        ^
node/nodeutil/client.go:30:12: ineffectual assignment to `err` (ineffassign)
			config, err = clientcmd.NewNonInteractiveDeferredLoadingClientConfig(
			        ^
2020-11-06 17:09:47 -08:00
Sargun Dhillon
b4e62a645b Revert "Upgrade to golangci-lint v1.32.2" 2020-11-06 17:08:38 -08:00
Sargun Dhillon
ba79256b1d Merge pull request #901 from sargun/upgrade-golint-to-v1.32.2
Upgrade to golangci-lint v1.32.2
2020-11-06 17:07:48 -08:00
Brian Goff
2716c38e1f Merge branch 'master' into upgrade-golint-to-v1.32.2 2020-11-06 16:08:09 -08:00
Brian Goff
6b8e772dad Merge pull request #900 from sargun/mov-env
Move env var code into its own package
2020-11-06 15:20:29 -08:00
Sargun Dhillon
c437e05ad0 Move env var code into its own package
This creates a new package -- podutils. The env var related code
doesn't really have any business being part of the node package,
and to create a separation of concerns, faster tests, and just
general code isolation and cleanliness, we can move the env
var related code into this package. This change is purely hygiene,
and not logic related.

For node, the package is under internal, because the constructor
references manager, which is an internal package.
2020-11-06 14:49:53 -08:00
Sargun Dhillon
b9303714de Upgrade to golangci-lint v1.32.2 2020-11-06 14:45:19 -08:00
Brian Goff
621ee4bb1c Merge pull request #895 from charleszheng44/bug/nil-panic
Bug: when initialzing vk, use empty clientcmd.ConfigOverrides instead of nil
2020-11-06 14:35:31 -08:00
chao zheng
b793d89c66 when initialzing vk, use empty clientcmd.ConfigOverrides instead of nil 2020-10-28 15:34:16 -07:00
Brian Goff
590d2e7f01 Merge pull request #862 from cpuguy83/node_helpers 2020-10-26 15:00:45 -07:00
Brian Goff
d53d86053c Merge pull request #891 from DanielMSchmidt/patch-1
docs(e2e): make example e2e.go compilable
2020-10-12 15:44:26 -07:00
Daniel Schmidt
a34a4f0c9f docs(e2e): make example e2e.go compilable 2020-10-12 23:48:16 +02:00
Brian Goff
b91d892bff Merge pull request #884 from sargun/fix-provider-vs-server-node 2020-10-05 10:35:24 -07:00
Sargun Dhillon
84a169f25d Fix golang ci warner 2020-10-04 19:52:34 -07:00
Sargun Dhillon
946c616c67 Create stronger separation between provider node and server node
There were some (additional) bugs that were easy-ish to introduce
by interleaving the provider provided node, and the server provided
updated node. This removes the chance of that confusion.
2020-10-04 19:52:34 -07:00
Brian Goff
3c5e8fb6b1 Merge pull request #885 from sargun/fix-races 2020-09-29 16:52:52 -07:00
Sargun Dhillon
1c32b2c8ee Fix data race in test 2020-09-21 23:38:48 -07:00
Sargun Dhillon
cf2d5264a5 Fix datarace in node ping controller 2020-09-21 23:38:43 -07:00
Brian Goff
0c64171e85 Add v2 node provider for accepting status updates
This allows the use of a built-in provider to do things  like mark a node
as ready once all the controllers are spun up.

The e2e tests now use this instead of waiting on the pod that the vk
provider is deployed in to be marked ready (this was waiting on
/stats/summary to be serving, which is racey).
2020-09-17 13:52:58 -07:00
Brian Goff
4b74a01f8f Merge pull request #878 from lachie83/add-mailing-list 2020-09-17 10:09:46 -07:00
Lachlan Evenson
9b4dc639cf Fix spacing
Signed-off-by: Lachlan Evenson <lachlan.evenson@microsoft.com>
2020-09-17 09:58:50 -07:00
Lachlan Evenson
724bddd559 Add link to mailing list
Signed-off-by: Lachlan Evenson <lachlan.evenson@microsoft.com>
2020-09-17 09:57:25 -07:00
Brian Goff
5f5f23e668 Merge pull request #877 from lachie83/doc-update-inside-outside
Remove confusing internal external verbiage
2020-09-17 09:55:46 -07:00
Lachlan Evenson
5304a66f90 Remove confusing internal external verbiage
Signed-off-by: Lachlan Evenson <lachlan.evenson@microsoft.com>
2020-09-17 09:39:33 -07:00
Brian Goff
c1bc314c38 Merge pull request #876 from sargun/fix-lease-logs
Fix logging when leases are mis-set
2020-09-14 11:05:32 -07:00
Sargun Dhillon
3d1226d45d Fix logging when leases are mis-set
This fixes a small logic bug in the leases code for checking is owner
references are not set correctly, and makes it so that we properly
log when owner references are set, but not set to the node that
is "us".
2020-09-08 12:04:16 -07:00
Sargun Dhillon
f248259fb9 Merge pull request #873 from sargun/fix-node-ping
Fix node ping interval code / default setting code
2020-08-18 00:49:51 -07:00
Sargun Dhillon
cd059d9755 Fix node ping interval code / default setting code
Change the place where we set the defaults for node ping
and node status interval. This problem manifested itself
by the node ping interval being 0 when it was set to
the default.

This makes two changes:
1. Invalid ping values, and ping timeouts will not
   allow VK to start up
2. We set the default values very early on in creation
   of the node controller -- where all the other values
   are set.

Signed-off-by: Sargun Dhillon <sargun@sargun.me>
2020-08-18 00:39:14 -07:00
Brian Goff
66ee454e1a Merge pull request #872 from sargun/node-lease-controller 2020-08-17 12:38:27 -07:00
Sargun Dhillon
6845cf825a Delete and recreate lease on conflict
This takes a somewhat hamfisted approach at dealing with lease
conflicts. This can happen if "someone" changes the lease underneath
us. Again, this should happen rarely, but it can happen (And does
happen in production systems).

Signed-off-by: Sargun Dhillon <sargun@sargun.me>
2020-08-17 11:54:43 -07:00
Brian Goff
bad6076431 Merge pull request #863 from sargun/lease-v3 2020-08-10 16:36:01 -07:00
Sargun Dhillon
d390dfce43 Move node pinging to its own goroutine
This moves the job of pinging the node provider into its own
goroutine. If it takes a long time, it shouldn't slow down
leases, and vice-versa.

It also adds timeouts for node pings. One of the problems
is that we don't know how long a node ping will take --
there could be a bunch of network calls underneath us.

The point of the lease is to say whether or not the
Kubelet is unreachable, not whether or not the node
pings are "passing".

Signed-off-by: Sargun Dhillon <sargun@sargun.me>
2020-08-03 10:57:37 -07:00
Sargun Dhillon
49c596c5ca Split waitableInt into its own test file
This is merely a rearranging of the deck chairs and moving waitable
int into its own file since we intend to use it across multiple
tests.
2020-08-03 10:57:37 -07:00
Brian Goff
3fc79dc677 Merge pull request #871 from virtual-kubelet/set-node-lease-owner
Set Node Leader Owner Reference
2020-07-31 11:51:14 -07:00
Sargun Dhillon
4bdcba5b85 Set Node Leader Owner Reference
This sets / updates the node lease owner reference to the current
node. Previously, we did not set this, which had the interesting
problem of leaking node leases on clusters with node churn.
2020-07-31 11:23:47 -07:00
Brian Goff
40289aeb07 Merge pull request #860 from cpuguy83/contributing_updates
Add contributing guidelines
2020-07-31 11:17:14 -07:00
Brian Goff
851f5abedc Merge pull request #866 from cpuguy83/add_event_filter_support
Support custom filter for pod event handlers
2020-07-31 09:30:50 -07:00