Commit Graph

3628 Commits

Author SHA1 Message Date
ea1b247d3f fix: Fix connectivity active VPN check
During the conversion to typescript, the VPN active check was being
performed on the directory, and not the file that the VPN creates,
meaning it would always return true (as we explicitly create the
directory on startup if it does not exist).

Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-03-07 18:39:32 +00:00
6f79702099 state-engine: Add rate limited steps to device-config
In the case of an airgapped supervisor, with a target state that
requests the vpn be enabled, the supervisor will constantly loop on
trying to set the vpn to on. Unfortunately the vpn requires an internet
connection to be configured, so it will never be turned on.

We add the concept of no-ops to the device-config state change steps,
and don't end the state engine transition while these are present
(similar to how image pulls are implemented).

Change-type: minor
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-03-07 18:39:30 +00:00
9c55574533 v9.8.7 v9.8.7 2019-02-28 12:53:57 +01:00
9009f08c92 Merge pull request #922 from balena-io/include-api-url-with-device-api-key
feature: Add `BALENA_API_URL` environment variable
2019-02-28 11:52:02 +00:00
aeb96aa807 feature: Add BALENA_API_URL environment variable when using the balena-api feature label
When using the label `io.balena.features.balena-api` the supervisor will inject 2 environment
variables into the container:
- BALENA_API_KEY
- BALENA_API_URL

This allows the container to access the currently associated API using the KEY.

Change-type: patch
Signed-off-by: Rich Bayliss <rich@balena.io>
Connects-to: #847
2019-02-28 11:41:28 +00:00
50d2df73a1 v9.8.6 v9.8.6 2019-02-25 14:12:08 +01:00
987de0e097 debug: Print more information about failing validations
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-02-25 13:22:09 +01:00
f9626a3ee4 device-config: Add migration for SUPERVISOR_DELTA_APPLY_TIMEOUT
The default value for the delta apply timeout was changed from `''` to
`'0'` (note strings as these are database values) - but if the value
existed in the database already, this would fail validation. We add a
migration which will look explcitily for the failing value and switch it
to the new default.

Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-02-25 13:22:02 +01:00
bdaf1bc41f v9.8.5 2019-02-25 13:21:33 +01:00
c9507e013c Increase max payload size in bodyparser to avoid PayloadTooLarge errors
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-02-25 13:18:55 +01:00
58fa0ac761 v9.8.4 2019-02-25 13:16:22 +01:00
0e3f260978 Fix provisioning workflow when UUID already exists
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-02-22 10:53:24 +00:00
19584c465a v9.8.3 v9.8.3 2019-02-19 19:10:49 +01:00
6e603928d1 Merge pull request #913 from balena-io/synchronous-iptables
Run iptables rules synchronous to avoid locking errors
2019-02-19 18:08:45 +00:00
911ee7f009 Run iptables rules synchronous to avoid locking errors
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-02-19 17:43:04 +00:00
b3f90e94ec v9.8.2 v9.8.2 2019-02-19 18:09:32 +01:00
431bf15a71 Merge pull request #912 from balena-io/revert-node8
Revert "Upgrade to node 8 for supported architectures"
2019-02-19 17:07:37 +00:00
b3a07da8e4 Revert "Upgrade to node 8 for supported architectures"
This reverts commit 338ba4cdd7.

