Skip to content

Commit b322709

Browse files
Merge pull request openshift#6585 from kevydotvinu/ocpbugs-3542
OCPBUGS-3542: Add bootstrapExternalStaticDNS
2 parents 2834d19 + bc3d3d2 commit b322709

File tree

5 files changed

+33
-1
lines changed

5 files changed

+33
-1
lines changed

data/data/bootstrap/baremetal/files/etc/NetworkManager/system-connections/nmconnection.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ mac-address={{.PlatformData.BareMetal.ExternalMACAddress}}
1111
method=manual
1212
addresses={{.PlatformData.BareMetal.ExternalStaticIP}}/{{.PlatformData.BareMetal.ExternalSubnetCIDR}}
1313
gateway={{.PlatformData.BareMetal.ExternalStaticGateway}}
14-
dns={{.PlatformData.BareMetal.ExternalStaticGateway}}
14+
dns={{.PlatformData.BareMetal.ExternalStaticDNS}}
1515
{{end}}

data/data/install.openshift.io_installconfigs.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2528,6 +2528,12 @@ spec:
25282528
maxItems: 2
25292529
type: array
25302530
uniqueItems: true
2531+
bootstrapExternalStaticDNS:
2532+
description: BootstrapExternalStaticDNS is the static network
2533+
DNS of the bootstrap node. This can be useful in environments
2534+
without a DHCP server.
2535+
format: ip
2536+
type: string
25312537
bootstrapExternalStaticGateway:
25322538
description: BootstrapExternalStaticGateway is the static network
25332539
gateway of the bootstrap node. This can be useful in environments

pkg/asset/ignition/bootstrap/baremetal/template.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ type TemplateData struct {
6565
// ExternalStaticIP is the static gateway of the bootstrap node
6666
ExternalStaticGateway string
6767

68+
// ExternalStaticDNS is the static DNS of the bootstrap node
69+
ExternalStaticDNS string
70+
6871
ExternalSubnetCIDR int
6972

7073
ExternalMACAddress string
@@ -80,6 +83,7 @@ func GetTemplateData(config *baremetal.Platform, networks []types.MachineNetwork
8083
templateData.ProvisioningNetwork = string(config.ProvisioningNetwork)
8184
templateData.ExternalStaticIP = config.BootstrapExternalStaticIP
8285
templateData.ExternalStaticGateway = config.BootstrapExternalStaticGateway
86+
templateData.ExternalStaticDNS = config.BootstrapExternalStaticDNS
8387
templateData.ExternalMACAddress = config.ExternalMACAddress
8488

8589
if len(config.APIVIPs) > 0 {

pkg/asset/installconfig/baremetal/validation.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,25 @@ func ValidateStaticBootstrapNetworking(ic *types.InstallConfig) error {
2929
return errors.New(field.Required(field.NewPath("platform", "baremetal"), "You must specify a value for BootstrapExternalStaticGateway when BootstrapExternalStaticIP is set.").Error())
3030
}
3131

32+
if ic.Platform.BareMetal.BootstrapExternalStaticIP != "" && ic.Platform.BareMetal.BootstrapExternalStaticDNS == "" {
33+
return errors.New(field.Required(field.NewPath("platform", "baremetal"), "You must specify a value for BootstrapExternalStaticDNS when BootstrapExternalStaticIP is set.").Error())
34+
}
35+
3236
if ic.Platform.BareMetal.BootstrapExternalStaticGateway != "" && ic.Platform.BareMetal.BootstrapExternalStaticIP == "" {
3337
return errors.New(field.Required(field.NewPath("platform", "baremetal"), "You must specify a value for BootstrapExternalStaticIP when BootstrapExternalStaticGateway is set.").Error())
3438
}
3539

40+
if ic.Platform.BareMetal.BootstrapExternalStaticGateway != "" && ic.Platform.BareMetal.BootstrapExternalStaticDNS == "" {
41+
return errors.New(field.Required(field.NewPath("platform", "baremetal"), "You must specify a value for BootstrapExternalStaticDNS when BootstrapExternalStaticGateway is set.").Error())
42+
}
43+
44+
if ic.Platform.BareMetal.BootstrapExternalStaticDNS != "" && ic.Platform.BareMetal.BootstrapExternalStaticIP == "" {
45+
return errors.New(field.Required(field.NewPath("platform", "baremetal"), "You must specify a value for BootstrapExternalStaticIP when BootstrapExternalStaticDNS is set.").Error())
46+
}
47+
48+
if ic.Platform.BareMetal.BootstrapExternalStaticDNS != "" && ic.Platform.BareMetal.BootstrapExternalStaticGateway == "" {
49+
return errors.New(field.Required(field.NewPath("platform", "baremetal"), "You must specify a value for BootstrapExternalStaticGateway when BootstrapExternalStaticDNS is set.").Error())
50+
}
51+
3652
return nil
3753
}

pkg/types/baremetal/platform.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,4 +232,10 @@ type Platform struct {
232232
// LoadBalancer is available in TechPreview.
233233
// +optional
234234
LoadBalancer *configv1.BareMetalPlatformLoadBalancer `json:"loadBalancer,omitempty"`
235+
236+
// BootstrapExternalStaticDNS is the static network DNS of the bootstrap node.
237+
// This can be useful in environments without a DHCP server.
238+
// +kubebuilder:validation:Format=ip
239+
// +optional
240+
BootstrapExternalStaticDNS string `json:"bootstrapExternalStaticDNS,omitempty"`
235241
}

0 commit comments

Comments
 (0)