Skip to content

Commit 0865655

Browse files
authored
feat(pgw): ipam config for native vpc integration (#3355)
1 parent 768706e commit 0865655

File tree

6 files changed

+42
-24
lines changed

6 files changed

+42
-24
lines changed

cmd/scw/testdata/test-all-usage-vpc-gw-gateway-network-create-usage.golden

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ USAGE:
66
scw vpc-gw gateway-network create [arg=value ...]
77

88
ARGS:
9-
[gateway-id] Public Gateway to connect
10-
[private-network-id] Private Network to connect
11-
[enable-masquerade] Defines whether to enable masquerade (dynamic NAT) on this network
12-
[dhcp-id] ID of an existing DHCP configuration object to use for this GatewayNetwork
13-
[address] Static IP address in CIDR format to to use without DHCP
14-
[enable-dhcp] Defines whether to enable DHCP on this Private Network. Defaults to `true` if either `dhcp_id` or `dhcp` are present. If set to `true`, either `dhcp_id` or `dhcp` must be present
15-
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | fr-par-2 | nl-ams-1 | nl-ams-2 | nl-ams-3 | pl-waw-1 | pl-waw-2)
9+
[gateway-id] Public Gateway to connect
10+
[private-network-id] Private Network to connect
11+
[enable-masquerade] Defines whether to enable masquerade (dynamic NAT) on this network
12+
[enable-dhcp] Defines whether to enable DHCP on this Private Network. Defaults to `true` if either `dhcp_id` or `dhcp` are present. If set to `true`, either `dhcp_id` or `dhcp` must be present
13+
[dhcp-id] ID of an existing DHCP configuration object to use for this GatewayNetwork
14+
[address] Static IP address in CIDR format to to use without DHCP
15+
[ipam-config.push-default-route] Defines whether the default route is enabled on that Gateway Network.
16+
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | fr-par-2 | nl-ams-1 | nl-ams-2 | nl-ams-3 | pl-waw-1 | pl-waw-2)
1617

1718
FLAGS:
1819
-h, --help help for create

cmd/scw/testdata/test-all-usage-vpc-gw-gateway-network-update-usage.golden

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ USAGE:
66
scw vpc-gw gateway-network update <gateway-network-id ...> [arg=value ...]
77

88
ARGS:
9-
gateway-network-id ID of the GatewayNetwork to update
10-
[enable-masquerade] Defines whether to enable masquerade (dynamic NAT) on the GatewayNetwork
11-
[dhcp-id] ID of the new DHCP configuration object to use with this GatewayNetwork
12-
[enable-dhcp] Defines whether to enable DHCP on the connected Private Network
13-
[address] New static IP address
14-
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | fr-par-2 | nl-ams-1 | nl-ams-2 | nl-ams-3 | pl-waw-1 | pl-waw-2)
9+
gateway-network-id ID of the GatewayNetwork to update
10+
[enable-masquerade] Defines whether to enable masquerade (dynamic NAT) on the GatewayNetwork
11+
[enable-dhcp] Defines whether to enable DHCP on the connected Private Network
12+
[dhcp-id] ID of the new DHCP configuration object to use with this GatewayNetwork
13+
[address] New static IP address
14+
[ipam-config.push-default-route] Defines whether the default route is enabled on that Gateway Network.
15+
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | fr-par-2 | nl-ams-1 | nl-ams-2 | nl-ams-3 | pl-waw-1 | pl-waw-2)
1516

1617
FLAGS:
1718
-h, --help help for update

docs/commands/vpc-gw.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,9 +516,10 @@ scw vpc-gw gateway-network create [arg=value ...]
516516
| gateway-id | | Public Gateway to connect |
517517
| private-network-id | | Private Network to connect |
518518
| enable-masquerade | | Defines whether to enable masquerade (dynamic NAT) on this network |
519+
| enable-dhcp | | Defines whether to enable DHCP on this Private Network. Defaults to `true` if either `dhcp_id` or `dhcp` are present. If set to `true`, either `dhcp_id` or `dhcp` must be present |
519520
| dhcp-id | | ID of an existing DHCP configuration object to use for this GatewayNetwork |
520521
| address | | Static IP address in CIDR format to to use without DHCP |
521-
| enable-dhcp | | Defines whether to enable DHCP on this Private Network. Defaults to `true` if either `dhcp_id` or `dhcp` are present. If set to `true`, either `dhcp_id` or `dhcp` must be present |
522+
| ipam-config.push-default-route | | Defines whether the default route is enabled on that Gateway Network. |
522523
| zone | Default: `fr-par-1`<br />One of: `fr-par-1`, `fr-par-2`, `nl-ams-1`, `nl-ams-2`, `nl-ams-3`, `pl-waw-1`, `pl-waw-2` | Zone to target. If none is passed will use default zone from the config |
523524

524525

@@ -606,9 +607,10 @@ scw vpc-gw gateway-network update <gateway-network-id ...> [arg=value ...]
606607
|------|---|-------------|
607608
| gateway-network-id | Required | ID of the GatewayNetwork to update |
608609
| enable-masquerade | | Defines whether to enable masquerade (dynamic NAT) on the GatewayNetwork |
609-
| dhcp-id | | ID of the new DHCP configuration object to use with this GatewayNetwork |
610610
| enable-dhcp | | Defines whether to enable DHCP on the connected Private Network |
611+
| dhcp-id | | ID of the new DHCP configuration object to use with this GatewayNetwork |
611612
| address | | New static IP address |
613+
| ipam-config.push-default-route | | Defines whether the default route is enabled on that Gateway Network. |
612614
| zone | Default: `fr-par-1`<br />One of: `fr-par-1`, `fr-par-2`, `nl-ams-1`, `nl-ams-2`, `nl-ams-3`, `pl-waw-1`, `pl-waw-2` | Zone to target. If none is passed will use default zone from the config |
613615

