Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions doc/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9905,7 +9905,8 @@ <h3 id="metalstack.api.v2.MachineAllocation">MachineAllocation</h3>
<td>networks</td>
<td><a href="#metalstack.api.v2.MachineNetwork">MachineNetwork</a></td>
<td>repeated</td>
<td><p>Networks this machine should be attached to </p></td>
<td><p>Networks this machine should be attached to
Order of ips of external networks will be preserved. </p></td>
</tr>

<tr>
Expand Down Expand Up @@ -9994,7 +9995,8 @@ <h3 id="metalstack.api.v2.MachineAllocationNetwork">MachineAllocationNetwork</h3
<td><a href="#string">string</a></td>
<td>repeated</td>
<td><p>IPs to to attach to this machine additionally
If none given, one ip address is acquired per network for the machine </p></td>
If none given, one ip address is acquired per network for the machine
Order of ips is preserved on the loopback interface. </p></td>
</tr>

</tbody>
Expand Down
2 changes: 2 additions & 0 deletions go/metalstack/api/v2/machine.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions go/tests/validation/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,6 @@ func createString(n int) string {
return string(s)
}

func createRepeatedString(n int) []string {
arr := make([]string, n)
for i := range arr {
arr[i] = "opt" + string(rune('a'+(i%26)))
}
return arr
}

func createDiskDevices(n int) []string {
devs := make([]string, n)
for i := range devs {
Expand Down
12 changes: 0 additions & 12 deletions go/tests/validation/filesystem_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,18 +156,6 @@ func TestValidateFilesystem(t *testing.T) {
wantErr: true,
wantErrorMessage: "validation error: mount_options: repeated value must contain unique items",
},
{
name: "Invalid Filesystem, mount_options more than 32 items",
msg: &apiv2.Filesystem{
Device: "/dev/sda3",
Format: apiv2.Format_FORMAT_EXT4,
MountOptions: createRepeatedString(33),
},
wantErr: true,
wantErrorMessage: `validation errors:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed because order of messages is not guaranteed by protovalidate

- mount_options: must contain no more than 32 item(s)
- mount_options: repeated value must contain unique items`,
},
{
name: "Invalid Filesystem, mount_options item too long",
msg: &apiv2.Filesystem{
Expand Down
2 changes: 2 additions & 0 deletions js/metalstack/api/v2/machine_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,7 @@ export type MachineAllocation = Message<"metalstack.api.v2.MachineAllocation"> &
filesystemLayout?: FilesystemLayout | undefined;
/**
* Networks this machine should be attached to
* Order of ips of external networks will be preserved.
*
* @generated from field: repeated metalstack.api.v2.MachineNetwork networks = 9;
*/
Expand Down Expand Up @@ -722,6 +723,7 @@ export type MachineAllocationNetwork = Message<"metalstack.api.v2.MachineAllocat
/**
* IPs to to attach to this machine additionally
* If none given, one ip address is acquired per network for the machine
* Order of ips is preserved on the loopback interface.
*
* @generated from field: repeated string ips = 2;
*/
Expand Down
2 changes: 2 additions & 0 deletions js/metalstack/api/v2/machine_pb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,7 @@ export type MachineAllocation = Message<"metalstack.api.v2.MachineAllocation"> &

/**
* Networks this machine should be attached to
* Order of ips of external networks will be preserved.
*
* @generated from field: repeated metalstack.api.v2.MachineNetwork networks = 9;
*/
Expand Down Expand Up @@ -856,6 +857,7 @@ export type MachineAllocationNetwork = Message<"metalstack.api.v2.MachineAllocat
/**
* IPs to to attach to this machine additionally
* If none given, one ip address is acquired per network for the machine
* Order of ips is preserved on the loopback interface.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I do not fully understand the issue, but if this is a breaking change, this is really hard to figure out if all client implementations properly do this to see the same behavior as before?

What happens when I allocate a machine with a fixed private IP and then provide an external network along with the private network for machine creation? Will the auto-acquired IP from the external network be put before my own statically passed definition or not? How can I switch it around?

I think, normal users will not be able to understand the consequences of this comment without reading this PR (+ the entire code base to the point where the network interfaces are configured?). So, to me this feels a little sparse?

As I said, maybe I do not understand the problem, I just worry that my automations break with this when I read it. 😅

*
* @generated from field: repeated string ips = 2;
*/
Expand Down
2 changes: 2 additions & 0 deletions proto/metalstack/api/v2/machine.proto
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ message MachineAllocation {
// FilesystemLayout to create on the disks
FilesystemLayout filesystem_layout = 8;
// Networks this machine should be attached to
// Order of ips of external networks will be preserved.
repeated MachineNetwork networks = 9;
// Hostname of the allocated machine
string hostname = 10 [(buf.validate.field).string.hostname = true];
Expand Down Expand Up @@ -343,6 +344,7 @@ message MachineAllocationNetwork {
string network = 1 [(buf.validate.field).string.(metalstack.api.v2.is_name) = true];
// IPs to to attach to this machine additionally
// If none given, one ip address is acquired per network for the machine
// Order of ips is preserved on the loopback interface.
repeated string ips = 2 [(buf.validate.field).repeated.(metalstack.api.v2.ips) = true];
}

Expand Down
Loading