github.com/openshift/installer@v1.4.17/pkg/types/openstack/machinepool.go (about) 1 package openstack 2 3 // MachinePool stores the configuration for a machine pool installed 4 // on OpenStack. 5 type MachinePool struct { 6 // FlavorName defines the OpenStack Nova flavor. 7 // eg. m1.large 8 FlavorName string `json:"type"` 9 10 // RootVolume defines the root volume for instances in the machine pool. 11 // The instances use ephemeral disks if not set. 12 // +optional 13 RootVolume *RootVolume `json:"rootVolume,omitempty"` 14 15 // AdditionalNetworkIDs contains IDs of additional networks for machines, 16 // where each ID is presented in UUID v4 format. 17 // Allowed address pairs won't be created for the additional networks. 18 // +optional 19 AdditionalNetworkIDs []string `json:"additionalNetworkIDs,omitempty"` 20 21 // AdditionalSecurityGroupIDs contains IDs of additional security groups for machines, 22 // where each ID is presented in UUID v4 format. 23 // +optional 24 AdditionalSecurityGroupIDs []string `json:"additionalSecurityGroupIDs,omitempty"` 25 26 // ServerGroupPolicy will be used to create the Server Group that will contain all the machines of this MachinePool. 27 // Defaults to "soft-anti-affinity". 28 ServerGroupPolicy ServerGroupPolicy `json:"serverGroupPolicy,omitempty"` 29 30 // Zones is the list of availability zones where the instances should be deployed. 31 // If no zones are provided, all instances will be deployed on OpenStack Nova default availability zone 32 // +optional 33 Zones []string `json:"zones,omitempty"` 34 } 35 36 // Set sets the values from `required` to `o`. 37 func (o *MachinePool) Set(required *MachinePool) { 38 if required == nil || o == nil { 39 return 40 } 41 42 if required.FlavorName != "" { 43 o.FlavorName = required.FlavorName 44 } 45 46 if required.RootVolume != nil { 47 if o.RootVolume == nil { 48 o.RootVolume = new(RootVolume) 49 } 50 o.RootVolume.Size = required.RootVolume.Size 51 o.RootVolume.DeprecatedType = required.RootVolume.DeprecatedType 52 53 if required.RootVolume.DeprecatedType != "" { 54 o.RootVolume.DeprecatedType = "" 55 o.RootVolume.Types = []string{required.RootVolume.DeprecatedType} 56 } else if len(required.RootVolume.Types) > 0 { 57 o.RootVolume.Types = required.RootVolume.Types 58 } 59 60 if len(required.RootVolume.Zones) > 0 { 61 o.RootVolume.Zones = required.RootVolume.Zones 62 } 63 } 64 65 if required.AdditionalNetworkIDs != nil { 66 o.AdditionalNetworkIDs = append(required.AdditionalNetworkIDs[:0:0], required.AdditionalNetworkIDs...) 67 } 68 69 if required.AdditionalSecurityGroupIDs != nil { 70 o.AdditionalSecurityGroupIDs = append(required.AdditionalSecurityGroupIDs[:0:0], required.AdditionalSecurityGroupIDs...) 71 } 72 73 if required.ServerGroupPolicy != "" { 74 o.ServerGroupPolicy = required.ServerGroupPolicy 75 } 76 77 if len(required.Zones) > 0 { 78 o.Zones = required.Zones 79 } 80 } 81 82 // RootVolume defines the storage for an instance. 83 type RootVolume struct { 84 // Size defines the size of the volume in gibibytes (GiB). 85 // Required 86 Size int `json:"size"` 87 // Type defines the type of the volume. 88 // Deprecated: Use Types instead. 89 // +optional 90 DeprecatedType string `json:"type,omitempty"` 91 92 // Types is the list of the volume types of the root volumes. 93 // This is mutually exclusive with Type. 94 // +required 95 Types []string `json:"types"` 96 97 // Zones is the list of availability zones where the root volumes should be deployed. 98 // If no zones are provided, all instances will be deployed on OpenStack Cinder default availability zone 99 // +optional 100 Zones []string `json:"zones,omitempty"` 101 } 102 103 // PortTarget defines, directly or indirectly, one or more subnets where to attach a port. 104 type PortTarget struct { 105 // Network is a query for an openstack network that the port will be discovered on. 106 // This will fail if the query returns more than one network. 107 Network NetworkFilter `json:"network,omitempty"` 108 // Specify subnets of the network where control plane port will be discovered. 109 FixedIPs []FixedIP `json:"fixedIPs"` 110 } 111 112 // NetworkFilter defines a network by name and/or ID. 113 type NetworkFilter struct { 114 Name string `json:"name,omitempty"` 115 ID string `json:"id,omitempty"` 116 } 117 118 // FixedIP identifies a subnet defined by a subnet filter. 119 type FixedIP struct { 120 Subnet SubnetFilter `json:"subnet"` 121 } 122 123 // SubnetFilter defines a subnet by ID and/or name. 124 type SubnetFilter struct { 125 ID string `json:"id,omitempty"` 126 Name string `json:"name,omitempty"` 127 }