Commit Graph

4852 Commits

Author SHA1 Message Date
Felipe Lalanne
5af948483a
Use stream pipeline instead of pipe
This also removes the use of JSONStream from the monitor module

Change-type: patch
2024-07-30 10:51:19 -04:00
Felipe Lalanne
dbacca977a
Do not use DB to store container logs info
This removes the dependence of the supervisor on the containerLogs
database for remembering the last sent timestamp. This commit instead
uses the supervisor startup time as the initial time for log retrieval.
This might result in some logs missing for services that may start
before the supervisor after a boot, or if the supervisor restarts.
However this seems like an acceptable trade-off as the current
implementation seems to make things worst in resource contrained
environments.

We'll move storing the last sent timestamp to a better storage medium in
a future commit.

Change-type: minor
2024-07-30 10:51:18 -04:00
flowzone-app[bot]
4a8bf14196
v16.4.6 2024-07-30 14:43:25 +00:00
balena-renovate[bot]
df5558edf6
Merge pull request #2359 from balena-os/renovate/patch-semver
Update semver to v7.6.3
2024-07-30 14:42:31 +00:00
Self-hosted Renovate Bot
340e69d0c2 Update semver to v7.6.3
Update semver from 7.6.2 to 7.6.3

Change-type: patch
2024-07-25 15:09:28 +00:00
flowzone-app[bot]
c399792cba
v16.4.5 2024-07-25 14:31:20 +00:00
balena-renovate[bot]
0f1abcbd0f
Merge pull request #2358 from balena-os/renovate/balena-io-deploy-to-balena-action-2.0.x
Update balena-io/deploy-to-balena-action action to v2.0.74
2024-07-25 14:30:19 +00:00
Self-hosted Renovate Bot
92be067b0d Update balena-io/deploy-to-balena-action action to v2.0.74
Update balena-io/deploy-to-balena-action from 2.0.72 to 2.0.74

Change-type: patch
2024-07-25 14:08:55 +00:00
flowzone-app[bot]
f2f229915d
v16.4.4 2024-07-17 14:48:54 +00:00
Page-
b7ca7fb3d2
Merge pull request #2353 from balena-os/log-message-typing
Improve log message typing
2024-07-17 15:47:53 +01:00
Pagan Gazzard
4976578a83 Improve log message typing
Change-type: patch
2024-07-17 11:14:17 +01:00
flowzone-app[bot]
ef8414bd9e
v16.4.3 2024-07-16 22:28:19 +00:00
Page-
cafd8e89e5
Merge pull request #2352 from balena-os/optimize-logs
Optimize logs
2024-07-16 23:27:30 +01:00
Pagan Gazzard
c5d0eafea9 Logs: only truncate the message if it's possible it will need it
Change-type: patch
2024-07-16 18:09:12 -04:00
Pagan Gazzard
34cf8b6708 Logs: skip setting default values if we're dropping as an invalid log
Change-type: patch
2024-07-16 18:09:12 -04:00
Pagan Gazzard
0a817af10c Logs: only call Date.now() if a timestamp is not already present
Change-type: patch
2024-07-16 18:09:12 -04:00
flowzone-app[bot]
405ddf2c33
v16.4.2 2024-07-16 21:55:53 +00:00
flowzone-app[bot]
7710c03421
Merge pull request #2355 from balena-os/state-engine-tests
Cleanup images after state-engine tests
2024-07-16 21:55:04 +00:00
Felipe Lalanne
f38714d40f
Cleanup images after state-engine tests
Tests on GitHub started failing recently because of leftover images from
the state engine test suite. This fixes that issue to allow tests to
pass.

Change-type: patch
2024-07-16 16:33:52 -04:00
flowzone-app[bot]
c4a530c9ea
v16.4.1 2024-07-05 21:13:43 +00:00
flowzone-app[bot]
55a81aaeb2
Merge pull request #2350 from balena-os/instanceof-error
Remove custom typings for docker-delta
2024-07-05 21:12:53 +00:00
Felipe Lalanne
fbdd7ee8b9
Update docker-delta to v4.1.0
The new version now properly exports OutOfSyncError.
2024-07-05 12:28:19 -04:00
Felipe Lalanne
28706510da
Remove custom typings for docker-delta
This are no longer needed since docker-delta migrated to typescript in
v4 and the custom typings were actually masking some bugs

Change-type: patch
2024-07-04 18:41:33 -04:00
flowzone-app[bot]
7c340f9675
v16.4.0 2024-07-04 20:25:40 +00:00
flowzone-app[bot]
da807e45f6
Merge pull request #2329 from balena-os/refactor-host-config-module
Refactor host config module
2024-07-04 20:24:45 +00:00
Christina Ying Wang
f99ccb58c6 Remove unnecessary exports from host-config
This limits the host-config interface to necessary methods
only

Signed-off-by: Christina Ying Wang <christina@balena.io>
2024-07-03 16:47:51 -07:00
Christina Ying Wang
53f5641ef1 Refactor host-config to be its own module
The host-config module exposes the following interfaces: get,
patch, and parse.

`get` gets host configuration such as redsocks proxy configuration
and hostname and returns it in an object of type HostConfiguration.

`patch` takes an object of type HostConfiguration or LegacyHostConfiguration
and updates the hostname and redsocks proxy configuration, optionally
forcing the patch through update locks.

`parse` takes a user input of unknown type and parses it into type
HostConfiguration or LegacyHostConfiguration for patching, erroring if
parse was unsuccessful.

LegacyHostConfiguration is a looser typing of the user input which does
not validate values of the five known proxy fields of type, ip, port,
username, and password. We should stop supporting it in the next
major Supervisor API release.

