Commit Graph

881 Commits

Author SHA1 Message Date
Brian Goff
4fd2b754b5 Merge pull request #923 from sargun/fix-linter
Enable all linters by default
2020-12-04 10:50:28 -08:00
Sargun Dhillon
52e823a2c1 Merge pull request #913 from sargun/refactor-node-ping-controller
Refactor node ping controller
2020-12-04 00:25:21 -08:00
Sargun Dhillon
11c63bca6f Refactor the way that the that node_ping_controller works
This moves node ping controller to using the new internal lock
API.

The reason for this is twofold:
* The channel approach that was used to notify other
  controllers of changes could only be used once (at startup),
  and couldn't be used in the future to broadcast node
  ping status. The idea idea is here that we could move
  to a sync.Cond style API and only wakeup other controllers
  on change, as opposed to constantly polling each other
* The problem with sync.Cond is that it's not context friendly.
  If we want to do stuff like wait on a sync.cond and use a context
  or a timer or similar, it doesn't work whereas this API allows
  context cancellations on condition change.

The idea is that as we have more controllers that act as centralized
sources of authority, they can broadcast out their state.
2020-12-03 11:40:01 -08:00
Sargun Dhillon
d64d427ec8 Enable all linters by default
This removes the directive from .golangci.yml to disable all linters,
and fixes the relevant bugs / issues that are exposed.
2020-12-03 11:33:06 -08:00
Sargun Dhillon
d562b71d9a Merge pull request #874 from cwdsuzhou/master
Allow to update pod status in K8s if it is deleting in Provider
2020-11-24 01:09:07 -08:00
wadecai
966a960eef Allow to delete pod in K8s if it is deleting in Provider
For example:
Provier is a K8s provider, pod created by deployment would be evicted when node is not ready.
If we do not delete pod in K8s, deployment would not create a new one.

Add some tests for updateStatus
2020-11-24 15:04:25 +08:00
Brian Goff
9454f1fde8 Merge pull request #919 from sargun/configure-logging-for-envtest
In envtest, configure the logger correctly
2020-11-19 15:43:23 -08:00
Sargun Dhillon
8812427117 In envtest, configure the logger correctly
This configures the global logger the same as the local logger,
and adds the test name. It also uses the logger with the test
context as the context logger.
2020-11-17 23:28:59 -08:00
Sargun Dhillon
331a13f514 Merge pull request #898 from turkenh/retry-if-failed
Don't skip pods status update if provider failed once but recovered with retry
2020-11-16 14:11:17 -08:00
Hasan Turken
42f7c56d32 Don't skip pods status update if podStatusReasonProviderFailed
Closes #399

Signed-off-by: Hasan Turken <turkenh@gmail.com>
2020-11-16 13:57:48 -08:00
Brian Goff
7af4ea5b0a Merge pull request #916 from sargun/add-useful-envtests
Add useful envtests
2020-11-16 12:07:11 -08:00
Sargun Dhillon
5bef4ea63b Add some more envtests
This tests if the lease is created
2020-11-16 11:56:01 -08:00
Brian Goff
84a2528741 Merge pull request #914 from sargun/simpler-envtest
Do not export KUBEBUILDER_ASSETS variable
2020-11-16 11:46:01 -08:00
Sargun Dhillon
1a2c0bb029 Do not export KUBEBUILDER_ASSETS variable
This sets KUBEBUILDERA_ASSETS only for envtest. No need to leak
the variable throughout the tests. In addition, it makes it easier
to figure out how to run the tests yourself on command line.
2020-11-16 11:11:52 -08:00
Brian Goff
93d9a5c9f8 Merge pull request #915 from sargun/add-fmt-target
Add fmt target
2020-11-16 10:43:41 -08:00
Brian Goff
4d271c5b53 Merge pull request #918 from sargun/remove-q
Remove $Q Makefile command surpression
2020-11-16 10:42:00 -08:00
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
0b946848ee Add fmt target
This adds a target that allows the users to run goimports
across the entire repo.
2020-11-16 03:49:02 -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