-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add implementation of Node IPAM support
- Adds `addressesFromPools` to the VSphereVM network device spec - Creates IPAddressClaims when AddressesFromPools is specified - IP addresses created by IPAM providers are assigned to vSphere machines via the VM metadata - IPv4 Gateways from IPAddresses (created by IPAM providers) are assigned to the Gateway4 field - IPv6 Gateways from IPAddresses (created by IPAM providers) are assigned to the Gateway6 field - All gateways in the same IP family assigned to a VSphereVM network device must be the same. - This implementation expects that an appropriate gateway for the IP family exists for every IPAddress that comes from an IPAM provider. - Adds the `IPAddressClaimed` Condition to provide visibility of the status of IP address acquisition - Adds the finalizer to prevent IPAMClaims from being deleted early - IPAddressClaims have an OwnerReference to VSphereVMs to ensure they are garbage-collected when the VM is deleted. Co-authored-by: Tyler Schultz <[email protected]> Co-authored-by: Christian Ang <[email protected]> Co-authored-by: Edwin Xie <[email protected]>
- Loading branch information
1 parent
1e47610
commit 1034ef5
Showing
29 changed files
with
1,441 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
Copyright 2022 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha3 | ||
|
||
import ( | ||
conversion "k8s.io/apimachinery/pkg/conversion" | ||
v1beta1 "sigs.k8s.io/cluster-api-provider-vsphere/apis/v1beta1" | ||
) | ||
|
||
func Convert_v1beta1_NetworkDeviceSpec_To_v1alpha3_NetworkDeviceSpec(in *v1beta1.NetworkDeviceSpec, out *NetworkDeviceSpec, s conversion.Scope) error { | ||
out.NetworkName = in.NetworkName | ||
out.DeviceName = in.DeviceName | ||
out.DHCP4 = in.DHCP4 | ||
out.DHCP6 = in.DHCP6 | ||
out.Gateway4 = in.Gateway4 | ||
out.Gateway6 = in.Gateway6 | ||
out.IPAddrs = in.IPAddrs | ||
out.MTU = in.MTU | ||
out.MACAddr = in.MACAddr | ||
out.Nameservers = in.Nameservers | ||
out.SearchDomains = in.SearchDomains | ||
if in.Routes != nil { | ||
inRoutes, outRoutes := &in.Routes, &out.Routes | ||
*outRoutes = make([]NetworkRouteSpec, len(*inRoutes)) | ||
for i := range *inRoutes { | ||
if err := Convert_v1beta1_NetworkRouteSpec_To_v1alpha3_NetworkRouteSpec(&(*inRoutes)[i], &(*outRoutes)[i], s); err != nil { | ||
return err | ||
} | ||
} | ||
} else { | ||
out.Routes = nil | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
Copyright 2022 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha4 | ||
|
||
import ( | ||
conversion "k8s.io/apimachinery/pkg/conversion" | ||
v1beta1 "sigs.k8s.io/cluster-api-provider-vsphere/apis/v1beta1" | ||
) | ||
|
||
func Convert_v1beta1_NetworkDeviceSpec_To_v1alpha4_NetworkDeviceSpec(in *v1beta1.NetworkDeviceSpec, out *NetworkDeviceSpec, s conversion.Scope) error { | ||
out.NetworkName = in.NetworkName | ||
out.DeviceName = in.DeviceName | ||
out.DHCP4 = in.DHCP4 | ||
out.DHCP6 = in.DHCP6 | ||
out.Gateway4 = in.Gateway4 | ||
out.Gateway6 = in.Gateway6 | ||
out.IPAddrs = in.IPAddrs | ||
out.MTU = in.MTU | ||
out.MACAddr = in.MACAddr | ||
out.Nameservers = in.Nameservers | ||
out.SearchDomains = in.SearchDomains | ||
if in.Routes != nil { | ||
inRoutes, outRoutes := &in.Routes, &out.Routes | ||
*outRoutes = make([]NetworkRouteSpec, len(*inRoutes)) | ||
for i := range *inRoutes { | ||
if err := Convert_v1beta1_NetworkRouteSpec_To_v1alpha4_NetworkRouteSpec(&(*inRoutes)[i], &(*outRoutes)[i], s); err != nil { | ||
return err | ||
} | ||
} | ||
} else { | ||
out.Routes = nil | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.