File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed
Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -42,11 +42,6 @@ func SetInstallConfigDefaults(c *types.InstallConfig) {
4242 {CIDR : * libvirtdefaults .DefaultMachineCIDR },
4343 }
4444 }
45- if c .Platform .PowerVS != nil {
46- c .Networking .MachineNetwork = []types.MachineNetworkEntry {
47- {CIDR : * powervsdefaults .DefaultMachineCIDR },
48- }
49- }
5045 }
5146 if c .Networking .NetworkType == "" {
5247 c .Networking .NetworkType = defaultNetworkType
@@ -122,6 +117,9 @@ func SetInstallConfigDefaults(c *types.InstallConfig) {
122117 }
123118 case c .Platform .PowerVS != nil :
124119 powervsdefaults .SetPlatformDefaults (c .Platform .PowerVS )
120+ c .Networking .MachineNetwork = []types.MachineNetworkEntry {
121+ {CIDR : * powervsdefaults .DefaultMachineCIDR },
122+ }
125123 case c .Platform .None != nil :
126124 nonedefaults .SetPlatformDefaults (c .Platform .None )
127125 case c .Platform .Nutanix != nil :
Original file line number Diff line number Diff line change 11package defaults
22
33import (
4+ "crypto/rand"
5+ "fmt"
6+ "math/big"
7+
48 "github.com/openshift/installer/pkg/ipnet"
59 "github.com/openshift/installer/pkg/types/powervs"
610)
1317
1418// SetPlatformDefaults sets the defaults for the platform.
1519func SetPlatformDefaults (p * powervs.Platform ) {
20+ n , err := rand .Int (rand .Reader , big .NewInt (253 ))
21+ if err != nil {
22+ panic (err )
23+ }
24+ subnet := n .Int64 ()
25+ // MustParseCIDR parses a CIDR from its string representation. If the parse fails, the function will panic.
26+ DefaultMachineCIDR = ipnet .MustParseCIDR (fmt .Sprintf ("192.168.%d.0/24" , subnet ))
1627}
You can’t perform that action at this time.
0 commit comments