Skip to content

Commit 77a32a0

Browse files
committed
add Topology.NetworkConfigurations
1 parent f830b15 commit 77a32a0

File tree

11 files changed

+657
-32
lines changed

11 files changed

+657
-32
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
Copyright 2024 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1alpha3
18+
19+
import (
20+
conversion "k8s.io/apimachinery/pkg/conversion"
21+
v1beta1 "sigs.k8s.io/cluster-api-provider-vsphere/apis/v1beta1"
22+
)
23+
24+
func Convert_v1beta1_Topology_To_v1alpha3_Topology(in *v1beta1.Topology, out *Topology, s conversion.Scope) error {
25+
return autoConvert_v1beta1_Topology_To_v1alpha3_Topology(in, out, s)
26+
}

apis/v1alpha3/zz_generated.conversion.go

Lines changed: 28 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
Copyright 2024 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1alpha4
18+
19+
import (
20+
conversion "k8s.io/apimachinery/pkg/conversion"
21+
v1beta1 "sigs.k8s.io/cluster-api-provider-vsphere/apis/v1beta1"
22+
)
23+
24+
func Convert_v1beta1_Topology_To_v1alpha4_Topology(in *v1beta1.Topology, out *Topology, s conversion.Scope) error {
25+
return autoConvert_v1beta1_Topology_To_v1alpha4_Topology(in, out, s)
26+
}

apis/v1alpha4/zz_generated.conversion.go

Lines changed: 28 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/v1beta1/vspherefailuredomain_types.go

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package v1beta1
1818

1919
import (
20+
corev1 "k8s.io/api/core/v1"
2021
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2122
)
2223

@@ -81,12 +82,69 @@ type Topology struct {
8182
// +optional
8283
Networks []string `json:"networks,omitempty"`
8384

85+
// NetworkConfigurations is a list of network configurations within this failure domain.
86+
// +optional
87+
// +listType=map
88+
// +listMapKey=name
89+
NetworkConfigurations []NetworkConfiguration `json:"networkConfigs,omitempty"`
90+
8491
// Datastore is the name or inventory path of the datastore in which the
8592
// virtual machine is created/located.
8693
// +optional
8794
Datastore string `json:"datastore,omitempty"`
8895
}
8996

97+
// NetworkConfiguration defines a network configuration that should be used when consuming
98+
// a failure domain.
99+
type NetworkConfiguration struct {
100+
// NetworkName is the network name for this machine's VM.
101+
// +kubebuilder:validation:Required
102+
NetworkName string `json:"name"`
103+
104+
// DHCP4 is a flag that indicates whether or not to use DHCP for IPv4.
105+
// +optional
106+
DHCP4 *bool `json:"dhcp4,omitempty"`
107+
108+
// DHCP6 is a flag that indicates whether or not to use DHCP for IPv6.
109+
// +optional
110+
DHCP6 *bool `json:"dhcp6,omitempty"`
111+
112+
// Nameservers is a list of IPv4 and/or IPv6 addresses used as DNS
113+
// nameservers.
114+
// Please note that Linux allows only three nameservers (https://linux.die.net/man/5/resolv.conf).
115+
// +optional
116+
Nameservers []string `json:"nameservers,omitempty"`
117+
118+
// SearchDomains is a list of search domains used when resolving IP
119+
// addresses with DNS.
120+
// +optional
121+
SearchDomains []string `json:"searchDomains,omitempty"`
122+
123+
// DHCP4Overrides allows for the control over several DHCP behaviors.
124+
// Overrides will only be applied when the corresponding DHCP flag is set.
125+
// Only configured values will be sent, omitted values will default to
126+
// distribution defaults.
127+
// Dependent on support in the network stack for your distribution.
128+
// For more information see the netplan reference (https://netplan.io/reference#dhcp-overrides)
129+
// +optional
130+
DHCP4Overrides *DHCPOverrides `json:"dhcp4Overrides,omitempty"`
131+
132+
// DHCP6Overrides allows for the control over several DHCP behaviors.
133+
// Overrides will only be applied when the corresponding DHCP flag is set.
134+
// Only configured values will be sent, omitted values will default to
135+
// distribution defaults.
136+
// Dependent on support in the network stack for your distribution.
137+
// For more information see the netplan reference (https://netplan.io/reference#dhcp-overrides)
138+
// +optional
139+
DHCP6Overrides *DHCPOverrides `json:"dhcp6Overrides,omitempty"`
140+
141+
// AddressesFromPools is a list of IPAddressPools that should be assigned
142+
// to IPAddressClaims. The machine's cloud-init metadata will be populated
143+
// with IPAddresses fulfilled by an IPAM provider.
144+
// +optional
145+
AddressesFromPools []corev1.TypedLocalObjectReference `json:"addressesFromPools,omitempty"`
146+
}
147+
90148
// FailureDomainHosts has information required for placement of machines on VSphere hosts.
91149
type FailureDomainHosts struct {
92150
// VMGroupName is the name of the VM group

apis/v1beta1/zz_generated.deepcopy.go

Lines changed: 59 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)