-
Notifications
You must be signed in to change notification settings - Fork 296
✨ Add feature to create ports with custom options #876
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -58,7 +58,7 @@ type NetworkParam struct { | |
| // The UUID of the network. Required if you omit the port attribute. | ||
| UUID string `json:"uuid,omitempty"` | ||
| // A fixed IPv4 address for the NIC. | ||
| FixedIP string `json:"fixedIp,omitempty"` | ||
| FixedIP string `json:"fixedIP,omitempty"` | ||
| // Filters for optional network query | ||
| Filter Filter `json:"filter,omitempty"` | ||
| // Subnet within a network to use | ||
|
|
@@ -116,6 +116,38 @@ type SubnetFilter struct { | |
| NotTagsAny string `json:"notTagsAny,omitempty"` | ||
| } | ||
|
|
||
| type PortOpts struct { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as follow up, we may need consider add some samples in how to use this opts (not this PR)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can certainly add additional documentation in a follow up PR. |
||
| // ID of the OpenStack network on which to create the port. If unspecified, create the port on the default cluster network. | ||
| NetworkID string `json:"networkId,omitempty"` | ||
| // Used to make the name of the port unique. If unspecified, instead the 0-based index of the port in the list is used. | ||
| NameSuffix string `json:"nameSuffix,omitempty"` | ||
| Description string `json:"description,omitempty"` | ||
| AdminStateUp *bool `json:"adminStateUp,omitempty"` | ||
| MACAddress string `json:"macAddress,omitempty"` | ||
| // Specify pairs of subnet and/or IP address. These should be subnets of the network with the given NetworkID. | ||
| FixedIPs []FixedIP `json:"fixedIPs,omitempty"` | ||
| TenantID string `json:"tenantId,omitempty"` | ||
| ProjectID string `json:"projectId,omitempty"` | ||
| SecurityGroups *[]string `json:"securityGroups,omitempty"` | ||
| AllowedAddressPairs []AddressPair `json:"allowedAddressPairs,omitempty"` | ||
|
|
||
macaptain marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // The ID of the host where the port is allocated | ||
| HostID string `json:"hostId,omitempty"` | ||
|
|
||
| // The virtual network interface card (vNIC) type that is bound to the neutron port. | ||
| VNICType string `json:"vnicType,omitempty"` | ||
| } | ||
|
|
||
| type FixedIP struct { | ||
| SubnetID string `json:"subnetId"` | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One thought: it would be possible here is to make the type
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That would be cool. That is probably a good idea for a lot of these fields that only take IDs as an input, but might be content for another iteration |
||
| IPAddress string `json:"ipAddress,omitempty"` | ||
| } | ||
|
|
||
| type AddressPair struct { | ||
| IPAddress string `json:"ipAddress,omitempty"` | ||
| MACAddress string `json:"macAddress,omitempty"` | ||
| } | ||
|
|
||
| type Instance struct { | ||
| ID string `json:"id,omitempty"` | ||
| Name string `json:"name,omitempty"` | ||
|
|
@@ -145,16 +177,17 @@ type RootVolume struct { | |
| Size int `json:"diskSize,omitempty"` | ||
| } | ||
|
|
||
| // Network represents basic information about the associated OpenStach Neutron Network. | ||
| // Network represents basic information about an OpenStack Neutron Network associated with an instance's port. | ||
| type Network struct { | ||
| Name string `json:"name"` | ||
| ID string `json:"id"` | ||
|
|
||
| //+optional | ||
| Tags []string `json:"tags,omitempty"` | ||
|
|
||
| Subnet *Subnet `json:"subnet,omitempty"` | ||
| Router *Router `json:"router,omitempty"` | ||
| Subnet *Subnet `json:"subnet,omitempty"` | ||
| PortOpts *PortOpts `json:"port,omitempty"` | ||
| Router *Router `json:"router,omitempty"` | ||
|
|
||
| // Be careful when using APIServerLoadBalancer, because this field is optional and therefore not | ||
| // set in all cases | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
I think this should be like it says in the comment
Convert_v1alpha3_OpenStackClusterSpec_To_v1alpha4_OpenStackClusterSpec, I think we don't need specific conversion function for Network sinceportOptsis part of theOpenStackMachineSpec. We need to be able to convertOpenStackMachineSpecboth ways, from v1alpha4 to v1alpha3 and vice versa.I am pretty sure when changing between api versions you just can't drop any fields that are not supported in another. You need to store and restore these field during conversion.
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.
I see that we'll drop fields if we go v1alpha4 -> v1alpha3 -> v1alpha4. This will also apply to other fields added/removed in v1alpha4 that aren't part of this change (e.g. .UserDataSecret, useOctavia). Can we raise and fix robust conversion between versions as a separate issue outside the scope of this change?
Happy to accept any suggestions on improving or fixing these conversion functions that I have written, because I have largely guessed at what they are supposed to be in order to get the code generation passing without warnings or errors.