Change-type: minor
Signed-off-by: Christina Ying Wang <christina@balena.io>
2024-07-03 16:47:51 -07:00
Christina Ying Wang
be986a62a5 Add HostConfig.parse method
Parses input from PATCH /v1/device/host-config into either
type HostConfiguration, or if LegacyHostConfiguration if
input is of an acceptable shape (for backwards compatibility).

Once input has been determined to be of type HostConfiguration,
we can easily extract ProxyConfig from the object for patching,
stringifying, and writing to redsocks.conf.

Change-type: minor
Signed-off-by: Christina Ying Wang <christina@balena.io>
2024-07-03 16:47:51 -07:00
Christina Ying Wang
f17f7efe60 Add HostConfig.patchProxy method
Signed-off-by: Christina Ying Wang <christina@balena.io>
2024-07-03 16:47:49 -07:00
Christina Ying Wang
9c6681bb23 Add RedsocksConf.stringify method
`stringify` takes a RedsocksConfig, an internal object
representation of the redsocks.conf file, and transforms
it into a valid string that can be written to redsocks.conf.

Signed-off-by: Christina Ying Wang <christina@balena.io>
2024-07-03 16:45:52 -07:00
Christina Ying Wang
1e224be0cd Add RedsocksConf.parse method
This is part of the host-config refactor which
enables easier encoding to / decoding from `redsocks.conf`.

Signed-off-by: Christina Ying Wang <christina@balena.io>
2024-07-03 16:45:06 -07:00
Christina Ying Wang
725d7790fb Move noProxy handling to separate module
Signed-off-by: Christina Ying Wang <christina@balena.io>
2024-06-28 11:34:27 -07:00
Christina Ying Wang
0cf5a4bf18 Move hostname get/set to separate "module" (directory)
Signed-off-by: Christina Ying Wang <christina@balena.io>
2024-06-28 11:34:21 -07:00
flowzone-app[bot]
1c81eafd7c
v16.3.17 2024-06-25 01:03:32 +00:00
flowzone-app[bot]
88db2962a8
Merge pull request #2349 from balena-os/network-remove
Fix engine deadlock on network+service change
2024-06-25 01:02:22 +00:00
Felipe Lalanne
ede27b63ce
Fix engine deadlock on network+service change
This fixes a regression on the supervisor state engine computation
(added on v16.2.0) when
the target state removes a network at the same time that a service
referencing that network is changed. Example going from

```
services:
   one:
      image: alpine: 3.18
      networks: ['balena']

networks:
   balena:
```

to

```
services:
   one:
      image: alpine: latest
```

Would never reach the target state as killing the service in order to
remove the network is prioritized, but one of the invariants in the target state calculation is
to not kill any services until all images have been downloaded. These
two instructions were in contradiction leading to a deadlock.

The fix involves only adding removal steps for services depending on a
changing network or volume if the service container is not being removed
already.

Change-type: patch
2024-06-24 18:12:12 -04:00
Felipe Lalanne
5d93f358aa
Create replicating test
This adds a test to check the case where a service image changes along
with networks being removed.
2024-06-24 15:54:19 -04:00
flowzone-app[bot]
1c3e24ec29
v16.3.16 2024-06-17 01:56:14 +00:00
balena-renovate[bot]
1fe754ca34
Merge pull request #2346 from balena-os/renovate/balena-io-deploy-to-balena-action-2.0.x
Update balena-io/deploy-to-balena-action action to v2.0.72
2024-06-17 01:55:12 +00:00
Self-hosted Renovate Bot
170733422a Update balena-io/deploy-to-balena-action action to v2.0.72
Update balena-io/deploy-to-balena-action from 2.0.71 to 2.0.72

Change-type: patch
2024-06-17 01:36:59 +00:00
flowzone-app[bot]
20fa8fd0c3
v16.3.15 2024-06-10 01:57:08 +00:00
balena-renovate[bot]
17e0e08b97
Merge pull request #2344 from balena-os/renovate/balena-io-deploy-to-balena-action-2.0.x
Update balena-io/deploy-to-balena-action action to v2.0.71
2024-06-10 01:56:08 +00:00
Self-hosted Renovate Bot
552f77cef5 Update balena-io/deploy-to-balena-action action to v2.0.71
Update balena-io/deploy-to-balena-action from 2.0.70 to 2.0.71

Change-type: patch
2024-06-10 01:36:51 +00:00
flowzone-app[bot]
0a3ce26116
v16.3.14 2024-06-09 13:30:01 +00:00
balena-renovate[bot]
a22c2049d6
Merge pull request #2343 from balena-os/renovate/got
Update got to v14.4.1
2024-06-09 13:29:01 +00:00
Self-hosted Renovate Bot
11628cda16 Update got to v14.4.1
Update got from 14.3.0 to 14.4.1

Change-type: patch
2024-06-09 13:09:09 +00:00
flowzone-app[bot]
2b8227dd0a
v16.3.13 2024-06-05 20:43:15 +00:00
flowzone-app[bot]
89baf8dec3
Merge pull request #2340 from balena-os/refactor-device-state
Refactor device state module
2024-06-05 20:42:13 +00:00
Felipe Lalanne
45d1f1f964
Split target state set/get into separate module
This removes the circular dependency between device state index and
preloading and cleans up the device state module code

Change-type: patch
2024-06-03 11:40:47 -04:00
Felipe Lalanne
fedeb518e5
Move device-state.ts into the device-state/index.ts
Change-type: patch
2024-06-03 11:40:47 -04:00