You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implements 'apiclient network configure <input-source>' to enable runtime
network configuration for Bottlerocket. stdin is the default input, but also
supports file://, base64: input sources with client-side URI processing.
Content is sent to the API server for further processing.
Signed-off-by: Yutong Sun <yutongsu@amazon.com>
Signed-off-by: Kyle Sessions <kssessio@amazon.com>
Copy file name to clipboardExpand all lines: sources/api/apiclient/README.md
+48-2Lines changed: 48 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ Current version: 0.1.0
5
5
## apiclient binary
6
6
7
7
The `apiclient` binary provides high-level methods to interact with the Bottlerocket API.
8
-
There's a [set](#set-mode) subcommand for changing settings, an [update](#update-mode) subcommand for updating the host, and an [exec](#exec-mode) subcommand for running commands in host containers.
8
+
There's a [set](#set-mode) subcommand for changing settings, a [network configure](#network-configure) subcommand for configuring network settings, an [update](#update-mode) subcommand for updating the host, and an [exec](#exec-mode) subcommand for running commands in host containers.
9
9
There's also a low-level [raw](#raw-mode) subcommand for direct interaction with the HTTP API.
10
10
11
11
It talks to the Bottlerocket socket by default.
@@ -75,6 +75,52 @@ You can use JSON form to set it:
75
75
apiclient set --json '{"motd": "42"}'
76
76
```
77
77
78
+
### Network configure
79
+
80
+
This allows you to configure network settings by providing a network configuration file. The configuration will be applied at the next boot.
81
+
82
+
The `network configure` command accepts input from different sources using URI schemes:
83
+
84
+
#### File URI input
85
+
86
+
You can specify a local file path using the `file://` URI scheme:
This is particularly useful for automation and configuration management where you want to embed the network configuration directly in scripts or user data.
101
+
102
+
#### Configuration format
103
+
104
+
The `net.toml` file uses the same format that netdog supports. Here's an example:
105
+
106
+
```toml
107
+
version = 2
108
+
109
+
[eth0]
110
+
dhcp4 = true
111
+
dhcp6 = false
112
+
113
+
[eth1]
114
+
static4 = ["192.168.1.100/24"]
115
+
route = [{to = "default", via = "192.168.1.1"}]
116
+
```
117
+
118
+
After configuring the network settings, you'll need to reboot the system for the changes to take effect:
119
+
120
+
```shell
121
+
apiclient reboot
122
+
```
123
+
78
124
### Update mode
79
125
80
126
To start, you can check what updates are available:
@@ -347,7 +393,7 @@ The results from each item in the report will be one of:
347
393
## apiclient library
348
394
349
395
The apiclient library provides high-level methods to interact with the Bottlerocket API. See
350
-
the documentation for submodules [`apply`], [`exec`], [`get`], [`reboot`], [`report`], [`set`],
396
+
the documentation for submodules [`apply`], [`exec`], [`get`], [`network`], [`reboot`], [`report`], [`set`],
351
397
and [`update`] for high-level helpers.
352
398
353
399
For more control, and to handle APIs without high-level wrappers, there are also 'raw' methods
Copy file name to clipboardExpand all lines: sources/api/apiclient/README.tpl
+47-1Lines changed: 47 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ Current version: {{version}}
5
5
## apiclient binary
6
6
7
7
The `apiclient` binary provides high-level methods to interact with the Bottlerocket API.
8
-
There's a [set](#set-mode) subcommand for changing settings, an [update](#update-mode) subcommand for updating the host, and an [exec](#exec-mode) subcommand for running commands in host containers.
8
+
There's a [set](#set-mode) subcommand for changing settings, a [network configure](#network-configure) subcommand for configuring network settings, an [update](#update-mode) subcommand for updating the host, and an [exec](#exec-mode) subcommand for running commands in host containers.
9
9
There's also a low-level [raw](#raw-mode) subcommand for direct interaction with the HTTP API.
10
10
11
11
It talks to the Bottlerocket socket by default.
@@ -75,6 +75,52 @@ You can use JSON form to set it:
75
75
apiclient set --json '{"motd": "42"}'
76
76
```
77
77
78
+
### Network configure
79
+
80
+
This allows you to configure network settings by providing a network configuration file. The configuration will be applied at the next boot.
81
+
82
+
The `network configure` command accepts input from different sources using URI schemes:
83
+
84
+
#### File URI input
85
+
86
+
You can specify a local file path using the `file://` URI scheme:
This is particularly useful for automation and configuration management where you want to embed the network configuration directly in scripts or user data.
101
+
102
+
#### Configuration format
103
+
104
+
The `net.toml` file uses the same format that netdog supports. Here's an example:
105
+
106
+
```toml
107
+
version = 2
108
+
109
+
[eth0]
110
+
dhcp4 = true
111
+
dhcp6 = false
112
+
113
+
[eth1]
114
+
static4 = ["192.168.1.100/24"]
115
+
route = [{to = "default", via = "192.168.1.1"}]
116
+
```
117
+
118
+
After configuring the network settings, you'll need to reboot the system for the changes to take effect:
119
+
120
+
```shell
121
+
apiclient reboot
122
+
```
123
+
78
124
### Update mode
79
125
80
126
To start, you can check what updates are available:
0 commit comments