1 package v1 2 3 import ( 4 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 5 "k8s.io/apimachinery/pkg/util/intstr" 6 ) 7 8 // PowerVSResourceType enum attribute to identify the type of resource reference 9 type PowerVSResourceType string 10 11 // PowerVSProcessorType enum attribute to identify the PowerVS instance processor type 12 type PowerVSProcessorType string 13 14 // IBMVPCLoadBalancerType is the type of LoadBalancer to use when registering 15 // an instance with load balancers specified in LoadBalancerNames 16 type IBMVPCLoadBalancerType string 17 18 // ApplicationLoadBalancerType is possible values for IBMVPCLoadBalancerType. 19 const ( 20 ApplicationLoadBalancerType IBMVPCLoadBalancerType = "Application" // Application Load Balancer for VPC (ALB) 21 ) 22 23 const ( 24 // PowerVSResourceTypeID enum property to identify an ID type resource reference 25 PowerVSResourceTypeID PowerVSResourceType = "ID" 26 // PowerVSResourceTypeName enum property to identify a Name type resource reference 27 PowerVSResourceTypeName PowerVSResourceType = "Name" 28 // PowerVSResourceTypeRegEx enum property to identify a tags type resource reference 29 PowerVSResourceTypeRegEx PowerVSResourceType = "RegEx" 30 // PowerVSProcessorTypeDedicated enum property to identify a Dedicated Power VS processor type 31 PowerVSProcessorTypeDedicated PowerVSProcessorType = "Dedicated" 32 // PowerVSProcessorTypeShared enum property to identify a Shared Power VS processor type 33 PowerVSProcessorTypeShared PowerVSProcessorType = "Shared" 34 // PowerVSProcessorTypeCapped enum property to identify a Capped Power VS processor type 35 PowerVSProcessorTypeCapped PowerVSProcessorType = "Capped" 36 ) 37 38 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 39 40 // PowerVSMachineProviderConfig is the type that will be embedded in a Machine.Spec.ProviderSpec field 41 // for a PowerVS virtual machine. It is used by the PowerVS machine actuator to create a single Machine. 42 // 43 // Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer). 44 // +openshift:compatibility-gen:level=1 45 // +k8s:openapi-gen=true 46 type PowerVSMachineProviderConfig struct { 47 metav1.TypeMeta `json:",inline"` 48 // +optional 49 metav1.ObjectMeta `json:"metadata,omitempty"` 50 51 // userDataSecret contains a local reference to a secret that contains the 52 // UserData to apply to the instance. 53 // +optional 54 UserDataSecret *PowerVSSecretReference `json:"userDataSecret,omitempty"` 55 56 // credentialsSecret is a reference to the secret with IBM Cloud credentials. 57 // +optional 58 CredentialsSecret *PowerVSSecretReference `json:"credentialsSecret,omitempty"` 59 60 // serviceInstance is the reference to the Power VS service on which the server instance(VM) will be created. 61 // Power VS service is a container for all Power VS instances at a specific geographic region. 62 // serviceInstance can be created via IBM Cloud catalog or CLI. 63 // supported serviceInstance identifier in PowerVSResource are Name and ID and that can be obtained from IBM Cloud UI or IBM Cloud cli. 64 // More detail about Power VS service instance. 65 // https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-creating-power-virtual-server 66 // +kubebuilder:validation:=Required 67 ServiceInstance PowerVSResource `json:"serviceInstance"` 68 69 // image is to identify the rhcos image uploaded to IBM COS bucket which is used to create the instance. 70 // supported image identifier in PowerVSResource are Name and ID and that can be obtained from IBM Cloud UI or IBM Cloud cli. 71 // +kubebuilder:validation:=Required 72 Image PowerVSResource `json:"image"` 73 74 // network is the reference to the Network to use for this instance. 75 // supported network identifier in PowerVSResource are Name, ID and RegEx and that can be obtained from IBM Cloud UI or IBM Cloud cli. 76 // +kubebuilder:validation:=Required 77 Network PowerVSResource `json:"network"` 78 79 // keyPairName is the name of the KeyPair to use for SSH. 80 // The key pair will be exposed to the instance via the instance metadata service. 81 // On boot, the OS will copy the public keypair into the authorized keys for the core user. 82 // +kubebuilder:validation:=Required 83 KeyPairName string `json:"keyPairName"` 84 85 // systemType is the System type used to host the instance. 86 // systemType determines the number of cores and memory that is available. 87 // Few of the supported SystemTypes are s922,e880,e980. 88 // e880 systemType available only in Dallas Datacenters. 89 // e980 systemType available in Datacenters except Dallas and Washington. 90 // When omitted, this means that the user has no opinion and the platform is left to choose a 91 // reasonable default, which is subject to change over time. The current default is s922 which is generally available. 92 // + This is not an enum because we expect other values to be added later which should be supported implicitly. 93 // +optional 94 SystemType string `json:"systemType,omitempty"` 95 96 // processorType is the VM instance processor type. 97 // It must be set to one of the following values: Dedicated, Capped or Shared. 98 // Dedicated: resources are allocated for a specific client, The hypervisor makes a 1:1 binding of a partition’s processor to a physical processor core. 99 // Shared: Shared among other clients. 100 // Capped: Shared, but resources do not expand beyond those that are requested, the amount of CPU time is Capped to the value specified for the entitlement. 101 // if the processorType is selected as Dedicated, then processors value cannot be fractional. 102 // When omitted, this means that the user has no opinion and the platform is left to choose a 103 // reasonable default, which is subject to change over time. The current default is Shared. 104 // +kubebuilder:validation:Enum:="Dedicated";"Shared";"Capped";"" 105 // +optional 106 ProcessorType PowerVSProcessorType `json:"processorType,omitempty"` 107 108 // processors is the number of virtual processors in a virtual machine. 109 // when the processorType is selected as Dedicated the processors value cannot be fractional. 110 // maximum value for the Processors depends on the selected SystemType. 111 // when SystemType is set to e880 or e980 maximum Processors value is 143. 112 // when SystemType is set to s922 maximum Processors value is 15. 113 // minimum value for Processors depends on the selected ProcessorType. 114 // when ProcessorType is set as Shared or Capped, The minimum processors is 0.5. 115 // when ProcessorType is set as Dedicated, The minimum processors is 1. 116 // When omitted, this means that the user has no opinion and the platform is left to choose a 117 // reasonable default, which is subject to change over time. The default is set based on the selected ProcessorType. 118 // when ProcessorType selected as Dedicated, the default is set to 1. 119 // when ProcessorType selected as Shared or Capped, the default is set to 0.5. 120 // +optional 121 Processors intstr.IntOrString `json:"processors,omitempty"` 122 123 // memoryGiB is the size of a virtual machine's memory, in GiB. 124 // maximum value for the MemoryGiB depends on the selected SystemType. 125 // when SystemType is set to e880 maximum MemoryGiB value is 7463 GiB. 126 // when SystemType is set to e980 maximum MemoryGiB value is 15307 GiB. 127 // when SystemType is set to s922 maximum MemoryGiB value is 942 GiB. 128 // The minimum memory is 32 GiB. 129 // When omitted, this means the user has no opinion and the platform is left to choose a reasonable 130 // default, which is subject to change over time. The current default is 32. 131 // +optional 132 MemoryGiB int32 `json:"memoryGiB,omitempty"` 133 134 // loadBalancers is the set of load balancers to which the new control plane instance 135 // should be added once it is created. 136 // +optional 137 LoadBalancers []LoadBalancerReference `json:"loadBalancers,omitempty"` 138 } 139 140 // PowerVSResource is a reference to a specific PowerVS resource by ID, Name or RegEx 141 // Only one of ID, Name or RegEx may be specified. Specifying more than one will result in 142 // a validation error. 143 // +union 144 type PowerVSResource struct { 145 // Type identifies the resource type for this entry. 146 // Valid values are ID, Name and RegEx 147 // +kubebuilder:validation:Enum:=ID;Name;RegEx 148 // +optional 149 Type PowerVSResourceType `json:"type,omitempty"` 150 // ID of resource 151 // +optional 152 ID *string `json:"id,omitempty"` 153 // Name of resource 154 // +optional 155 Name *string `json:"name,omitempty"` 156 // Regex to find resource 157 // Regex contains the pattern to match to find a resource 158 // +optional 159 RegEx *string `json:"regex,omitempty"` 160 } 161 162 // PowerVSMachineProviderStatus is the type that will be embedded in a Machine.Status.ProviderStatus field. 163 // It contains PowerVS-specific status information. 164 // 165 // Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer). 166 // +openshift:compatibility-gen:level=1 167 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 168 type PowerVSMachineProviderStatus struct { 169 metav1.TypeMeta `json:",inline"` 170 171 // conditions is a set of conditions associated with the Machine to indicate 172 // errors or other status 173 // +patchMergeKey=type 174 // +patchStrategy=merge 175 // +listType=map 176 // +listMapKey=type 177 // +optional 178 Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"` 179 180 // instanceId is the instance ID of the machine created in PowerVS 181 // instanceId uniquely identifies a Power VS server instance(VM) under a Power VS service. 182 // This will help in updating or deleting a VM in Power VS Cloud 183 // +optional 184 InstanceID *string `json:"instanceId,omitempty"` 185 186 // serviceInstanceID is the reference to the Power VS ServiceInstance on which the machine instance will be created. 187 // serviceInstanceID uniquely identifies the Power VS service 188 // By setting serviceInstanceID it will become easy and efficient to fetch a server instance(VM) within Power VS Cloud. 189 // +optional 190 ServiceInstanceID *string `json:"serviceInstanceID,omitempty"` 191 192 // instanceState is the state of the PowerVS instance for this machine 193 // Possible instance states are Active, Build, ShutOff, Reboot 194 // This is used to display additional information to user regarding instance current state 195 // +optional 196 InstanceState *string `json:"instanceState,omitempty"` 197 } 198 199 // PowerVSSecretReference contains enough information to locate the 200 // referenced secret inside the same namespace. 201 // +structType=atomic 202 type PowerVSSecretReference struct { 203 // Name of the secret. 204 // +optional 205 Name string `json:"name,omitempty"` 206 } 207 208 // LoadBalancerReference is a reference to a load balancer on IBM Cloud virtual private cloud(VPC). 209 type LoadBalancerReference struct { 210 // name of the LoadBalancer in IBM Cloud VPC. 211 // The name should be between 1 and 63 characters long and may consist of lowercase alphanumeric characters and hyphens only. 212 // The value must not end with a hyphen. 213 // It is a reference to existing LoadBalancer created by openshift installer component. 214 // +kubebuilder:validation:Required 215 // +kubebuilder:validation:Pattern=`^([a-z]|[a-z][-a-z0-9]*[a-z0-9]|[0-9][-a-z0-9]*([a-z]|[-a-z][-a-z0-9]*[a-z0-9]))$` 216 // +kubebuilder:validation:MinLength=1 217 // +kubebuilder:validation:MaxLength=63 218 Name string `json:"name"` 219 // type of the LoadBalancer service supported by IBM Cloud VPC. 220 // Currently, only Application LoadBalancer is supported. 221 // More details about Application LoadBalancer 222 // https://cloud.ibm.com/docs/vpc?topic=vpc-load-balancers-about&interface=ui 223 // Supported values are Application. 224 // +kubebuilder:validation:Required 225 // +kubebuilder:validation:Enum:="Application" 226 Type IBMVPCLoadBalancerType `json:"type"` 227 } 228