614616

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ require (
2424
github.com/moby/buildkit v0.11.6
2525
github.com/opencontainers/go-digest v1.0.0
2626
github.com/pkg/errors v0.9.1
27-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.20.0.20230901111648-9e540fe63734
27+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.20.0.20230904085706-cf5147eb9745
2828
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
2929
github.com/spf13/cobra v1.7.0
3030
github.com/spf13/pflag v1.0.5

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -491,8 +491,8 @@ github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncj
491491
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
492492
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 h1:OkMGxebDjyw0ULyrTYWeN0UNCCkmCWfjPnIA2W6oviI=
493493
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06/go.mod h1:+ePHsJ1keEjQtpvf9HHw0f4ZeJ0TLRsxhunSI2hYJSs=
494-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.20.0.20230901111648-9e540fe63734 h1:KAxCqrhRP6DAclE0uzBcwUJtAfkdUfEA75rhUFKj4cU=
495-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.20.0.20230901111648-9e540fe63734/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
494+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.20.0.20230904085706-cf5147eb9745 h1:Qtr7dGcH98TIeC0JmhHouNhU8/ExnvFZ9ZqEkYiqFhc=
495+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.20.0.20230904085706-cf5147eb9745/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
496496
github.com/sclevine/spec v1.4.0 h1:z/Q9idDcay5m5irkZ28M7PtQM4aOISzOpj4bUPkDee8=
497497
github.com/secure-systems-lab/go-securesystemslib v0.4.0 h1:b23VGrQhTA8cN2CbBw7/FulN9fTtqYUdS5+Oxzt+DUE=
498498
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=

internal/namespaces/vpcgw/v1/vpcgw_cli.go

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,13 @@ func vpcGwGatewayNetworkCreate() *core.Command {
696696
Deprecated: false,
697697
Positional: false,
698698
},
699+
{
700+
Name: "enable-dhcp",
701+
Short: `Defines whether to enable DHCP on this Private Network. Defaults to ` + "`" + `true` + "`" + ` if either ` + "`" + `dhcp_id` + "`" + ` or ` + "`" + `dhcp` + "`" + ` are present. If set to ` + "`" + `true` + "`" + `, either ` + "`" + `dhcp_id` + "`" + ` or ` + "`" + `dhcp` + "`" + ` must be present`,
702+
Required: false,
703+
Deprecated: false,
704+
Positional: false,
705+
},
699706
{
700707
Name: "dhcp-id",
701708
Short: `ID of an existing DHCP configuration object to use for this GatewayNetwork`,
@@ -711,8 +718,8 @@ func vpcGwGatewayNetworkCreate() *core.Command {
711718
Positional: false,
712719
},
713720
{
714-
Name: "enable-dhcp",
715-
Short: `Defines whether to enable DHCP on this Private Network. Defaults to ` + "`" + `true` + "`" + ` if either ` + "`" + `dhcp_id` + "`" + ` or ` + "`" + `dhcp` + "`" + ` are present. If set to ` + "`" + `true` + "`" + `, either ` + "`" + `dhcp_id` + "`" + ` or ` + "`" + `dhcp` + "`" + ` must be present`,
721+
Name: "ipam-config.push-default-route",
722+
Short: `Defines whether the default route is enabled on that Gateway Network.`,
716723
Required: false,
717724
Deprecated: false,
718725
Positional: false,
@@ -755,15 +762,15 @@ func vpcGwGatewayNetworkUpdate() *core.Command {
755762
Positional: false,
756763
},
757764
{
758-
Name: "dhcp-id",
759-
Short: `ID of the new DHCP configuration object to use with this GatewayNetwork`,
765+
Name: "enable-dhcp",
766+
Short: `Defines whether to enable DHCP on the connected Private Network`,
760767
Required: false,
761768
Deprecated: false,
762769
Positional: false,
763770
},
764771
{
765-
Name: "enable-dhcp",
766-
Short: `Defines whether to enable DHCP on the connected Private Network`,
772+
Name: "dhcp-id",
773+
Short: `ID of the new DHCP configuration object to use with this GatewayNetwork`,
767774
Required: false,
768775
Deprecated: false,
769776
Positional: false,
@@ -775,6 +782,13 @@ func vpcGwGatewayNetworkUpdate() *core.Command {
775782
Deprecated: false,
776783
Positional: false,
777784
},
785+
{
786+
Name: "ipam-config.push-default-route",
787+
Short: `Defines whether the default route is enabled on that Gateway Network.`,
788+
Required: false,
789+
Deprecated: false,
790+
Positional: false,
791+
},
778792
core.ZoneArgSpec(scw.ZoneFrPar1, scw.ZoneFrPar2, scw.ZoneNlAms1, scw.ZoneNlAms2, scw.ZoneNlAms3, scw.ZonePlWaw1, scw.ZonePlWaw2),
779793
},
780794
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {

0 commit comments

Comments
 (0)