-
Notifications
You must be signed in to change notification settings - Fork 278
✨ create ports #778
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
✨ create ports #778
Conversation
Hi @jsen-. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: jsen- The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Build succeeded.
|
/ok-to-test |
@jsen- I think I understand most of the code and purpose of this PR |
for _, portCreateOpts := range i.Ports { | ||
port, err := getOrCreatePort(is, i.Name+"-"+portCreateOpts.NameSuffix, portCreateOpts) | ||
if err != nil { | ||
return nil, err |
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.
should we delete those ports when delete cluster? I assume those ports are independent to VM lifecylce?
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 implemented a cleanup orphaned port logic in one of my PRs before the sec group deletion. But it would be good if we try to delete all ports during machine deletion which we created for this machine before.
Yup, I would also like to understand why we need additional ports. fyi. The v1alpha4 PR has been merged onto master. So if this feature is targeted towards master/v1alpha4 it has to |
Sorry for the delay, I'm actually out-of-office, but will try to be responsive.
Done (#788)
Definitely, I will try to implement cleanup of the ports and update the PR
I'm assuming, rebase should be enough, am I correct? |
@jsen- More or less. You have to rebase onto master and make your changes in the api/v1alpha4 folder instead of api/v1alpha3 but the structs are almost the same so there shouldn't be a lot to adjust |
@@ -61,6 +61,9 @@ type OpenStackMachineSpec struct { | |||
// UUID, IP address of a port from this subnet will be marked as AccessIPv4 on the created compute instance | |||
Subnet string `json:"subnet,omitempty"` | |||
|
|||
// create and assign additional ports to instances | |||
Ports []PortOpts `json:"ports,omitempty"` |
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.
We only need VNICType actually. I try to find a light solution.
In my understanding, SR-IOV setting is done per compute node, but real use case is that create network for SR-IOV and create port for it. How about adding VNICType to NetworkParam? At least we can use existing network with SR-IOV.
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.
+1 Since Network param and Subnet Param are no longer nested in v1aplha4 api, it would also make sense to be able to set the vnicType in the subnet, in case that is a user's preferred way to add an interface to a compute instance.
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'm basically fine with whatever option you get consensus on :)
But just asking. We didn't change NetworkParam and SubnetParam from v1alpha4 and as far as I can see they are still nested. Did I miss something that they are not nested anymore ? :)
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 could be misunderstanding, but:
cluster-api-provider-openstack/api/v1alpha4/openstackmachine_types.go
Lines 57 to 62 in e1a1328
// A networks object. Required parameter when there are multiple networks defined for the tenant. | |
// When you do not specify the networks parameter, the server attaches to the only network created for the current tenant. | |
Networks []NetworkParam `json:"networks,omitempty"` | |
// UUID, IP address of a port from this subnet will be marked as AccessIPv4 on the created compute instance | |
Subnet string `json:"subnet,omitempty"` |
It looks like they are their own isolated api entry. Its very possible that I am incorrect though. My frame of reference is from 4 api versions ago.
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.
Ah now I get what lead to this assumption. This Subnet is only for the AccessIPv4 "selection". (it was introduced in #756)
SubnetParam is still nested.
cluster-api-provider-openstack/api/v1alpha4/types.go
Lines 61 to 70 in e1a1328
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"` | |
// Filters for optional network query | |
Filter Filter `json:"filter,omitempty"` | |
// Subnet within a network to use | |
Subnets []SubnetParam `json:"subnets,omitempty"` | |
} |
As mentioned elsewhere we have to rethink our design / CRD sooner or later as it's not that thought out / consistent.
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.
ah ok, that makes sense now. thanks for explaining!
Hi! We are actually working on something similar for RedHat OpenShift. Here is our work based off of a fork of the v1aplha1 API: openshift#170. The only difference in functionality between these two is that your patch does not account for allowing portSecurity to be set. I am not sure if this applies to other platforms, but in our platform, this would be a blocker. Other than that, where our implementation diverges the most is that we chose to automate the creation of the additional ports in the network and subnet param, but I do like your changes to allow for additional ports to be added explicitly. I am hoping that we could align our work on this feature, since we are hoping to convert to v1alpha4, or potentially v1beta at some point in the future. |
+1 to see this happen , thanks @iamemilio |
+1 for me too. I think this should be possible |
api/v1alpha4/types.go
Outdated
@@ -116,6 +120,28 @@ type SubnetFilter struct { | |||
NotTagsAny string `json:"notTagsAny,omitempty"` | |||
} | |||
|
|||
type PortOpts struct { | |||
NetworkID string `json:"networkId" required:"true"` |
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.
is there any value to adding a SubnetID field?
I would seem overkill, but there always seems to be a case where it would be nice to easily lookup the subnetID based on port. or the lookup ports based on subnetIDs
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.
Also, if your goal is to support SR-IOV, then you will need to be able to set (disable) portSecurity on the ports.
👾 Our team discussed things, and due to our timeline, we need to merge the patch in our fork for now so that we can unblock our quality assurance team. However, we are still going to collaborate with you on this feature and will also be filing a bug against our platform to ensure we meet feature and api parity with the results of this pull request. 😃 |
api/v1alpha4/types.go
Outdated
AllowedAddressPairs []ports.AddressPair `json:"allowedAddressPairs,omitempty"` | ||
|
||
// The ID of the host where the port is allocated | ||
HostID string `json:"binding:host_id,omitempty"` |
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.
HostID string `json:"binding:host_id,omitempty"` | |
HostID string `json:"binding:hostID,omitempty"` |
I would prefer to stick to camel case
api/v1alpha4/types.go
Outdated
|
||
// The virtual network interface card (vNIC) type that is bound to the | ||
// neutron port. | ||
VNICType string `json:"binding:vnic_type,omitempty"` |
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.
^
@jsen-: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
TenantID string `json:"tenantID,omitempty"` | ||
ProjectID string `json:"projectID,omitempty"` | ||
SecurityGroups *[]string `json:"securityGroups,omitempty"` | ||
AllowedAddressPairs []ports.AddressPair `json:"allowedAddressPairs,omitempty"` |
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.
^ same as Fixed IPs :)
Sorry I keep hitting you with these so late. I missed these when reviewing and am bumping into them now that I am testing.
@@ -116,6 +120,26 @@ type SubnetFilter struct { | |||
NotTagsAny string `json:"notTagsAny,omitempty"` | |||
} | |||
|
|||
type PortOpts struct { | |||
NetworkID string `json:"networkID" required:"true"` |
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.
Since NetworkID
is a mandatory field, would it make sense if ports:
were children of the list items of networks:
?
@jsen- Please let me know if you are able to address this comments. I think we have a few other folks which would be happy to pick this up and geht it merged :) |
@sbueringer apologies for the delays, we're still interested to get this into master, but I will be busy with other stuff for couple more weeks :( so don't mind if someone is willing to pick this up. |
Okay, no problem. Thx for the information. @macaptain as you expressed interest (#788 (comment)), do you want to pick this up? |
Hey @sbueringer and @jsen- . Thanks for letting me know. Yes, I'd be happy to pick this up and try and get this feature into master. |
@macaptain Great! It probably makes sense to wait a bit until: #862 is merged as it refactors related code quite a bit. But this shouldn't take too long |
@jsen-: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
This commit adds a new field to the v1alpha4 API: OpenStackMachineTemplateSpec.ports. The list of ports are added per instance. Each port may be customized with options. These ports are created in addition to any ports created in the `networks:` field. If `networks:` is not specified, only the ports specified in `ports:` will be created and attached to the instance. If neither `networks:` nor `ports:` are specified, the instance will be connected to the default cluster network and subnet. This commit is very much based on the work on @jsen-: kubernetes-sigs#778 and also aims to bring Cluster API OpenStack provider into greater alignment with the OpenShift fork.
This commit adds a new field to the v1alpha4 API: OpenStackMachineTemplateSpec.ports. The list of ports are added per instance. Each port may be customized with options. These ports are created in addition to any ports created in the `networks:` field. If `networks:` is not specified, only the ports specified in `ports:` will be created and attached to the instance. If neither `networks:` nor `ports:` are specified, the instance will be connected to the default cluster network and subnet. This commit is very much based on the work on @jsen-: kubernetes-sigs#778 and also aims to bring Cluster API OpenStack provider into greater alignment with the OpenShift fork.
This commit adds a new field to the v1alpha4 API: OpenStackMachineTemplateSpec.ports. The list of ports are added per instance. Each port may be customized with options. These ports are created in addition to any ports created in the `networks:` field. If `networks:` is not specified, only the ports specified in `ports:` will be created and attached to the instance. If neither `networks:` nor `ports:` are specified, the instance will be connected to the default cluster network and subnet. This feature is very much based on the work on @jsen-, and a lot of credit has to go there for the implementation: kubernetes-sigs#778
This commit adds a new field to the v1alpha4 API: OpenStackMachineTemplateSpec.ports. The list of ports are added per instance. Each port may be customized with options. These ports are created in addition to any ports created in the `networks:` field. If `networks:` is not specified, only the ports specified in `ports:` will be created and attached to the instance. If neither `networks:` nor `ports:` are specified, the instance will be connected to the default cluster network and subnet. This feature is very much based on the work on @jsen-, and a lot of credit goes there for the implementation: kubernetes-sigs#778
This commit adds a new field to the v1alpha4 API: OpenStackMachineTemplateSpec.ports. The list of ports are added per instance. Each port may be customized with options. These ports are created in addition to any ports created in the `networks:` field. If `networks:` is not specified, only the ports specified in `ports:` will be created and attached to the instance. If neither `networks:` nor `ports:` are specified, the instance will be connected to the default cluster network and subnet. This feature is very much based on the work on @jsen-, and a lot of credit goes there for the implementation: kubernetes-sigs#778
This commit adds a new field to the v1alpha4 API: OpenStackMachineTemplateSpec.ports. The list of ports are added per instance. Each port may be customized with options. These ports are created in addition to any ports created in the `networks:` field. If `networks:` is not specified, only the ports specified in `ports:` will be created and attached to the instance. If neither `networks:` nor `ports:` are specified, the instance will be connected to the default cluster network and subnet. This feature is very much based on the work on @jsen-, and a lot of credit goes there for the implementation: kubernetes-sigs#778
This commit adds a new field to the v1alpha4 API: OpenStackMachineTemplateSpec.ports. The list of ports are added per instance. Each port may be customized with options. These ports are created in addition to any ports created in the `networks:` field. If `networks:` is not specified, only the ports specified in `ports:` will be created and attached to the instance. If neither `networks:` nor `ports:` are specified, the instance will be connected to the default cluster network and subnet. This feature is very much based on the work on jsen-, and a lot of credit goes there for the implementation: kubernetes-sigs#778
This commit adds a new field to the v1alpha4 API: OpenStackMachineTemplateSpec.ports. The list of ports are added per instance. Each port may be customized with options. These ports are created in addition to any ports created in the `networks:` field. If `networks:` is not specified, only the ports specified in `ports:` will be created and attached to the instance. If neither `networks:` nor `ports:` are specified, the instance will be connected to the default cluster network and subnet. This feature is very much based on the work on jsen-, and a lot of credit goes there for the implementation: kubernetes-sigs#778
This commit adds a new field to the v1alpha4 API: OpenStackMachineTemplateSpec.ports. The list of ports are added per instance. Each port may be customized with options. These ports are created in addition to any ports created in the `networks:` field. If `networks:` is not specified, only the ports specified in `ports:` will be created and attached to the instance. If neither `networks:` nor `ports:` are specified, the instance will be connected to the default cluster network and subnet. This feature is very much based on the work on jsen-, and a lot of credit goes there for the implementation: kubernetes-sigs#778
This commit adds a new field to the v1alpha4 API: OpenStackMachineTemplateSpec.ports. The list of ports are added per instance. Each port may be customized with options. These ports are created in addition to any ports created in the `networks:` field. If `networks:` is not specified, only the ports specified in `ports:` will be created and attached to the instance. If neither `networks:` nor `ports:` are specified, the instance will be connected to the default cluster network and subnet. This feature is very much based on the work on jsen-, and a lot of credit goes there for the implementation: kubernetes-sigs#778
This commit adds a new field to the v1alpha4 API: OpenStackMachineTemplateSpec.ports. The list of ports are added per instance. Each port may be customized with options. These ports are created in addition to any ports created in the `networks:` field. If `networks:` is not specified, only the ports specified in `ports:` will be created and attached to the instance. If neither `networks:` nor `ports:` are specified, the instance will be connected to the default cluster network and subnet. This feature is very much based on the work on jsen-, and a lot of credit goes there for the implementation: kubernetes-sigs#778
This commit adds a new field to the v1alpha4 API: OpenStackMachineTemplateSpec.ports. The list of ports are added per instance. Each port may be customized with options. These ports are created in addition to any ports created in the `networks:` field. If `networks:` is not specified, only the ports specified in `ports:` will be created and attached to the instance. If neither `networks:` nor `ports:` are specified, the instance will be connected to the default cluster network and subnet. This feature is very much based on the work on jsen-, and a lot of credit goes there for the implementation: kubernetes-sigs#778
This commit adds a new field to the v1alpha4 API: OpenStackMachineTemplateSpec.ports. The list of ports are added per instance. Each port may be customized with options. These ports are created in addition to any ports created in the `networks:` field. If `networks:` is not specified, only the ports specified in `ports:` will be created and attached to the instance. If neither `networks:` nor `ports:` are specified, the instance will be connected to the default cluster network and subnet. This feature is very much based on the work on jsen-, and a lot of credit goes there for the implementation: kubernetes-sigs#778
This commit adds a new field to the v1alpha4 API: OpenStackMachineTemplateSpec.ports. The list of ports are added per instance. Each port may be customized with options. These ports are created in addition to any ports created in the `networks:` field. If `networks:` is not specified, only the ports specified in `ports:` will be created and attached to the instance. If neither `networks:` nor `ports:` are specified, the instance will be connected to the default cluster network and subnet. This feature is very much based on the work on jsen-, and a lot of credit goes there for the implementation: kubernetes-sigs#778
Can be closed as it has been implemented in #876 (correct me if I'm wrong :)) |
@sbueringer: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
This commit adds a new field to the v1alpha4 API: OpenStackMachineTemplateSpec.ports. The list of ports are added per instance. Each port may be customized with options. These ports are created in addition to any ports created in the `networks:` field. If `networks:` is not specified, only the ports specified in `ports:` will be created and attached to the instance. If neither `networks:` nor `ports:` are specified, the instance will be connected to the default cluster network and subnet. This feature is very much based on the work on jsen-, and a lot of credit goes there for the implementation: kubernetes-sigs#778
What this PR does / why we need it:
We need to assign additional ports to the created instances with
vnic_type=direct
.Attempting to assign this port to an existing VM will fail, so it needs to be done during the VM creation.
Which issue(s) this PR fixes:
Fixes #788
Special notes for your reviewer:
This is a draft to start a conversation, maybe the goal can be achieved in a better way.
Release note:
/hold