Skip to content
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

DANM 4.0 EP4: Adding the TenantNetwork mutating code to the Webhook. #94

Merged
merged 4 commits into from
Jun 7, 2019

Conversation

Levovar
Copy link
Collaborator

@Levovar Levovar commented May 27, 2019

If the other reviews did not make sense until now this should clear it up.
PR takes care of assigning environment specific network information to TenantNetworks based on the TenantConfig API.

Because you don't control your VLANs: netadmins do!

@Levovar Levovar force-pushed the tenantnet_setup branch 2 times, most recently from 7e50358 to 930c958 Compare May 30, 2019 16:44
First, we need to create allocation bitarrays for every virtual interface when a TenantConfig is instantiated.
Then, when a TenantNetwork comes we need to:
- choose appropriate host_device, vlan, and vxlan IDs based on the configured TenantNetwork
- reserve the chosen VNI for the interface
- apply additional overwrites, such as NetworkType specific NetworkID

Existing validation rules were also enhanced.
We now allow the initial provisioning of host_device for TenantNetworks.
If user added it, we only match it against the Tenantconfig, and chose the configured VNIs, if, any.
We do the same for SR-IOV networks having DevicePools, instead of Devices.
Validation rules were also updated to make sure SR-IOV networks get special attention.
@Levovar Levovar changed the title [WIP] DANM 4.0 EP4: Adding the TenantNetwork mutating code to the Webhook. DANM 4.0 EP4: Adding the TenantNetwork mutating code to the Webhook. May 31, 2019
This handler is responsible for handling DELETE events arriving for TenantNetworks.
During each such occurences we need to inspect if the TN being deleted had anyi VNI automatically allocated.
If yes, the VNI needs to be freed in the respective TenantConfig.

This hook can be used later on to add delete specific checks for other network APIs as well,
e.g. checking if Pods are still connected to a network being deleted etc.
@Levovar Levovar force-pushed the tenantnet_setup branch 11 times, most recently from d6b4e6c to 7a8ac09 Compare June 6, 2019 15:55
@Levovar Levovar force-pushed the tenantnet_setup branch 6 times, most recently from a04d225 to 2e718fa Compare June 7, 2019 16:14
1: There was a nil pointer reference error in metacni during creation of DANM client
2: IsDynamicBackend incorrectly did not recognize ipvlan as such
3: Accidentally used shallow copy was changed to a (manual, sigh) deep copy when we save the original manifest during net, and conf validation
4: HostDevices list was not properly patched. When changed, the whole JSON list is now put together, and sent for replacement
5: When a host_device or devicepool is explicitly requested, but is not configured, we throw a validation error
6: hostDevices are now filtered, so DevicePools are not accidentally randomly allocated as host_device for a TenantNetwork
7: Mutating VLAN and VxLAN types for accidentally switched up due to wrong condition
8: NetworkIDs were not mutated into the networks because we haven't checked whether they even changed
9: NEtworkID pre-validation was accidentally removed from ClusterNetwork, not from TenantNetwork :)

DISCLAIMER: Freeing VNIs in TenantConfig does not work because K8s does not fill ANY Objects in DELETE requests!!!
Fortunetaly correction is merged, but we need to wait for 1.15.
Til then - no freeing of VNIs.
@Levovar Levovar merged commit df7f503 into master Jun 7, 2019
@Levovar Levovar deleted the tenantnet_setup branch June 7, 2019 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant