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

     1  package ibmcloud
     2  
     3  // MachinePool stores the configuration for a machine pool installed on IBM Cloud.
     4  type MachinePool struct {
     5  	// InstanceType is the VSI machine profile.
     6  	InstanceType string `json:"type,omitempty"`
     7  
     8  	// Zones is the list of availability zones used for machines in the pool.
     9  	// +optional
    10  	Zones []string `json:"zones,omitempty"`
    11  
    12  	// BootVolume is the configuration for the machine's boot volume.
    13  	// +optional
    14  	BootVolume *BootVolume `json:"bootVolume,omitempty"`
    15  
    16  	// DedicatedHosts is the configuration for the machine's dedicated host and profile.
    17  	// +optional
    18  	DedicatedHosts []DedicatedHost `json:"dedicatedHosts,omitempty"`
    19  }
    20  
    21  // BootVolume stores the configuration for an individual machine's boot volume.
    22  type BootVolume struct {
    23  	// EncryptionKey is the CRN referencing a Key Protect or Hyper Protect
    24  	// Crypto Services key to use for volume encryption. If not specified, a
    25  	// provider managed encryption key will be used.
    26  	// +optional
    27  	EncryptionKey string `json:"encryptionKey,omitempty"`
    28  }
    29  
    30  // DedicatedHost stores the configuration for the machine's dedicated host platform.
    31  type DedicatedHost struct {
    32  	// Name is the name of the dedicated host to provision the machine on. If
    33  	// specified, machines will be created on pre-existing dedicated host.
    34  	// +optional
    35  	Name string `json:"name,omitempty"`
    36  
    37  	// Profile is the profile ID for the dedicated host. If specified, new
    38  	// dedicated host will be created for machines.
    39  	// +optional
    40  	Profile string `json:"profile,omitempty"`
    41  }
    42  
    43  // Set sets the values from `required` to `a`.
    44  func (a *MachinePool) Set(required *MachinePool) {
    45  	if required == nil || a == nil {
    46  		return
    47  	}
    48  
    49  	if required.InstanceType != "" {
    50  		a.InstanceType = required.InstanceType
    51  	}
    52  
    53  	if len(required.Zones) > 0 {
    54  		a.Zones = required.Zones
    55  	}
    56  
    57  	if required.BootVolume != nil {
    58  		if a.BootVolume == nil {
    59  			a.BootVolume = &BootVolume{}
    60  		}
    61  		if required.BootVolume.EncryptionKey != "" {
    62  			a.BootVolume.EncryptionKey = required.BootVolume.EncryptionKey
    63  		}
    64  	}
    65  
    66  	if len(required.DedicatedHosts) > 0 {
    67  		a.DedicatedHosts = required.DedicatedHosts
    68  	}
    69  }