github.com/openshift/installer@v1.4.17/pkg/types/machinepools.go (about)

     1  package types
     2  
     3  import (
     4  	"github.com/openshift/installer/pkg/types/aws"
     5  	"github.com/openshift/installer/pkg/types/azure"
     6  	"github.com/openshift/installer/pkg/types/baremetal"
     7  	"github.com/openshift/installer/pkg/types/gcp"
     8  	"github.com/openshift/installer/pkg/types/ibmcloud"
     9  	"github.com/openshift/installer/pkg/types/nutanix"
    10  	"github.com/openshift/installer/pkg/types/openstack"
    11  	"github.com/openshift/installer/pkg/types/ovirt"
    12  	"github.com/openshift/installer/pkg/types/powervs"
    13  	"github.com/openshift/installer/pkg/types/vsphere"
    14  )
    15  
    16  const (
    17  	// MachinePoolComputeRoleName name associated with the compute machinepool.
    18  	MachinePoolComputeRoleName = "worker"
    19  	// MachinePoolEdgeRoleName name associated with the compute edge machinepool.
    20  	MachinePoolEdgeRoleName = "edge"
    21  	// MachinePoolControlPlaneRoleName name associated with the control plane machinepool.
    22  	MachinePoolControlPlaneRoleName = "master"
    23  )
    24  
    25  // HyperthreadingMode is the mode of hyperthreading for a machine.
    26  // +kubebuilder:validation:Enum="";Enabled;Disabled
    27  type HyperthreadingMode string
    28  
    29  const (
    30  	// HyperthreadingEnabled indicates that hyperthreading is enabled.
    31  	HyperthreadingEnabled HyperthreadingMode = "Enabled"
    32  	// HyperthreadingDisabled indicates that hyperthreading is disabled.
    33  	HyperthreadingDisabled HyperthreadingMode = "Disabled"
    34  )
    35  
    36  // Architecture is the instruction set architecture for the machines in a pool.
    37  // +kubebuilder:validation:Enum="";amd64
    38  type Architecture string
    39  
    40  const (
    41  	// ArchitectureAMD64 indicates AMD64 (x86_64).
    42  	ArchitectureAMD64 = "amd64"
    43  	// ArchitectureS390X indicates s390x (IBM System Z).
    44  	ArchitectureS390X = "s390x"
    45  	// ArchitecturePPC64LE indicates ppc64 little endian (Power PC)
    46  	ArchitecturePPC64LE = "ppc64le"
    47  	// ArchitectureARM64 indicates arm (aarch64) systems
    48  	ArchitectureARM64 = "arm64"
    49  )
    50  
    51  // MachinePool is a pool of machines to be installed.
    52  type MachinePool struct {
    53  	// Name is the name of the machine pool.
    54  	// For the control plane machine pool, the name will always be "master".
    55  	// For the compute machine pools, the only valid name is "worker".
    56  	Name string `json:"name"`
    57  
    58  	// Replicas is the machine count for the machine pool.
    59  	Replicas *int64 `json:"replicas,omitempty"`
    60  
    61  	// Platform is configuration for machine pool specific to the platform.
    62  	Platform MachinePoolPlatform `json:"platform"`
    63  
    64  	// Hyperthreading determines the mode of hyperthreading that machines in the
    65  	// pool will utilize.
    66  	// Default is for hyperthreading to be enabled.
    67  	//
    68  	// +kubebuilder:default=Enabled
    69  	// +optional
    70  	Hyperthreading HyperthreadingMode `json:"hyperthreading,omitempty"`
    71  
    72  	// Architecture is the instruction set architecture of the machine pool.
    73  	// Defaults to amd64.
    74  	//
    75  	// +kubebuilder:default=amd64
    76  	// +optional
    77  	Architecture Architecture `json:"architecture,omitempty"`
    78  }
    79  
    80  // MachinePoolPlatform is the platform-specific configuration for a machine
    81  // pool. Only one of the platforms should be set.
    82  type MachinePoolPlatform struct {
    83  	// AWS is the configuration used when installing on AWS.
    84  	AWS *aws.MachinePool `json:"aws,omitempty"`
    85  
    86  	// Azure is the configuration used when installing on Azure.
    87  	Azure *azure.MachinePool `json:"azure,omitempty"`
    88  
    89  	// BareMetal is the configuration used when installing on bare metal.
    90  	BareMetal *baremetal.MachinePool `json:"baremetal,omitempty"`
    91  
    92  	// GCP is the configuration used when installing on GCP
    93  	GCP *gcp.MachinePool `json:"gcp,omitempty"`
    94  
    95  	// IBMCloud is the configuration used when installing on IBM Cloud.
    96  	IBMCloud *ibmcloud.MachinePool `json:"ibmcloud,omitempty"`
    97  
    98  	// OpenStack is the configuration used when installing on OpenStack.
    99  	OpenStack *openstack.MachinePool `json:"openstack,omitempty"`
   100  
   101  	// VSphere is the configuration used when installing on vSphere.
   102  	VSphere *vsphere.MachinePool `json:"vsphere,omitempty"`
   103  
   104  	// Ovirt is the configuration used when installing on oVirt.
   105  	Ovirt *ovirt.MachinePool `json:"ovirt,omitempty"`
   106  
   107  	// PowerVS is the configuration used when installing on IBM Power VS.
   108  	PowerVS *powervs.MachinePool `json:"powervs,omitempty"`
   109  
   110  	// Nutanix is the configuration used when installing on Nutanix.
   111  	Nutanix *nutanix.MachinePool `json:"nutanix,omitempty"`
   112  }
   113  
   114  // Name returns a string representation of the platform (e.g. "aws" if
   115  // AWS is non-nil).  It returns an empty string if no platform is
   116  // configured.
   117  func (p *MachinePoolPlatform) Name() string {
   118  	switch {
   119  	case p == nil:
   120  		return ""
   121  	case p.AWS != nil:
   122  		return aws.Name
   123  	case p.Azure != nil:
   124  		return azure.Name
   125  	case p.BareMetal != nil:
   126  		return baremetal.Name
   127  	case p.GCP != nil:
   128  		return gcp.Name
   129  	case p.IBMCloud != nil:
   130  		return ibmcloud.Name
   131  	case p.OpenStack != nil:
   132  		return openstack.Name
   133  	case p.VSphere != nil:
   134  		return vsphere.Name
   135  	case p.Ovirt != nil:
   136  		return ovirt.Name
   137  	case p.PowerVS != nil:
   138  		return powervs.Name
   139  	case p.Nutanix != nil:
   140  		return nutanix.Name
   141  	default:
   142  		return ""
   143  	}
   144  }