From 211cfd18f4562e450bfe205b75c0beea55f229fe Mon Sep 17 00:00:00 2001 From: Ian Main Date: Wed, 2 Oct 2019 11:35:24 -0700 Subject: [PATCH] Configure Metal3 from the installer. Extend the baremetal platform fields to include provisioning information for the pod started by the Machine API Operator. Now includes defaults and the ability to set defaults based on just the network CIDR. Note this depends on https://github.com/openshift/api/pull/480 Co-Authored-By: Steven Hardy --- pkg/asset/manifests/infrastructure.go | 25 +++- pkg/types/baremetal/defaults/platform.go | 58 +++++++- pkg/types/baremetal/defaults/platform_test.go | 85 +++++++++++ pkg/types/baremetal/platform.go | 25 ++++ pkg/types/baremetal/validation/platform.go | 39 +++++ .../baremetal/validation/platform_test.go | 136 +++++++++++++++++- .../api/config/v1/types_infrastructure.go | 21 +++ 7 files changed, 378 insertions(+), 11 deletions(-) create mode 100644 pkg/types/baremetal/defaults/platform_test.go diff --git a/pkg/asset/manifests/infrastructure.go b/pkg/asset/manifests/infrastructure.go index 99e19d622e8..459ba11b1bc 100644 --- a/pkg/asset/manifests/infrastructure.go +++ b/pkg/asset/manifests/infrastructure.go @@ -2,7 +2,9 @@ package manifests import ( "fmt" + "net" "path/filepath" + "strings" "github.com/ghodss/yaml" "github.com/pkg/errors" @@ -13,6 +15,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" gcpmanifests "github.com/openshift/installer/pkg/asset/manifests/gcp" + "github.com/openshift/installer/pkg/asset/rhcos" "github.com/openshift/installer/pkg/types/aws" "github.com/openshift/installer/pkg/types/azure" "github.com/openshift/installer/pkg/types/baremetal" @@ -50,6 +53,7 @@ func (*Infrastructure) Dependencies() []asset.Asset { &installconfig.InstallConfig{}, &CloudProviderConfig{}, &AdditionalTrustBundleConfig{}, + new(rhcos.Image), } } @@ -59,7 +63,8 @@ func (i *Infrastructure) Generate(dependencies asset.Parents) error { installConfig := &installconfig.InstallConfig{} cloudproviderconfig := &CloudProviderConfig{} trustbundleconfig := &AdditionalTrustBundleConfig{} - dependencies.Get(clusterID, installConfig, cloudproviderconfig, trustbundleconfig) + rhcosImage := new(rhcos.Image) + dependencies.Get(clusterID, installConfig, cloudproviderconfig, trustbundleconfig, rhcosImage) config := &configv1.Infrastructure{ TypeMeta: metav1.TypeMeta{ @@ -98,10 +103,22 @@ func (i *Infrastructure) Generate(dependencies asset.Parents) error { } case baremetal.Name: config.Status.PlatformStatus.Type = configv1.BareMetalPlatformType + // The MAO expects the ProvisioiningDHCPRange in comma-separated format + provDHCPArr := []string{ + installConfig.Config.Platform.BareMetal.ProvisioningDHCPStart, + installConfig.Config.Platform.BareMetal.ProvisioningDHCPEnd, + } + provDHCPRange := strings.Join(provDHCPArr, ",") config.Status.PlatformStatus.BareMetal = &configv1.BareMetalPlatformStatus{ - APIServerInternalIP: installConfig.Config.Platform.BareMetal.APIVIP, - NodeDNSIP: installConfig.Config.Platform.BareMetal.DNSVIP, - IngressIP: installConfig.Config.Platform.BareMetal.IngressVIP, + APIServerInternalIP: installConfig.Config.Platform.BareMetal.APIVIP, + NodeDNSIP: installConfig.Config.Platform.BareMetal.DNSVIP, + IngressIP: installConfig.Config.Platform.BareMetal.IngressVIP, + ProvisioningInterface: installConfig.Config.Platform.BareMetal.ProvisioningInterface, + ProvisioningNetworkCIDR: installConfig.Config.Platform.BareMetal.ProvisioningNetworkCIDR, + ProvisioningIP: installConfig.Config.Platform.BareMetal.ClusterProvisioningIP, + ProvisioningDHCPRange: provDHCPRange, + CachedImageURL: installConfig.Config.Platform.BareMetal.CachedImageURL, + RhcosImageURL: string(*rhcosImage), } case gcp.Name: config.Status.PlatformStatus.Type = configv1.GCPPlatformType diff --git a/pkg/types/baremetal/defaults/platform.go b/pkg/types/baremetal/defaults/platform.go index 47e03cc3e50..b2334927ef2 100644 --- a/pkg/types/baremetal/defaults/platform.go +++ b/pkg/types/baremetal/defaults/platform.go @@ -6,32 +6,54 @@ import ( "github.com/openshift/installer/pkg/types" "github.com/openshift/installer/pkg/types/baremetal" + + "github.com/apparentlymart/go-cidr/cidr" ) // Defaults for the baremetal platform. const ( LibvirtURI = "qemu:///system" - BootstrapProvisioningIP = "172.22.0.2" - ClusterProvisioningIP = "172.22.0.3" ExternalBridge = "baremetal" ProvisioningBridge = "provisioning" HardwareProfile = "default" APIVIP = "" IngressVIP = "" + ProvisioningInterface = "ens3" + ProvisioningNetworkCIDR = "172.22.0.0/24" + CachedImageURL = "http://192.168.111.1/images" ) +// Wrapper for net.LookupHost so we can override in the test +var lookupHost = func(host string) (addrs []string, err error) { + return net.LookupHost(host) +} + // SetPlatformDefaults sets the defaults for the platform. func SetPlatformDefaults(p *baremetal.Platform, c *types.InstallConfig) { if p.LibvirtURI == "" { p.LibvirtURI = LibvirtURI } + if p.ProvisioningNetworkCIDR == "" { + p.ProvisioningNetworkCIDR = ProvisioningNetworkCIDR + } + + _, provNet, _ := net.ParseCIDR(p.ProvisioningNetworkCIDR) + if p.BootstrapProvisioningIP == "" { - p.BootstrapProvisioningIP = BootstrapProvisioningIP + // Default to .2 address for CIDR e.g 172.22.0.2 + ip, err := cidr.Host(provNet, 2) + if err == nil { + p.BootstrapProvisioningIP = ip.String() + } } if p.ClusterProvisioningIP == "" { - p.ClusterProvisioningIP = ClusterProvisioningIP + // Default to .3 address for CIDR e.g 172.22.0.3 + ip, err := cidr.Host(provNet, 3) + if err == nil { + p.ClusterProvisioningIP = ip.String() + } } if p.ExternalBridge == "" { @@ -50,7 +72,7 @@ func SetPlatformDefaults(p *baremetal.Platform, c *types.InstallConfig) { if p.APIVIP == APIVIP { // This name should resolve to exactly one address - vip, err := net.LookupHost("api." + c.ClusterDomain()) + vip, err := lookupHost("api." + c.ClusterDomain()) if err != nil { // This will fail validation and abort the install p.APIVIP = fmt.Sprintf("DNS lookup failure: %s", err.Error()) @@ -61,7 +83,7 @@ func SetPlatformDefaults(p *baremetal.Platform, c *types.InstallConfig) { if p.IngressVIP == IngressVIP { // This name should resolve to exactly one address - vip, err := net.LookupHost("test.apps." + c.ClusterDomain()) + vip, err := lookupHost("test.apps." + c.ClusterDomain()) if err != nil { // This will fail validation and abort the install p.IngressVIP = fmt.Sprintf("DNS lookup failure: %s", err.Error()) @@ -69,4 +91,28 @@ func SetPlatformDefaults(p *baremetal.Platform, c *types.InstallConfig) { p.IngressVIP = vip[0] } } + + if p.ProvisioningInterface == "" { + p.ProvisioningInterface = ProvisioningInterface + } + + if p.ProvisioningDHCPStart == "" { + // Default to .20 address for CIDR e.g 172.22.0.20 + ip, err := cidr.Host(provNet, 20) + if err == nil { + p.ProvisioningDHCPStart = ip.String() + } + } + + if p.ProvisioningDHCPEnd == "" { + // Default to .200 address for CIDR e.g 172.22.0.200 + ip, err := cidr.Host(provNet, 200) + if err == nil { + p.ProvisioningDHCPEnd = ip.String() + } + } + + if p.CachedImageURL == "" { + p.CachedImageURL = CachedImageURL + } } diff --git a/pkg/types/baremetal/defaults/platform_test.go b/pkg/types/baremetal/defaults/platform_test.go new file mode 100644 index 00000000000..be2619a4699 --- /dev/null +++ b/pkg/types/baremetal/defaults/platform_test.go @@ -0,0 +1,85 @@ +package defaults + +import ( + "errors" + "testing" + + "github.com/stretchr/testify/assert" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/openshift/installer/pkg/types" + "github.com/openshift/installer/pkg/types/baremetal" +) + +const testClusterName = "test-cluster" + +func TestSetPlatformDefaults(t *testing.T) { + // Stub the call to net.LookupHost + lookupHost = func (host string) (addrs []string, err error) { + if host == "api.test-cluster.test" { + ips := []string{"192.168.111.2",} + return ips, nil + } else if host == "test.apps.test-cluster.test" { + ips := []string{"192.168.111.3",} + return ips, nil + } else { + return nil, errors.New("Unknown Host " + host) + } + } + cases := []struct { + name string + platform *baremetal.Platform + expected *baremetal.Platform + }{ + { + name: "default_empty", + platform: &baremetal.Platform{}, + expected: &baremetal.Platform{ + LibvirtURI: "qemu:///system", + ClusterProvisioningIP: "172.22.0.3", + BootstrapProvisioningIP: "172.22.0.2", + ExternalBridge: "baremetal", + ProvisioningBridge: "provisioning", + APIVIP: "192.168.111.2", + IngressVIP: "192.168.111.3", + ProvisioningInterface: "ens3", + ProvisioningNetworkCIDR: "172.22.0.0/24", + ProvisioningDHCPStart: "172.22.0.20", + ProvisioningDHCPEnd: "172.22.0.200", + CachedImageURL: "http://192.168.111.1/images", + }, + }, + { + name: "alternate_cidr", + platform: &baremetal.Platform{ + ProvisioningNetworkCIDR: "172.23.0.0/24", + }, + expected: &baremetal.Platform{ + LibvirtURI: "qemu:///system", + ClusterProvisioningIP: "172.23.0.3", + BootstrapProvisioningIP: "172.23.0.2", + ExternalBridge: "baremetal", + ProvisioningBridge: "provisioning", + APIVIP: "192.168.111.2", + IngressVIP: "192.168.111.3", + ProvisioningInterface: "ens3", + ProvisioningNetworkCIDR: "172.23.0.0/24", + ProvisioningDHCPStart: "172.23.0.20", + ProvisioningDHCPEnd: "172.23.0.200", + CachedImageURL: "http://192.168.111.1/images", + }, + }, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + ic := &types.InstallConfig{ + ObjectMeta: metav1.ObjectMeta{ + Name: testClusterName, + }, + BaseDomain: "test", + } + SetPlatformDefaults(tc.platform, ic) + assert.Equal(t, tc.expected, tc.platform, "unexpected platform") + }) + } +} diff --git a/pkg/types/baremetal/platform.go b/pkg/types/baremetal/platform.go index 7c28bbe0eed..8420b9b2290 100644 --- a/pkg/types/baremetal/platform.go +++ b/pkg/types/baremetal/platform.go @@ -27,12 +27,14 @@ type Platform struct { // ClusterProvisioningIP is the IP on the dedicated provisioning network // where the baremetal-operator pod runs provisioning services, // and an http server to cache some downloaded content e.g RHCOS/IPA images + // Defaults to the .3 address of ProvisioningNetworkCIDR // +optional ClusterProvisioningIP string `json:"provisioningHostIP,omitempty"` // BootstrapProvisioningIP is the IP used on the bootstrap VM to // bring up provisioning services that are used to create the // control-plane machines + // Defaults to the .2 address of ProvisioningNetworkCIDR // +optional BootstrapProvisioningIP string `json:"bootstrapProvisioningIP,omitempty"` @@ -61,4 +63,27 @@ type Platform struct { // DNSVIP is the VIP to use for internal DNS communication DNSVIP string `json:"dnsVIP"` + + // ProvisioningInterface is the network interface used to provision new hosts. + // +optional + ProvisioningInterface string `json:"provisioningInterface"` + + // ProvisioningNetworkCIDR defines the network to use for provisioning. + // +optional + ProvisioningNetworkCIDR string `json:"provisioningNetworkCIDR"` + + // ProvisioningDHCPStart is the start of the DHCP range to use to assign hosts during provisioning. + // Defaults to the .20 address of ProvisioningNetworkCIDR + // +optional + ProvisioningDHCPStart string `json:"provisioningDHCPStart"` + + // ProvisioningDHCPEnd is the end of the DHCP range to use to assign hosts during provisioning. + // Defaults to the .200 address of ProvisioningNetworkCIDR + // +optional + ProvisioningDHCPEnd string `json:"provisioningDHCPEnd"` + + // An HTTP server URL which contains a cached image of the RHCOS image to deploy. + // Defaults to http://192.168.111.1/images for VM based testing + // +optional + CachedImageURL string `json:"cachedImageURL"` } diff --git a/pkg/types/baremetal/validation/platform.go b/pkg/types/baremetal/validation/platform.go index 682089c8eb0..ebb1a72f125 100644 --- a/pkg/types/baremetal/validation/platform.go +++ b/pkg/types/baremetal/validation/platform.go @@ -85,5 +85,44 @@ func ValidatePlatform(p *baremetal.Platform, n *types.Networking, fldPath *field allErrs = append(allErrs, field.Invalid(fldPath.Child("bootstrapHostIP"), p.BootstrapProvisioningIP, err.Error())) } + // Make sure the provisioning interface is set. Very little we can do to validate this + // as it's not on this machine. + if p.ProvisioningInterface == "" { + allErrs = append(allErrs, field.Invalid(fldPath.Child("provisioningInterface"), p.ProvisioningInterface, "Baremetal provisioning interface unset.")) + } + + _, provNetwork, err := net.ParseCIDR(p.ProvisioningNetworkCIDR) + if err != nil { + allErrs = append(allErrs, field.Invalid(fldPath.Child("provisioningNetworkCIDR"), p.ProvisioningNetworkCIDR, err.Error())) + } + + if provNetwork.Contains(net.ParseIP(p.ClusterProvisioningIP)) != true { + allErrs = append(allErrs, field.Invalid(fldPath.Child("provisioningHostIP"), p.ClusterProvisioningIP, "IP not in provisioning network.")) + } + + if provNetwork.Contains(net.ParseIP(p.BootstrapProvisioningIP)) != true { + allErrs = append(allErrs, field.Invalid(fldPath.Child("bootstrapHostIP"), p.BootstrapProvisioningIP, "IP not in provisioning network.")) + } + + if err := validate.IP(p.ProvisioningDHCPStart); err != nil { + allErrs = append(allErrs, field.Invalid(fldPath.Child("provisioningDHCPStart"), p.ProvisioningDHCPStart, err.Error())) + } + + if provNetwork.Contains(net.ParseIP(p.ProvisioningDHCPStart)) != true { + allErrs = append(allErrs, field.Invalid(fldPath.Child("provisioningDHCPStart"), p.ProvisioningDHCPStart, "IP not in provisioning network.")) + } + + if err := validate.IP(p.ProvisioningDHCPEnd); err != nil { + allErrs = append(allErrs, field.Invalid(fldPath.Child("provisioningDHCPEnd"), p.ProvisioningDHCPEnd, err.Error())) + } + + if provNetwork.Contains(net.ParseIP(p.ProvisioningDHCPEnd)) != true { + allErrs = append(allErrs, field.Invalid(fldPath.Child("provisioningDHCPEnd"), p.ProvisioningDHCPEnd, "IP not in provisioning network.")) + } + + if err := validate.URI(p.CachedImageURL); err != nil { + allErrs = append(allErrs, field.Invalid(fldPath.Child("cachedImageURL"), p.CachedImageURL, err.Error())) + } + return allErrs } diff --git a/pkg/types/baremetal/validation/platform_test.go b/pkg/types/baremetal/validation/platform_test.go index 4f3f01dacbb..fee1a4ba739 100644 --- a/pkg/types/baremetal/validation/platform_test.go +++ b/pkg/types/baremetal/validation/platform_test.go @@ -30,6 +30,11 @@ func TestValidatePlatform(t *testing.T) { LibvirtURI: "qemu://system", ClusterProvisioningIP: "172.22.0.3", BootstrapProvisioningIP: "172.22.0.2", + ProvisioningNetworkCIDR: "172.22.0.0/24", + ProvisioningDHCPStart: "172.22.0.20", + ProvisioningDHCPEnd: "172.22.0.200", + ProvisioningInterface: "ens3", + CachedImageURL: "http://192.168.111.1/images", ExternalBridge: iface[0].Name, ProvisioningBridge: iface[0].Name, }, @@ -45,6 +50,11 @@ func TestValidatePlatform(t *testing.T) { LibvirtURI: "qemu://system", ClusterProvisioningIP: "172.22.0.3", BootstrapProvisioningIP: "172.22.0.2", + ProvisioningNetworkCIDR: "172.22.0.0/24", + ProvisioningDHCPStart: "172.22.0.20", + ProvisioningDHCPEnd: "172.22.0.200", + ProvisioningInterface: "ens3", + CachedImageURL: "http://192.168.111.1/images", ExternalBridge: iface[0].Name, ProvisioningBridge: iface[0].Name, }, @@ -61,6 +71,11 @@ func TestValidatePlatform(t *testing.T) { LibvirtURI: "qemu://system", ClusterProvisioningIP: "172.22.0.3", BootstrapProvisioningIP: "172.22.0.2", + ProvisioningNetworkCIDR: "172.22.0.0/24", + ProvisioningDHCPStart: "172.22.0.20", + ProvisioningDHCPEnd: "172.22.0.200", + ProvisioningInterface: "ens3", + CachedImageURL: "http://192.168.111.1/images", ExternalBridge: iface[0].Name, ProvisioningBridge: iface[0].Name, }, @@ -77,6 +92,11 @@ func TestValidatePlatform(t *testing.T) { LibvirtURI: "qemu://system", ClusterProvisioningIP: "172.22.0.3", BootstrapProvisioningIP: "172.22.0.2", + ProvisioningNetworkCIDR: "172.22.0.0/24", + ProvisioningDHCPStart: "172.22.0.20", + ProvisioningDHCPEnd: "172.22.0.200", + ProvisioningInterface: "ens3", + CachedImageURL: "http://192.168.111.1/images", ExternalBridge: iface[0].Name, ProvisioningBridge: iface[0].Name, }, @@ -93,6 +113,11 @@ func TestValidatePlatform(t *testing.T) { LibvirtURI: "qemu://system", ClusterProvisioningIP: "172.22.0.3", BootstrapProvisioningIP: "172.22.0.2", + ProvisioningNetworkCIDR: "172.22.0.0/24", + ProvisioningDHCPStart: "172.22.0.20", + ProvisioningDHCPEnd: "172.22.0.200", + ProvisioningInterface: "ens3", + CachedImageURL: "http://192.168.111.1/images", ExternalBridge: iface[0].Name, ProvisioningBridge: iface[0].Name, }, @@ -109,6 +134,11 @@ func TestValidatePlatform(t *testing.T) { LibvirtURI: "", ClusterProvisioningIP: "172.22.0.3", BootstrapProvisioningIP: "172.22.0.2", + ProvisioningNetworkCIDR: "172.22.0.0/24", + ProvisioningDHCPStart: "172.22.0.20", + ProvisioningDHCPEnd: "172.22.0.200", + ProvisioningInterface: "ens3", + CachedImageURL: "http://192.168.111.1/images", ExternalBridge: iface[0].Name, ProvisioningBridge: iface[0].Name, }, @@ -125,6 +155,11 @@ func TestValidatePlatform(t *testing.T) { LibvirtURI: "qemu://system", ClusterProvisioningIP: "172.22.0.3", BootstrapProvisioningIP: "172.22.0.2", + ProvisioningNetworkCIDR: "172.22.0.0/24", + ProvisioningDHCPStart: "172.22.0.20", + ProvisioningDHCPEnd: "172.22.0.200", + ProvisioningInterface: "ens3", + CachedImageURL: "http://192.168.111.1/images", ExternalBridge: "noexist", ProvisioningBridge: iface[0].Name, }, @@ -141,6 +176,11 @@ func TestValidatePlatform(t *testing.T) { LibvirtURI: "qemu://system", ClusterProvisioningIP: "172.22.0.3", BootstrapProvisioningIP: "172.22.0.2", + ProvisioningNetworkCIDR: "172.22.0.0/24", + ProvisioningDHCPStart: "172.22.0.20", + ProvisioningDHCPEnd: "172.22.0.200", + ProvisioningInterface: "ens3", + CachedImageURL: "http://192.168.111.1/images", ExternalBridge: iface[0].Name, ProvisioningBridge: "noexist", }, @@ -157,6 +197,11 @@ func TestValidatePlatform(t *testing.T) { LibvirtURI: "qemu://system", ClusterProvisioningIP: "192.168.111.5", BootstrapProvisioningIP: "172.22.0.2", + ProvisioningNetworkCIDR: "172.22.0.0/24", + ProvisioningDHCPStart: "172.22.0.20", + ProvisioningDHCPEnd: "172.22.0.200", + ProvisioningInterface: "ens3", + CachedImageURL: "http://192.168.111.1/images", ExternalBridge: iface[0].Name, ProvisioningBridge: iface[0].Name, }, @@ -164,7 +209,7 @@ func TestValidatePlatform(t *testing.T) { expected: "Invalid value: \"192.168.111.5\": the IP must not be in 192.168.111.0/24 subnet", }, { - name: "invalid_bootstrapprovip", + name: "invalid_bootstrapprovip_mcidr_overlap", platform: &baremetal.Platform{ APIVIP: "192.168.111.2", DNSVIP: "192.168.111.3", @@ -173,12 +218,101 @@ func TestValidatePlatform(t *testing.T) { LibvirtURI: "qemu://system", ClusterProvisioningIP: "172.22.0.3", BootstrapProvisioningIP: "192.168.111.5", + ProvisioningNetworkCIDR: "172.22.0.0/24", + ProvisioningDHCPStart: "172.22.0.20", + ProvisioningDHCPEnd: "172.22.0.200", + ProvisioningInterface: "ens3", + CachedImageURL: "http://192.168.111.1/images", ExternalBridge: iface[0].Name, ProvisioningBridge: iface[0].Name, }, network: network, expected: "Invalid value: \"192.168.111.5\": the IP must not be in 192.168.111.0/24 subnet", }, + { + name: "invalid_bootstrapprovip_wrong_subnet", + platform: &baremetal.Platform{ + APIVIP: "192.168.111.2", + DNSVIP: "192.168.111.3", + IngressVIP: "192.168.111.4", + Hosts: []*baremetal.Host{}, + LibvirtURI: "qemu://system", + ClusterProvisioningIP: "172.22.0.3", + BootstrapProvisioningIP: "172.22.1.5", + ProvisioningNetworkCIDR: "172.22.0.0/24", + ProvisioningDHCPStart: "172.22.0.20", + ProvisioningDHCPEnd: "172.22.0.200", + ProvisioningInterface: "ens3", + CachedImageURL: "http://192.168.111.1/images", + ExternalBridge: iface[0].Name, + ProvisioningBridge: iface[0].Name, + }, + network: network, + expected: "Invalid value: \"172.22.1.5\": IP not in provisioning network", + }, + { + name: "invalid_clusterprovip_wrong_subnet", + platform: &baremetal.Platform{ + APIVIP: "192.168.111.2", + DNSVIP: "192.168.111.3", + IngressVIP: "192.168.111.4", + Hosts: []*baremetal.Host{}, + LibvirtURI: "qemu://system", + ClusterProvisioningIP: "172.22.1.3", + BootstrapProvisioningIP: "172.22.0.5", + ProvisioningNetworkCIDR: "172.22.0.0/24", + ProvisioningDHCPStart: "172.22.0.20", + ProvisioningDHCPEnd: "172.22.0.200", + ProvisioningInterface: "ens3", + CachedImageURL: "http://192.168.111.1/images", + ExternalBridge: iface[0].Name, + ProvisioningBridge: iface[0].Name, + }, + network: network, + expected: "Invalid value: \"172.22.1.3\": IP not in provisioning network", + }, + { + name: "invalid_dhcp_start_wrong_subnet", + platform: &baremetal.Platform{ + APIVIP: "192.168.111.2", + DNSVIP: "192.168.111.3", + IngressVIP: "192.168.111.4", + Hosts: []*baremetal.Host{}, + LibvirtURI: "qemu://system", + ClusterProvisioningIP: "172.22.0.3", + BootstrapProvisioningIP: "172.22.0.5", + ProvisioningNetworkCIDR: "172.22.0.0/24", + ProvisioningDHCPStart: "172.22.1.20", + ProvisioningDHCPEnd: "172.22.0.200", + ProvisioningInterface: "ens3", + CachedImageURL: "http://192.168.111.1/images", + ExternalBridge: iface[0].Name, + ProvisioningBridge: iface[0].Name, + }, + network: network, + expected: "Invalid value: \"172.22.1.20\": IP not in provisioning network", + }, + { + name: "invalid_dhcp_end_wrong_subnet", + platform: &baremetal.Platform{ + APIVIP: "192.168.111.2", + DNSVIP: "192.168.111.3", + IngressVIP: "192.168.111.4", + Hosts: []*baremetal.Host{}, + LibvirtURI: "qemu://system", + ClusterProvisioningIP: "172.22.0.3", + BootstrapProvisioningIP: "172.22.0.5", + ProvisioningNetworkCIDR: "172.22.0.0/24", + ProvisioningDHCPStart: "172.22.0.20", + ProvisioningDHCPEnd: "172.22.1.200", + ProvisioningInterface: "ens3", + CachedImageURL: "http://192.168.111.1/images", + ExternalBridge: iface[0].Name, + ProvisioningBridge: iface[0].Name, + }, + network: network, + expected: "Invalid value: \"172.22.1.200\": IP not in provisioning network", + }, } for _, tc := range cases { diff --git a/vendor/github.com/openshift/api/config/v1/types_infrastructure.go b/vendor/github.com/openshift/api/config/v1/types_infrastructure.go index ac1e5048ee1..202e76549b4 100644 --- a/vendor/github.com/openshift/api/config/v1/types_infrastructure.go +++ b/vendor/github.com/openshift/api/config/v1/types_infrastructure.go @@ -182,6 +182,27 @@ type BareMetalPlatformStatus struct { // datacenter DNS, a DNS service is hosted as a static pod to serve those hostnames // to the nodes in the cluster. NodeDNSIP string `json:"nodeDNSIP,omitempty"` + + // ProvisioningInterface is the network interface used to provision new hosts. + ProvisioningInterface string `json:"provisioningInterface,omitempty"` + + // ProvisioningNetworkCIDR defines the network to use for provisioning. + ProvisioningNetworkCIDR string `json:"provisioningNetworkCIDR,omitempty"` + + // ProvisioningIP is the IP address to assign to the provisioning interface. + ProvisioningIP string `json:"provisioningIP,omitempty"` + + // ProvisioningDHCPStart is the start of the DHCP range to use to assign hosts during provisioning. + ProvisioningDHCPStart string `json:"provisioningDHCPStart"` + + // ProvisioningDHCPStart is the start of the DHCP range to use to assign hosts during provisioning. + ProvisioningDHCPEnd string `json:"provisioningDHCPEnd"` + + // An HTTP server runs on the bootstrap node/vm and contains a cached image of the RHCOS image to deploy. + CachedImageURL string `json:"cachedImageURL"` + + // RhcosImageURL is the install image used to provision new nodes. + RhcosImageURL string `json:"rhcosImageURL"` } // OpenStackPlatformStatus holds the current status of the OpenStack infrastructure provider.