github.com/openshift/installer@v1.4.17/pkg/types/baremetal/platform.go (about) 1 package baremetal 2 3 import ( 4 apiextv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" 5 6 configv1 "github.com/openshift/api/config/v1" 7 "github.com/openshift/installer/pkg/ipnet" 8 ) 9 10 // BMC stores the information about a baremetal host's management controller. 11 type BMC struct { 12 Username string `json:"username" validate:"required"` 13 Password string `json:"password" validate:"required"` 14 Address string `json:"address" validate:"required,uniqueField"` 15 DisableCertificateVerification bool `json:"disableCertificateVerification"` 16 } 17 18 // BootMode puts the server in legacy (BIOS), UEFI secure boot or UEFI mode for 19 // booting. Secure boot is only enabled during the final instance boot. 20 // The default is UEFI. 21 // +kubebuilder:validation:Enum="";UEFI;UEFISecureBoot;legacy 22 type BootMode string 23 24 // Allowed boot mode from metal3 25 const ( 26 UEFI BootMode = "UEFI" 27 UEFISecureBoot BootMode = "UEFISecureBoot" 28 Legacy BootMode = "legacy" 29 ) 30 31 const ( 32 masterRole string = "master" 33 workerRole string = "worker" 34 ) 35 36 // Host stores all the configuration data for a baremetal host. 37 type Host struct { 38 Name string `json:"name,omitempty" validate:"required,uniqueField"` 39 BMC BMC `json:"bmc"` 40 Role string `json:"role"` 41 BootMACAddress string `json:"bootMACAddress" validate:"required,uniqueField"` 42 HardwareProfile string `json:"hardwareProfile"` 43 RootDeviceHints *RootDeviceHints `json:"rootDeviceHints,omitempty"` 44 BootMode BootMode `json:"bootMode,omitempty"` 45 NetworkConfig *apiextv1.JSON `json:"networkConfig,omitempty"` 46 } 47 48 // IsMaster checks if the current host is a master 49 func (h *Host) IsMaster() bool { 50 return h.Role == masterRole 51 } 52 53 // IsWorker checks if the current host is a worker 54 func (h *Host) IsWorker() bool { 55 return h.Role == workerRole 56 } 57 58 var sortIndex = map[string]int{masterRole: -1, workerRole: 0, "": 1} 59 60 // CompareByRole allows to compare two hosts by the Role 61 func (h *Host) CompareByRole(k *Host) bool { 62 return sortIndex[h.Role] < sortIndex[k.Role] 63 } 64 65 // ProvisioningNetwork determines how we will use the provisioning network. 66 // +kubebuilder:validation:Enum="";Managed;Unmanaged;Disabled 67 type ProvisioningNetwork string 68 69 const ( 70 // ManagedProvisioningNetwork indicates we should fully manage the provisioning network, including DHCP 71 // services required for PXE-based provisioning. 72 ManagedProvisioningNetwork ProvisioningNetwork = "Managed" 73 74 // UnmanagedProvisioningNetwork indicates responsibility for managing the provisioning network is left to the 75 // user. No DHCP server will be configured, however TFTP remains enabled if a user wants to use PXE-based provisioning. 76 // However, they will need to configure external DHCP correctly with next-server definitions set to the relevant 77 // provisioning IP's. 78 UnmanagedProvisioningNetwork ProvisioningNetwork = "Unmanaged" 79 80 // DisabledProvisioningNetwork indicates that no provisioning network will be used. Provisioning capabilities 81 // will be limited to virtual media-based deployments only, and neither DHCP nor TFTP will be operated by the 82 // cluster. 83 DisabledProvisioningNetwork ProvisioningNetwork = "Disabled" 84 ) 85 86 // Platform stores all the global configuration that all machinesets use. 87 type Platform struct { 88 // LibvirtURI is the identifier for the libvirtd connection. It must be 89 // reachable from the host where the installer is run. 90 // Default is qemu:///system 91 // 92 // +kubebuilder:default="qemu:///system" 93 // +optional 94 LibvirtURI string `json:"libvirtURI,omitempty"` 95 96 // ClusterProvisioningIP is the IP on the dedicated provisioning network 97 // where the baremetal-operator pod runs provisioning services, 98 // and an http server to cache some downloaded content e.g RHCOS/IPA images 99 // +optional 100 ClusterProvisioningIP string `json:"clusterProvisioningIP,omitempty"` 101 102 // DeprecatedProvisioningHostIP is the deprecated version of clusterProvisioningIP. When the 103 // baremetal platform was initially added to the installer, the JSON field for ClusterProvisioningIP 104 // was incorrectly set to "provisioningHostIP." This field is here to allow backwards-compatibility. 105 // +optional 106 DeprecatedProvisioningHostIP string `json:"provisioningHostIP,omitempty"` 107 108 // BootstrapProvisioningIP is the IP used on the bootstrap VM to 109 // bring up provisioning services that are used to create the 110 // control-plane machines 111 // 112 // +kubebuilder:validation:Format=ip 113 // +optional 114 BootstrapProvisioningIP string `json:"bootstrapProvisioningIP,omitempty"` 115 116 // External bridge is used for external communication. 117 // +optional 118 ExternalBridge string `json:"externalBridge,omitempty"` 119 120 // ExternalMACAddress is used to allow setting a static unicast MAC 121 // address for the bootstrap host on the external network. Consider 122 // using the QEMU vendor prefix `52:54:00`. If left blank, libvirt will 123 // generate one for you. 124 // +optional 125 ExternalMACAddress string `json:"externalMACAddress,omitempty"` 126 127 // ProvisioningNetwork is used to indicate if we will have a provisioning network, and how it will be managed. 128 // +kubebuilder:default=Managed 129 // +optional 130 ProvisioningNetwork ProvisioningNetwork `json:"provisioningNetwork,omitempty"` 131 132 // Provisioning bridge is used for provisioning nodes, on the host that 133 // will run the bootstrap VM. 134 // +optional 135 ProvisioningBridge string `json:"provisioningBridge,omitempty"` 136 137 // ProvisioningMACAddress is used to allow setting a static unicast MAC 138 // address for the bootstrap host on the provisioning network. Consider 139 // using the QEMU vendor prefix `52:54:00`. If left blank, libvirt will 140 // generate one for you. 141 // +optional 142 ProvisioningMACAddress string `json:"provisioningMACAddress,omitempty"` 143 144 // ProvisioningNetworkInterface is the name of the network interface on a control plane 145 // baremetal host that is connected to the provisioning network. 146 // +optional 147 ProvisioningNetworkInterface string `json:"provisioningNetworkInterface"` 148 149 // ProvisioningNetworkCIDR defines the network to use for provisioning. 150 // +optional 151 ProvisioningNetworkCIDR *ipnet.IPNet `json:"provisioningNetworkCIDR,omitempty"` 152 153 // DeprecatedProvisioningDHCPExternal indicates that DHCP is provided by an external service. This parameter is 154 // replaced by ProvisioningNetwork being set to "Unmanaged". 155 // +optional 156 DeprecatedProvisioningDHCPExternal bool `json:"provisioningDHCPExternal,omitempty"` 157 158 // ProvisioningDHCPRange is used to provide DHCP services to hosts 159 // for provisioning. 160 // +optional 161 ProvisioningDHCPRange string `json:"provisioningDHCPRange,omitempty"` 162 163 // Hosts is the information needed to create the objects in Ironic. 164 Hosts []*Host `json:"hosts"` 165 166 // DefaultMachinePlatform is the default configuration used when 167 // installing on bare metal for machine pools which do not define their own 168 // platform configuration. 169 // +optional 170 DefaultMachinePlatform *MachinePool `json:"defaultMachinePlatform,omitempty"` 171 172 // DeprecatedAPIVIP is the VIP to use for internal API communication 173 // Deprecated: Use APIVIPs 174 // 175 // +kubebuilder:validation:Format=ip 176 // +optional 177 DeprecatedAPIVIP string `json:"apiVIP,omitempty"` 178 179 // APIVIPs contains the VIP(s) to use for internal API communication. In 180 // dual stack clusters it contains an IPv4 and IPv6 address, otherwise only 181 // one VIP 182 // 183 // +kubebuilder:validation:MaxItems=2 184 // +kubebuilder:validation:UniqueItems=true 185 // +kubebuilder:validation:Format=ip 186 // +optional 187 APIVIPs []string `json:"apiVIPs,omitempty"` 188 189 // DeprecatedIngressVIP is the VIP to use for ingress traffic 190 // Deprecated: Use IngressVIPs 191 // 192 // +kubebuilder:validation:Format=ip 193 // +optional 194 DeprecatedIngressVIP string `json:"ingressVIP,omitempty"` 195 196 // IngressVIPs contains the VIP(s) to use for ingress traffic. In dual stack 197 // clusters it contains an IPv4 and IPv6 address, otherwise only one VIP 198 // 199 // +kubebuilder:validation:MaxItems=2 200 // +kubebuilder:validation:UniqueItems=true 201 // +kubebuilder:validation:Format=ip 202 // +optional 203 IngressVIPs []string `json:"ingressVIPs,omitempty"` 204 205 // BootstrapOSImage is a URL to override the default OS image 206 // for the bootstrap node. The URL must contain a sha256 hash of the image 207 // e.g https://mirror.example.com/images/qemu.qcow2.gz?sha256=a07bd... 208 // 209 // +optional 210 BootstrapOSImage string `json:"bootstrapOSImage,omitempty" validate:"omitempty,osimageuri,urlexist"` 211 212 // ClusterOSImage is a URL to override the default OS image 213 // for cluster nodes. The URL must contain a sha256 hash of the image 214 // e.g https://mirror.example.com/images/metal.qcow2.gz?sha256=3b5a8... 215 // 216 // +optional 217 ClusterOSImage string `json:"clusterOSImage,omitempty" validate:"omitempty,osimageuri,urlexist"` 218 219 // BootstrapExternalStaticIP is the static IP address of the bootstrap node. 220 // This can be useful in environments without a DHCP server. 221 // +kubebuilder:validation:Format=ip 222 // +optional 223 BootstrapExternalStaticIP string `json:"bootstrapExternalStaticIP,omitempty"` 224 225 // BootstrapExternalStaticGateway is the static network gateway of the bootstrap node. 226 // This can be useful in environments without a DHCP server. 227 // +kubebuilder:validation:Format=ip 228 // +optional 229 BootstrapExternalStaticGateway string `json:"bootstrapExternalStaticGateway,omitempty"` 230 231 // LoadBalancer defines how the load balancer used by the cluster is configured. 232 // LoadBalancer is available in TechPreview. 233 // +optional 234 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"` 241 }