...

Source file src/github.com/openshift/api/machine/v1beta1/types_awsprovider.go

Documentation: github.com/openshift/api/machine/v1beta1

     1  package v1beta1
     2  
     3  import (
     4  	corev1 "k8s.io/api/core/v1"
     5  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
     6  )
     7  
     8  // AWSMachineProviderConfig is the Schema for the awsmachineproviderconfigs API
     9  // Compatibility level 2: Stable within a major release for a minimum of 9 months or 3 minor releases (whichever is longer).
    10  // +openshift:compatibility-gen:level=2
    11  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
    12  type AWSMachineProviderConfig struct {
    13  	metav1.TypeMeta `json:",inline"`
    14  	// +optional
    15  	metav1.ObjectMeta `json:"metadata,omitempty"`
    16  	// AMI is the reference to the AMI from which to create the machine instance.
    17  	AMI AWSResourceReference `json:"ami"`
    18  	// InstanceType is the type of instance to create. Example: m4.xlarge
    19  	InstanceType string `json:"instanceType"`
    20  	// Tags is the set of tags to add to apply to an instance, in addition to the ones
    21  	// added by default by the actuator. These tags are additive. The actuator will ensure
    22  	// these tags are present, but will not remove any other tags that may exist on the
    23  	// instance.
    24  	// +optional
    25  	Tags []TagSpecification `json:"tags,omitempty"`
    26  	// IAMInstanceProfile is a reference to an IAM role to assign to the instance
    27  	// +optional
    28  	IAMInstanceProfile *AWSResourceReference `json:"iamInstanceProfile,omitempty"`
    29  	// UserDataSecret contains a local reference to a secret that contains the
    30  	// UserData to apply to the instance
    31  	// +optional
    32  	UserDataSecret *corev1.LocalObjectReference `json:"userDataSecret,omitempty"`
    33  	// CredentialsSecret is a reference to the secret with AWS credentials. Otherwise, defaults to permissions
    34  	// provided by attached IAM role where the actuator is running.
    35  	// +optional
    36  	CredentialsSecret *corev1.LocalObjectReference `json:"credentialsSecret,omitempty"`
    37  	// KeyName is the name of the KeyPair to use for SSH
    38  	// +optional
    39  	KeyName *string `json:"keyName,omitempty"`
    40  	// DeviceIndex is the index of the device on the instance for the network interface attachment.
    41  	// Defaults to 0.
    42  	DeviceIndex int64 `json:"deviceIndex"`
    43  	// PublicIP specifies whether the instance should get a public IP. If not present,
    44  	// it should use the default of its subnet.
    45  	// +optional
    46  	PublicIP *bool `json:"publicIp,omitempty"`
    47  	// NetworkInterfaceType specifies the type of network interface to be used for the primary
    48  	// network interface.
    49  	// Valid values are "ENA", "EFA", and omitted, which means no opinion and the platform
    50  	// chooses a good default which may change over time.
    51  	// The current default value is "ENA".
    52  	// Please visit https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/efa.html to learn more
    53  	// about the AWS Elastic Fabric Adapter interface option.
    54  	// +kubebuilder:validation:Enum:="ENA";"EFA"
    55  	// +optional
    56  	NetworkInterfaceType AWSNetworkInterfaceType `json:"networkInterfaceType,omitempty"`
    57  	// SecurityGroups is an array of references to security groups that should be applied to the
    58  	// instance.
    59  	// +optional
    60  	SecurityGroups []AWSResourceReference `json:"securityGroups,omitempty"`
    61  	// Subnet is a reference to the subnet to use for this instance
    62  	Subnet AWSResourceReference `json:"subnet"`
    63  	// Placement specifies where to create the instance in AWS
    64  	Placement Placement `json:"placement"`
    65  	// LoadBalancers is the set of load balancers to which the new instance
    66  	// should be added once it is created.
    67  	// +optional
    68  	LoadBalancers []LoadBalancerReference `json:"loadBalancers,omitempty"`
    69  	// BlockDevices is the set of block device mapping associated to this instance,
    70  	// block device without a name will be used as a root device and only one device without a name is allowed
    71  	// https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html
    72  	// +optional
    73  	BlockDevices []BlockDeviceMappingSpec `json:"blockDevices,omitempty"`
    74  	// SpotMarketOptions allows users to configure instances to be run using AWS Spot instances.
    75  	// +optional
    76  	SpotMarketOptions *SpotMarketOptions `json:"spotMarketOptions,omitempty"`
    77  	// MetadataServiceOptions allows users to configure instance metadata service interaction options.
    78  	// If nothing specified, default AWS IMDS settings will be applied.
    79  	// https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_InstanceMetadataOptionsRequest.html
    80  	// +optional
    81  	MetadataServiceOptions MetadataServiceOptions `json:"metadataServiceOptions,omitempty"`
    82  }
    83  
    84  // BlockDeviceMappingSpec describes a block device mapping
    85  type BlockDeviceMappingSpec struct {
    86  	// The device name exposed to the machine (for example, /dev/sdh or xvdh).
    87  	// +optional
    88  	DeviceName *string `json:"deviceName,omitempty"`
    89  	// Parameters used to automatically set up EBS volumes when the machine is
    90  	// launched.
    91  	// +optional
    92  	EBS *EBSBlockDeviceSpec `json:"ebs,omitempty"`
    93  	// Suppresses the specified device included in the block device mapping of the
    94  	// AMI.
    95  	// +optional
    96  	NoDevice *string `json:"noDevice,omitempty"`
    97  	// The virtual device name (ephemeralN). Machine store volumes are numbered
    98  	// starting from 0. An machine type with 2 available machine store volumes
    99  	// can specify mappings for ephemeral0 and ephemeral1.The number of available
   100  	// machine store volumes depends on the machine type. After you connect to
   101  	// the machine, you must mount the volume.
   102  	//
   103  	// Constraints: For M3 machines, you must specify machine store volumes in
   104  	// the block device mapping for the machine. When you launch an M3 machine,
   105  	// we ignore any machine store volumes specified in the block device mapping
   106  	// for the AMI.
   107  	// +optional
   108  	VirtualName *string `json:"virtualName,omitempty"`
   109  }
   110  
   111  // EBSBlockDeviceSpec describes a block device for an EBS volume.
   112  // https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/EbsBlockDevice
   113  type EBSBlockDeviceSpec struct {
   114  	// Indicates whether the EBS volume is deleted on machine termination.
   115  	// +optional
   116  	DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"`
   117  	// Indicates whether the EBS volume is encrypted. Encrypted Amazon EBS volumes
   118  	// may only be attached to machines that support Amazon EBS encryption.
   119  	// +optional
   120  	Encrypted *bool `json:"encrypted,omitempty"`
   121  	// Indicates the KMS key that should be used to encrypt the Amazon EBS volume.
   122  	// +optional
   123  	KMSKey AWSResourceReference `json:"kmsKey,omitempty"`
   124  	// The number of I/O operations per second (IOPS) that the volume supports.
   125  	// For io1, this represents the number of IOPS that are provisioned for the
   126  	// volume. For gp2, this represents the baseline performance of the volume and
   127  	// the rate at which the volume accumulates I/O credits for bursting. For more
   128  	// information about General Purpose SSD baseline performance, I/O credits,
   129  	// and bursting, see Amazon EBS Volume Types (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html)
   130  	// in the Amazon Elastic Compute Cloud User Guide.
   131  	//
   132  	// Minimal and maximal IOPS for io1 and gp2 are constrained. Please, check
   133  	// https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html
   134  	// for precise boundaries for individual volumes.
   135  	//
   136  	// Condition: This parameter is required for requests to create io1 volumes;
   137  	// it is not used in requests to create gp2, st1, sc1, or standard volumes.
   138  	// +optional
   139  	Iops *int64 `json:"iops,omitempty"`
   140  	// The size of the volume, in GiB.
   141  	//
   142  	// Constraints: 1-16384 for General Purpose SSD (gp2), 4-16384 for Provisioned
   143  	// IOPS SSD (io1), 500-16384 for Throughput Optimized HDD (st1), 500-16384 for
   144  	// Cold HDD (sc1), and 1-1024 for Magnetic (standard) volumes. If you specify
   145  	// a snapshot, the volume size must be equal to or larger than the snapshot
   146  	// size.
   147  	//
   148  	// Default: If you're creating the volume from a snapshot and don't specify
   149  	// a volume size, the default is the snapshot size.
   150  	// +optional
   151  	VolumeSize *int64 `json:"volumeSize,omitempty"`
   152  	// The volume type: gp2, io1, st1, sc1, or standard.
   153  	// Default: standard
   154  	// +optional
   155  	VolumeType *string `json:"volumeType,omitempty"`
   156  }
   157  
   158  // SpotMarketOptions defines the options available to a user when configuring
   159  // Machines to run on Spot instances.
   160  // Most users should provide an empty struct.
   161  type SpotMarketOptions struct {
   162  	// The maximum price the user is willing to pay for their instances
   163  	// Default: On-Demand price
   164  	// +optional
   165  	MaxPrice *string `json:"maxPrice,omitempty"`
   166  }
   167  
   168  type MetadataServiceAuthentication string
   169  
   170  const (
   171  	// MetadataServiceAuthenticationRequired enforces sending of a signed token header with any instance metadata retrieval (GET) requests.
   172  	// Enforces IMDSv2 usage.
   173  	MetadataServiceAuthenticationRequired = "Required"
   174  	// MetadataServiceAuthenticationOptional allows IMDSv1 usage along with IMDSv2
   175  	MetadataServiceAuthenticationOptional = "Optional"
   176  )
   177  
   178  // MetadataServiceOptions defines the options available to a user when configuring
   179  // Instance Metadata Service (IMDS) Options.
   180  type MetadataServiceOptions struct {
   181  	// Authentication determines whether or not the host requires the use of authentication when interacting with the metadata service.
   182  	// When using authentication, this enforces v2 interaction method (IMDSv2) with the metadata service.
   183  	// When omitted, this means the user has no opinion and the value is left to the platform to choose a good
   184  	// default, which is subject to change over time. The current default is optional.
   185  	// At this point this field represents `HttpTokens` parameter from `InstanceMetadataOptionsRequest` structure in AWS EC2 API
   186  	// https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_InstanceMetadataOptionsRequest.html
   187  	// +kubebuilder:validation:Enum=Required;Optional
   188  	// +optional
   189  	Authentication MetadataServiceAuthentication `json:"authentication,omitempty"`
   190  }
   191  
   192  // AWSResourceReference is a reference to a specific AWS resource by ID, ARN, or filters.
   193  // Only one of ID, ARN or Filters may be specified. Specifying more than one will result in
   194  // a validation error.
   195  type AWSResourceReference struct {
   196  	// ID of resource
   197  	// +optional
   198  	ID *string `json:"id,omitempty"`
   199  	// ARN of resource
   200  	// +optional
   201  	ARN *string `json:"arn,omitempty"`
   202  	// Filters is a set of filters used to identify a resource
   203  	// +optional
   204  	Filters []Filter `json:"filters,omitempty"`
   205  }
   206  
   207  // Placement indicates where to create the instance in AWS
   208  type Placement struct {
   209  	// Region is the region to use to create the instance
   210  	// +optional
   211  	Region string `json:"region,omitempty"`
   212  	// AvailabilityZone is the availability zone of the instance
   213  	// +optional
   214  	AvailabilityZone string `json:"availabilityZone,omitempty"`
   215  	// Tenancy indicates if instance should run on shared or single-tenant hardware. There are
   216  	// supported 3 options: default, dedicated and host.
   217  	// +optional
   218  	Tenancy InstanceTenancy `json:"tenancy,omitempty"`
   219  }
   220  
   221  // Filter is a filter used to identify an AWS resource
   222  type Filter struct {
   223  	// Name of the filter. Filter names are case-sensitive.
   224  	Name string `json:"name"`
   225  	// Values includes one or more filter values. Filter values are case-sensitive.
   226  	// +optional
   227  	Values []string `json:"values,omitempty"`
   228  }
   229  
   230  // TagSpecification is the name/value pair for a tag
   231  type TagSpecification struct {
   232  	// Name of the tag
   233  	Name string `json:"name"`
   234  	// Value of the tag
   235  	Value string `json:"value"`
   236  }
   237  
   238  // AWSMachineProviderConfigList contains a list of AWSMachineProviderConfig
   239  // Compatibility level 2: Stable within a major release for a minimum of 9 months or 3 minor releases (whichever is longer).
   240  // +openshift:compatibility-gen:level=2
   241  type AWSMachineProviderConfigList struct {
   242  	metav1.TypeMeta `json:",inline"`
   243  	// +optional
   244  	metav1.ListMeta `json:"metadata,omitempty"`
   245  	Items           []AWSMachineProviderConfig `json:"items"`
   246  }
   247  
   248  // LoadBalancerReference is a reference to a load balancer on AWS.
   249  type LoadBalancerReference struct {
   250  	Name string              `json:"name"`
   251  	Type AWSLoadBalancerType `json:"type"`
   252  }
   253  
   254  // AWSLoadBalancerType is the type of LoadBalancer to use when registering
   255  // an instance with load balancers specified in LoadBalancerNames
   256  type AWSLoadBalancerType string
   257  
   258  // InstanceTenancy indicates if instance should run on shared or single-tenant hardware.
   259  type InstanceTenancy string
   260  
   261  const (
   262  	// DefaultTenancy instance runs on shared hardware
   263  	DefaultTenancy InstanceTenancy = "default"
   264  	// DedicatedTenancy instance runs on single-tenant hardware
   265  	DedicatedTenancy InstanceTenancy = "dedicated"
   266  	// HostTenancy instance runs on a Dedicated Host, which is an isolated server with configurations that you can control.
   267  	HostTenancy InstanceTenancy = "host"
   268  )
   269  
   270  // Possible values for AWSLoadBalancerType. Add to this list as other types
   271  // of load balancer are supported by the actuator.
   272  const (
   273  	ClassicLoadBalancerType AWSLoadBalancerType = "classic" // AWS classic ELB
   274  	NetworkLoadBalancerType AWSLoadBalancerType = "network" // AWS Network Load Balancer (NLB)
   275  )
   276  
   277  // AWSNetworkInterfaceType defines the network interface type of the the
   278  // AWS EC2 network interface.
   279  type AWSNetworkInterfaceType string
   280  
   281  const (
   282  	// AWSENANetworkInterfaceType is the default network interface type,
   283  	// the EC2 Elastic Network Adapter commonly used with EC2 instances.
   284  	// This should be used for standard network operations.
   285  	AWSENANetworkInterfaceType AWSNetworkInterfaceType = "ENA"
   286  	// AWSEFANetworkInterfaceType is the Elastic Fabric Adapter network interface type.
   287  	AWSEFANetworkInterfaceType AWSNetworkInterfaceType = "EFA"
   288  )
   289  
   290  // AWSMachineProviderStatus is the type that will be embedded in a Machine.Status.ProviderStatus field.
   291  // It contains AWS-specific status information.
   292  // Compatibility level 2: Stable within a major release for a minimum of 9 months or 3 minor releases (whichever is longer).
   293  // +openshift:compatibility-gen:level=2
   294  type AWSMachineProviderStatus struct {
   295  	metav1.TypeMeta `json:",inline"`
   296  	// InstanceID is the instance ID of the machine created in AWS
   297  	// +optional
   298  	InstanceID *string `json:"instanceId,omitempty"`
   299  	// InstanceState is the state of the AWS instance for this machine
   300  	// +optional
   301  	InstanceState *string `json:"instanceState,omitempty"`
   302  	// Conditions is a set of conditions associated with the Machine to indicate
   303  	// errors or other status
   304  	// +optional
   305  	Conditions []metav1.Condition `json:"conditions,omitempty"`
   306  }
   307  

View as plain text