This is to unblock the release of the supervisor version, pending the
fix of the introduction of the race condition currently affecting v2
deltas.

Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-02-19 14:48:19 +00:00
112bc644c4 v9.8.1 v9.8.1 2019-02-14 15:06:34 +01:00
229f478efc Merge pull request #906 from balena-io/dont-remount
Don't mount /lib/modules if it is already mounted
2019-02-14 14:04:20 +00:00
fae2548f27 Don't mount /lib/modules if it is already mounted
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-02-14 13:49:03 +00:00
adc8ef231e v9.8.0 v9.8.0 2019-02-14 10:40:54 +01:00
a7b709bf34 Merge pull request #871 from balena-io/867-block-ipv6
Apply iptables rules to ipv6
2019-02-14 09:38:48 +00:00
5f82f6fd3f Apply iptables rules to ipv6
Change-type: patch
Closes: #867
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-02-13 20:57:05 +00:00
93c24298ff Symlink kernel modules and modprobe ip6_tables
Change-type: minor
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-02-13 20:57:05 +00:00
cff5965d5e v9.7.7 v9.7.7 2019-02-13 17:02:02 +01:00
321d9e39cf Merge pull request #904 from balena-io/fix-deltas
Fix image token authentication, and image fetch backoff in all cases
2019-02-13 16:00:15 +00:00
7bd7f7e025 Improve error messages, and add description to ImageAuth error
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-02-13 15:44:42 +00:00
81ec85c581 fix: Request image authentication token with explicitly as json
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-02-13 15:43:55 +00:00
d9177404b5 Always back off on image fetch failure
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-02-13 15:43:18 +00:00
c6d20a598b v9.7.6 v9.7.6 2019-02-12 15:29:43 +01:00
775643d58b Merge pull request #902 from balena-io/843-better-healthcheck
Don't treat a non-200 status response on patch as report errors
2019-02-12 14:28:03 +00:00
06580bf437 Don't treat a non-200 status response on patch as report errors
Non-200 errors were causing the watchdog to restart the supervisor,
which in some cases could cause a restart loop. Instead we change the
code to only treat communication failures as an error, and report status
code failures directly.

Change-type: patch
Closes: #843
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-02-12 13:56:54 +00:00
e2cd757b46 v9.7.5 v9.7.5 2019-02-12 13:29:17 +01:00
b03338ca8e Merge pull request #901 from balena-io/fix-whitespace-handling
Fix whitespace handling in environment variables
2019-02-12 12:27:14 +00:00
49dbaaba12 Allow newlines to be part of environment variables
We were not allowing newlines previously by virtue of the regex not
allowing them. The docker daemon and supervisor handling code both
support them, so we allow them in the parsing code too.

Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-02-12 11:19:55 +00:00
6bf008cc85 Remove environment variable whitespace trimming
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-02-11 17:13:35 +00:00
3b43579da7 v9.7.4 v9.7.4 2019-02-11 14:19:11 +01:00
3e98222064 Merge pull request #900 from balena-io/fix-config-change-events
Make sure to correctly convert config emit events after validation
2019-02-11 13:17:30 +00:00
3d6dc88eb0 Make sure to correctly convert config emit events after validation
We were validating the input configuration values by coercing them to
the correct type, and then using the initial value to be saved (which
currently is always converted to a string).

We now use the coerced value as the actual value we will store, and more
importantly emit. This means that the config.on('change' ...) calls will
always be properly typed, which before this change was not a guarantee
that we could make.

Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-02-11 11:22:08 +00:00
5567682c1c v9.7.3 v9.7.3 2019-02-11 11:54:12 +01:00
c48e37556e Merge pull request #899 from balena-io/delta-apply-timeout
Set default delta apply timeout of 0
2019-02-11 10:52:36 +00:00
88f19b4147 Set default delta apply timeout of 0
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-02-11 10:21:04 +00:00
d19e63d38f v9.7.2 v9.7.2 2019-02-11 11:05:10 +01:00
7c81061898 Merge pull request #898 from balena-io/897-normalise-compose-ports
fix: Normalize ports from compose file on instantiation
2019-02-11 10:03:25 +00:00
f3264862ca fix: Normalize ports from compose file on instantiation
Adjacent ports are always grouped together by docker when reporting the
container state (from an inspect), so adjacent ports defined in the
compose file would not match as they would not have been normalized.

We make sure to always normalize the input port configuration, so that
it will match the docker output (if it should).

We also don't sort in the fromComposePorts function anymore as that is
handled by the normalize function.

Closes: #897
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-02-08 15:14:07 +00:00
04a9790e11 v9.7.1 v9.7.1 2019-02-06 13:25:17 +01:00
7d25f79dc6 Merge pull request #893 from balena-io/841-delete-then-download
fix: Rework delete-then-download handling in state engine
2019-02-06 12:24:09 +00:00
e9b51bbcd7 fix: Rework delete-then-download handling in state engine
In the original implementation it was possible that the delete did not
wait for the kill step to be finished, so it would not be deleted.

We seperate this process into two steps, to allow for the container to
have stopped before proceeding.

Change-type: patch
Closes: #841
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-02-06 11:41:05 +00:00
9d8552ea8d v9.7.0 v9.7.0 2019-02-05 20:55:12 +01:00