-
Notifications
You must be signed in to change notification settings - Fork 21
Egress PNI support for CLI #3258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,11 +26,12 @@ func (c *accessPointCommand) newPrivateNetworkInterfaceUpdateCommand() *cobra.Co | |
|
|
||
| cmd.Flags().String("name", "", "Name of the private network interface.") | ||
| cmd.Flags().StringSlice("network-interfaces", nil, "A comma-separated list of the IDs of the Elastic Network Interfaces.") | ||
| cmd.Flags().StringSlice("routes", nil, `A comma-separated list of egress CIDR routes (max 10), e.g., "172.31.0.0/16,10.108.16.0/21".`) | ||
| pcmd.AddEnvironmentFlag(cmd, c.AuthenticatedCLICommand) | ||
| pcmd.AddContextFlag(cmd, c.CLICommand) | ||
| pcmd.AddOutputFlag(cmd) | ||
|
|
||
| cmd.MarkFlagsOneRequired("name", "network-interfaces") | ||
| cmd.MarkFlagsOneRequired("name", "network-interfaces", "routes") | ||
|
|
||
| return cmd | ||
| } | ||
|
|
@@ -57,12 +58,24 @@ func (c *accessPointCommand) privateNetworkInterfaceUpdate(cmd *cobra.Command, a | |
| if err != nil { | ||
| return err | ||
| } | ||
| if len(networkInterfaces) > 0 { | ||
|
|
||
| routes, err := cmd.Flags().GetStringSlice("routes") | ||
|
Comment on lines
58
to
+62
|
||
| if err != nil { | ||
| return err | ||
| } | ||
|
|
||
| if len(networkInterfaces) > 0 || len(routes) > 0 { | ||
| awsConfig := &networkingaccesspointv1.NetworkingV1AwsPrivateNetworkInterface{ | ||
| Kind: "AwsPrivateNetworkInterface", | ||
| } | ||
| if len(networkInterfaces) > 0 { | ||
| awsConfig.NetworkInterfaces = &networkInterfaces | ||
| } | ||
| if len(routes) > 0 { | ||
| awsConfig.EgressRoutes = &routes | ||
| } | ||
| updatePrivateNetworkInterface.Spec.Config = &networkingaccesspointv1.NetworkingV1AccessPointSpecUpdateConfigOneOf{ | ||
| NetworkingV1AwsPrivateNetworkInterface: &networkingaccesspointv1.NetworkingV1AwsPrivateNetworkInterface{ | ||
| Kind: "AwsPrivateNetworkInterface", | ||
| NetworkInterfaces: &networkInterfaces, | ||
| }, | ||
| NetworkingV1AwsPrivateNetworkInterface: awsConfig, | ||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| +--------------------+----------------------------------------------+ | ||
| | ID | ap-54321 | | ||
| | Environment | env-596 | | ||
| | Gateway | gw-123456 | | ||
| | Phase | READY | | ||
| | Network Interfaces | eni-00000000000000000, eni-00000000000000001 | | ||
| | Aws Account | 000000000000 | | ||
| | Egress Routes | 172.31.0.0/16, 192.168.1.0/24 | | ||
| +--------------------+----------------------------------------------+ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| ID | Name | Environment | Gateway | Phase | Network Interfaces | Aws Account | ||
| -----------+-----------------------------------------------+-------------+----------+-------+--------------------------------+--------------- | ||
| ap-54321 | my-aws-private-network-interface-access-point | env-596 | gw-12345 | READY | eni-00000000000000000, | 000000000000 | ||
| | | | | | eni-00000000000000001 | | ||
| ID | Name | Environment | Gateway | Phase | Network Interfaces | Aws Account | Egress Routes | ||
| -----------+-----------------------------------------------+-------------+----------+-------+--------------------------------+--------------+-------------------------------- | ||
| ap-54321 | my-aws-private-network-interface-access-point | env-596 | gw-12345 | READY | eni-00000000000000000, | 000000000000 | 172.31.0.0/16, 192.168.1.0/24 | ||
| | | | | | eni-00000000000000001 | | |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| --name Name of the private network interface. | ||
| --network-interfaces A comma-separated list of the IDs of the Elastic Network Interfaces. | ||
| --routes A comma-separated list of egress CIDR routes (max 10), e.g., "172.31.0.0/16,10.108.16.0/21". | ||
| ap-54321 my-aws-private-network-interface-access-point | ||
| :4 | ||
| Completion ended with directive: ShellCompDirectiveNoFileComp |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| +--------------------+----------------------------------------------+ | ||
| | ID | ap-54321 | | ||
| | Environment | env-596 | | ||
| | Gateway | gw-12345 | | ||
| | Phase | READY | | ||
| | Network Interfaces | eni-00000000000000000, eni-00000000000000001 | | ||
| | Aws Account | 000000000000 | | ||
| | Egress Routes | 10.0.0.0/8, 192.168.0.0/16 | | ||
| +--------------------+----------------------------------------------+ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1233,6 +1233,7 @@ func (s *CLITestSuite) TestNetworkAccessPointPrivateNetworkInterfaceDelete() { | |
| func (s *CLITestSuite) TestNetworkAccessPointPrivateNetworkInterfaceCreate() { | ||
| tests := []CLITest{ | ||
| {args: "network access-point private-network-interface create --cloud aws --gateway gw-123456 --network-interfaces eni-00000000000000000,eni-00000000000000001 --account 000000000000", fixture: "network/access-point/private-network-interface/create.golden"}, | ||
| {args: "network access-point private-network-interface create --cloud aws --gateway gw-123456 --network-interfaces eni-00000000000000000,eni-00000000000000001 --account 000000000000 --routes 172.31.0.0/16,192.168.1.0/24", fixture: "network/access-point/private-network-interface/create-with-routes.golden"}, | ||
| } | ||
|
Comment on lines
1233
to
1237
|
||
|
|
||
| for _, test := range tests { | ||
|
|
@@ -1269,6 +1270,7 @@ func (s *CLITestSuite) TestNetworkAccessPointPrivateNetworkInterfaceUpdate() { | |
| tests := []CLITest{ | ||
| {args: "network access-point private-network-interface update ap-54321 --name my-new-aws-private-network-interface", input: "y\n", fixture: "network/access-point/private-network-interface/update.golden"}, | ||
| {args: "network access-point private-network-interface update ap-54321 --network-interfaces eni-00000000000000002,eni-00000000000000003", input: "y\n", fixture: "network/access-point/private-network-interface/update-network-interfaces.golden"}, | ||
| {args: "network access-point private-network-interface update ap-54321 --routes 10.0.0.0/8,192.168.0.0/16", input: "y\n", fixture: "network/access-point/private-network-interface/update-routes.golden"}, | ||
| } | ||
|
|
||
| for _, test := range tests { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3001,6 +3001,7 @@ func getAwsPrivateNetworkInterfaceAccessPoint(id, environment, name string) netw | |
| Kind: "AwsPrivateNetworkInterface", | ||
| NetworkInterfaces: &[]string{"eni-00000000000000000", "eni-00000000000000001"}, | ||
| Account: networkingaccesspointv1.PtrString("000000000000"), | ||
| EgressRoutes: &[]string{"172.31.0.0/16", "192.168.1.0/24"}, | ||
| }, | ||
| }, | ||
| Environment: &networkingaccesspointv1.ObjectReference{Id: environment}, | ||
|
|
@@ -3141,6 +3142,9 @@ func handleNetworkingAccessPointUpdate(t *testing.T, id string) http.HandlerFunc | |
| if networkInterfaces := body.Spec.GetConfig().NetworkingV1AwsPrivateNetworkInterface.GetNetworkInterfaces(); len(networkInterfaces) > 0 { | ||
| accessPoint.Spec.Config.NetworkingV1AwsPrivateNetworkInterface.SetNetworkInterfaces(body.Spec.GetConfig().NetworkingV1AwsPrivateNetworkInterface.GetNetworkInterfaces()) | ||
| } | ||
| if routes := body.Spec.GetConfig().NetworkingV1AwsPrivateNetworkInterface.GetEgressRoutes(); len(routes) > 0 { | ||
| accessPoint.Spec.Config.NetworkingV1AwsPrivateNetworkInterface.SetEgressRoutes(body.Spec.GetConfig().NetworkingV1AwsPrivateNetworkInterface.GetEgressRoutes()) | ||
|
Comment on lines
3142
to
+3146
|
||
| } | ||
| case "ap-67890": | ||
| accessPoint = getAzureEgressAccessPoint(id, body.Spec.Environment.GetId(), "my-azure-egress-access-point") | ||
| case "ap-88888": | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This
replacepinsgithub.com/confluentinc/ccloud-sdk-go-v2/networking-access-pointto theccloud-sdk-go-v2-internalmodule. Sincego.modstill requiresnetworking-access-point v0.5.0, this creates a confusing version mismatch (the build will use the replacement even though the required version is older). Consider bumping the required version to match the replacement, and confirm whether introducing a dependency on the-internalmodule is intended for all consumers/build environments.