Skip to content

Commit 0ec3e5e

Browse files
committed
Adding support for dns servers in IPAM
This commit adds support for the newly added dnsServers field in IPAddress and uplifts the ip-address-manager dependency
1 parent 1332576 commit 0ec3e5e

File tree

8 files changed

+335
-71
lines changed

8 files changed

+335
-71
lines changed

api/v1alpha4/metal3datatemplate_types.go

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const (
2929

3030
// MetaDataIndex contains the information to render the index
3131
type MetaDataIndex struct {
32-
// Key is the metadata key when redendering this metadata element
32+
// Key will be used as the key to set in the metadata map for cloud-init
3333
Key string `json:"key"`
3434
// Offset is the offset to apply to the index when rendering it
3535
Offset int `json:"offset,omitempty"`
@@ -45,7 +45,7 @@ type MetaDataIndex struct {
4545
// MetaDataFromLabel contains the information to fetch a label content, if the
4646
// label does not exist, it is rendered as empty string
4747
type MetaDataFromLabel struct {
48-
// Key is the metadata key when redendering this metadata element
48+
// Key will be used as the key to set in the metadata map for cloud-init
4949
Key string `json:"key"`
5050
// +kubebuilder:validation:Enum=machine;metal3machine;baremetalhost
5151
// Object is the type of the object from which we retrieve the name
@@ -57,7 +57,7 @@ type MetaDataFromLabel struct {
5757
// MetaDataFromAnnotation contains the information to fetch an annotation
5858
// content, if the label does not exist, it is rendered as empty string
5959
type MetaDataFromAnnotation struct {
60-
// Key is the metadata key when redendering this metadata element
60+
// Key will be used as the key to set in the metadata map for cloud-init
6161
Key string `json:"key"`
6262
// +kubebuilder:validation:Enum=machine;metal3machine;baremetalhost
6363
// Object is the type of the object from which we retrieve the name
@@ -68,21 +68,21 @@ type MetaDataFromAnnotation struct {
6868

6969
// MetaDataString contains the information to render the string
7070
type MetaDataString struct {
71-
// Key is the metadata key when redendering this metadata element
71+
// Key will be used as the key to set in the metadata map for cloud-init
7272
Key string `json:"key"`
7373
// Value is the string to render.
7474
Value string `json:"value"`
7575
}
7676

7777
// MetaDataNamespace contains the information to render the namespace
7878
type MetaDataNamespace struct {
79-
// Key is the metadata key when redendering this metadata element
79+
// Key will be used as the key to set in the metadata map for cloud-init
8080
Key string `json:"key"`
8181
}
8282

8383
// MetaDataObjectName contains the information to render the object name
8484
type MetaDataObjectName struct {
85-
// Key is the metadata key when redendering this metadata element
85+
// Key will be used as the key to set in the metadata map for cloud-init
8686
Key string `json:"key"`
8787
// +kubebuilder:validation:Enum=machine;metal3machine;baremetalhost
8888
// Object is the type of the object from which we retrieve the name
@@ -91,7 +91,7 @@ type MetaDataObjectName struct {
9191

9292
// MetaDataHostInterface contains the information to render the object name
9393
type MetaDataHostInterface struct {
94-
// Key is the metadata key when redendering this metadata element
94+
// Key will be used as the key to set in the metadata map for cloud-init
9595
Key string `json:"key"`
9696
// Interface is the name of the interface in the BareMetalHost Status Hardware
9797
// Details list of interfaces from which to fetch the MAC address.
@@ -101,7 +101,7 @@ type MetaDataHostInterface struct {
101101
// MetaDataIPAddress contains the info to render th ip address. It is IP-version
102102
// agnostic
103103
type MetaDataIPAddress struct {
104-
// Key is the metadata key when redendering this metadata element
104+
// Key will be used as the key to set in the metadata map for cloud-init
105105
Key string `json:"key"`
106106
// Start is the first ip address that can be rendered
107107
Start *ipamv1.IPAddressStr `json:"start,omitempty"`
@@ -118,10 +118,10 @@ type MetaDataIPAddress struct {
118118
}
119119

120120
type FromPool struct {
121-
// Key is the metadata key when redendering this metadata element
121+
// Key will be used as the key to set in the metadata map for cloud-init
122122
Key string `json:"key"`
123123

124-
// Name is the name of the pool to use
124+
// Name is the name of the IPPool used to fetch the value to set in the metadata map for cloud-init
125125
Name string `json:"name"`
126126
}
127127

@@ -144,12 +144,15 @@ type MetaData struct {
144144
// IPAddressesFromPool is the list of metadata items to be rendered as ip addresses.
145145
IPAddressesFromPool []FromPool `json:"ipAddressesFromIPPool,omitempty"`
146146

147-
// PrefixesFromPool is the list of metadata items to be rendered as ip addresses.
147+
// PrefixesFromPool is the list of metadata items to be rendered as network prefixes.
148148
PrefixesFromPool []FromPool `json:"prefixesFromIPPool,omitempty"`
149149

150-
// GatewaysFromPool is the list of metadata items to be rendered as ip addresses.
150+
// GatewaysFromPool is the list of metadata items to be rendered as gateway addresses.
151151
GatewaysFromPool []FromPool `json:"gatewaysFromIPPool,omitempty"`
152152

153+
// DNSServersFromPool is the list of metadata items to be rendered as dns servers.
154+
DNSServersFromPool []FromPool `json:"dnsServersFromIPPool,omitempty"`
155+
153156
// FromHostInterfaces is the list of metadata items to be rendered as MAC
154157
// addresses of the host interfaces.
155158
FromHostInterfaces []MetaDataHostInterface `json:"fromHostInterfaces,omitempty"`
@@ -252,20 +255,30 @@ type NetworkDataLink struct {
252255

253256
// NetworkDataService represents a service object
254257
type NetworkDataService struct {
258+
255259
// DNS is a list of DNS services
256260
DNS []ipamv1.IPAddressStr `json:"dns,omitempty"`
261+
262+
//DNSFromIPPool is the name of the IPPool from which to get the DNS servers
263+
DNSFromIPPool *string `json:"dnsFromIPPool,omitempty"`
257264
}
258265

259266
// NetworkDataServicev4 represents a service object
260267
type NetworkDataServicev4 struct {
261268
// DNS is a list of IPv4 DNS services
262269
DNS []ipamv1.IPAddressv4Str `json:"dns,omitempty"`
270+
271+
//DNSFromIPPool is the name of the IPPool from which to get the DNS servers
272+
DNSFromIPPool *string `json:"dnsFromIPPool,omitempty"`
263273
}
264274

265275
// NetworkDataServicev6 represents a service object
266276
type NetworkDataServicev6 struct {
267277
// DNS is a list of IPv6 DNS services
268278
DNS []ipamv1.IPAddressv6Str `json:"dns,omitempty"`
279+
280+
//DNSFromIPPool is the name of the IPPool from which to get the DNS servers
281+
DNSFromIPPool *string `json:"dnsFromIPPool,omitempty"`
269282
}
270283

271284
// NetworkGatewayv4 represents a gateway, given as a string or as a reference to
@@ -275,7 +288,7 @@ type NetworkGatewayv4 struct {
275288
// String is the gateway given as a string
276289
String *ipamv1.IPAddressv4Str `json:"string,omitempty"`
277290

278-
// FromIPPool is the name of the pool to fetch the gateway from
291+
// FromIPPool is the name of the IPPool to fetch the gateway from
279292
FromIPPool *string `json:"fromIPPool,omitempty"`
280293
}
281294

@@ -286,7 +299,7 @@ type NetworkGatewayv6 struct {
286299
// String is the gateway given as a string
287300
String *ipamv1.IPAddressv6Str `json:"string,omitempty"`
288301

289-
// FromIPPool is the name of the pool to fetch the gateway from
302+
// FromIPPool is the name of the IPPool to fetch the gateway from
290303
FromIPPool *string `json:"fromIPPool,omitempty"`
291304
}
292305

@@ -331,7 +344,7 @@ type NetworkDataIPv4 struct {
331344
// Link is the link on which the network applies
332345
Link string `json:"link"`
333346

334-
// IPAddressFromIPPool contains the name of the pool to use to get an ip address
347+
// IPAddressFromIPPool contains the name of the IPPool to use to get an ip address
335348
IPAddressFromIPPool string `json:"ipAddressFromIPPool"`
336349

337350
// Routes contains a list of IPv4 routes
@@ -347,7 +360,7 @@ type NetworkDataIPv6 struct {
347360
// Link is the link on which the network applies
348361
Link string `json:"link"`
349362

350-
// IPAddressFromIPPool contains the name of the pool to use to get an ip address
363+
// IPAddressFromIPPool contains the name of the IPPool to use to get an ip address
351364
IPAddressFromIPPool string `json:"ipAddressFromIPPool"`
352365

353366
// Routes contains a list of IPv6 routes

api/v1alpha4/zz_generated.deepcopy.go

Lines changed: 20 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)