diff --git a/Gopkg.lock b/Gopkg.lock index a6ef12d36c8..8abb32eb9bc 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -821,11 +821,11 @@ [[projects]] branch = "master" - digest = "1:8c0b41a3bc962842dffadd9e4c2d027fbc410a814995e669c9684beaa010821a" + digest = "1:5ade82a27c5ca576a8aa699320fea3ae5a4d47c95e6a2212191ea31e4c49f27c" name = "sigs.k8s.io/cluster-api-provider-aws" packages = ["pkg/apis/awsproviderconfig/v1alpha1"] pruneopts = "NUT" - revision = "67b2fa68f05c1972b069e3bccf4c29884511bf82" + revision = "97771a0fe7762b34e80e05c7412f464dcdbbb3e7" source = "https://github.com/openshift/cluster-api-provider-aws.git" [[projects]] diff --git a/pkg/asset/machines/aws/machines.go b/pkg/asset/machines/aws/machines.go index 7e04a99e8a4..916fd59ae09 100644 --- a/pkg/asset/machines/aws/machines.go +++ b/pkg/asset/machines/aws/machines.go @@ -81,7 +81,16 @@ func provider(clusterID, clusterName string, platform *aws.Platform, mpool *aws. APIVersion: "awsproviderconfig.k8s.io/v1alpha1", Kind: "AWSMachineProviderConfig", }, - InstanceType: mpool.InstanceType, + InstanceType: mpool.InstanceType, + BlockDevices: []awsprovider.BlockDeviceMappingSpec{ + { + EBS: &awsprovider.EBSBlockDeviceSpec{ + VolumeType: pointer.StringPtr(mpool.Type), + VolumeSize: pointer.Int64Ptr(int64(mpool.Size)), + Iops: pointer.Int64Ptr(int64(mpool.IOPS)), + }, + }, + }, AMI: awsprovider.AWSResourceReference{ID: &amiID}, Tags: tags, IAMInstanceProfile: &awsprovider.AWSResourceReference{ID: pointer.StringPtr(fmt.Sprintf("%s-%s-profile", clusterName, role))}, diff --git a/pkg/asset/machines/master.go b/pkg/asset/machines/master.go index 2c782ac12a6..953d7001a99 100644 --- a/pkg/asset/machines/master.go +++ b/pkg/asset/machines/master.go @@ -68,6 +68,7 @@ func (m *Master) Generate(dependencies asset.Parents) error { case awstypes.Name: mpool := defaultAWSMachinePoolPlatform() mpool.InstanceType = "m4.xlarge" + mpool.EC2RootVolume.Size = 120 mpool.Set(ic.Platform.AWS.DefaultMachinePlatform) mpool.Set(pool.Platform.AWS) if len(mpool.Zones) == 0 { diff --git a/pkg/asset/machines/worker.go b/pkg/asset/machines/worker.go index 71bd7434d36..7b67d085989 100644 --- a/pkg/asset/machines/worker.go +++ b/pkg/asset/machines/worker.go @@ -26,7 +26,12 @@ import ( ) func defaultAWSMachinePoolPlatform() awstypes.MachinePool { - return awstypes.MachinePool{} + return awstypes.MachinePool{ + EC2RootVolume: awstypes.EC2RootVolume{ + Type: "gp2", + Size: 32, + }, + } } func defaultLibvirtMachinePoolPlatform() libvirttypes.MachinePool { diff --git a/vendor/sigs.k8s.io/cluster-api-provider-aws/pkg/apis/awsproviderconfig/v1alpha1/awsmachineproviderconfig_types.go b/vendor/sigs.k8s.io/cluster-api-provider-aws/pkg/apis/awsproviderconfig/v1alpha1/awsmachineproviderconfig_types.go index 84a01e79f97..a826bb26a44 100644 --- a/vendor/sigs.k8s.io/cluster-api-provider-aws/pkg/apis/awsproviderconfig/v1alpha1/awsmachineproviderconfig_types.go +++ b/vendor/sigs.k8s.io/cluster-api-provider-aws/pkg/apis/awsproviderconfig/v1alpha1/awsmachineproviderconfig_types.go @@ -34,20 +34,22 @@ const ( // NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. // AWSMachineProviderStatus is the type that will be embedded in a Machine.Status.ProviderStatus field. -// It containsk AWS-specific status information. +// It contains AWS-specific status information. // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object type AWSMachineProviderStatus struct { metav1.TypeMeta `json:",inline"` // InstanceID is the instance ID of the machine created in AWS - InstanceID *string `json:"instanceId"` + // +optional + InstanceID *string `json:"instanceId,omitempty"` // InstanceState is the state of the AWS instance for this machine - InstanceState *string `json:"instanceState"` + // +optional + InstanceState *string `json:"instanceState,omitempty"` // Conditions is a set of conditions associated with the Machine to indicate // errors or other status - Conditions []AWSMachineProviderCondition `json:"conditions"` + Conditions []AWSMachineProviderCondition `json:"conditions,omitempty"` } // AWSMachineProviderConditionType is a valid value for AWSMachineProviderCondition.Type @@ -68,16 +70,16 @@ type AWSMachineProviderCondition struct { Status corev1.ConditionStatus `json:"status"` // LastProbeTime is the last time we probed the condition. // +optional - LastProbeTime metav1.Time `json:"lastProbeTime"` + LastProbeTime metav1.Time `json:"lastProbeTime,omitempty"` // LastTransitionTime is the last time the condition transitioned from one status to another. // +optional - LastTransitionTime metav1.Time `json:"lastTransitionTime"` + LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` // Reason is a unique, one-word, CamelCase reason for the condition's last transition. // +optional - Reason string `json:"reason"` + Reason string `json:"reason,omitempty"` // Message is a human-readable message indicating details about last transition. // +optional - Message string `json:"message"` + Message string `json:"message,omitempty"` } // +genclient @@ -99,21 +101,21 @@ type AWSMachineProviderConfig struct { // added by default by the actuator. These tags are additive. The actuator will ensure // these tags are present, but will not remove any other tags that may exist on the // instance. - Tags []TagSpecification `json:"tags"` + Tags []TagSpecification `json:"tags,omitempty"` // IAMInstanceProfile is a reference to an IAM role to assign to the instance - IAMInstanceProfile *AWSResourceReference `json:"iamInstanceProfile"` + IAMInstanceProfile *AWSResourceReference `json:"iamInstanceProfile,omitempty"` // UserDataSecret contains a local reference to a secret that contains the // UserData to apply to the instance - UserDataSecret *corev1.LocalObjectReference `json:"userDataSecret"` + UserDataSecret *corev1.LocalObjectReference `json:"userDataSecret,omitempty"` // CredentialsSecret is a reference to the secret with AWS credentials. Otherwise, defaults to permissions // provided by attached IAM role where the actuator is running. - CredentialsSecret *corev1.LocalObjectReference `json:"credentialsSecret"` + CredentialsSecret *corev1.LocalObjectReference `json:"credentialsSecret,omitempty"` // KeyName is the name of the KeyPair to use for SSH - KeyName *string `json:"keyName"` + KeyName *string `json:"keyName,omitempty"` // DeviceIndex is the index of the device on the instance for the network interface attachment. // Defaults to 0. @@ -125,7 +127,7 @@ type AWSMachineProviderConfig struct { // SecurityGroups is an array of references to security groups that should be applied to the // instance. - SecurityGroups []AWSResourceReference `json:"securityGroups"` + SecurityGroups []AWSResourceReference `json:"securityGroups,omitempty"` // Subnet is a reference to the subnet to use for this instance Subnet AWSResourceReference `json:"subnet"` @@ -135,7 +137,81 @@ type AWSMachineProviderConfig struct { // LoadBalancers is the set of load balancers to which the new instance // should be added once it is created. - LoadBalancers []LoadBalancerReference `json:"loadBalancers"` + LoadBalancers []LoadBalancerReference `json:"loadBalancers,omitempty"` + + // BlockDevices is the set of block device mapping associated to this instance + // https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html + BlockDevices []BlockDeviceMappingSpec `json:"blockDevices,omitempty"` +} + +// BlockDeviceMappingSpec describes a block device mapping +type BlockDeviceMappingSpec struct { + + // The device name exposed to the machine (for example, /dev/sdh or xvdh). + DeviceName *string `json:"deviceName,omitempty"` + + // Parameters used to automatically set up EBS volumes when the machine is + // launched. + EBS *EBSBlockDeviceSpec `json:"ebs,omitempty"` + + // Suppresses the specified device included in the block device mapping of the + // AMI. + NoDevice *string `json:"noDevice,omitempty"` + + // The virtual device name (ephemeralN). Machine store volumes are numbered + // starting from 0. An machine type with 2 available machine store volumes + // can specify mappings for ephemeral0 and ephemeral1.The number of available + // machine store volumes depends on the machine type. After you connect to + // the machine, you must mount the volume. + // + // Constraints: For M3 machines, you must specify machine store volumes in + // the block device mapping for the machine. When you launch an M3 machine, + // we ignore any machine store volumes specified in the block device mapping + // for the AMI. + VirtualName *string `json:"virtualName,omitempty"` +} + +// EBSBlockDeviceSpec describes a block device for an EBS volume. +// https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/EbsBlockDevice +type EBSBlockDeviceSpec struct { + + // Indicates whether the EBS volume is deleted on machine termination. + DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` + + // Indicates whether the EBS volume is encrypted. Encrypted Amazon EBS volumes + // may only be attached to machines that support Amazon EBS encryption. + Encrypted *bool `json:"encrypted,omitempty"` + + // The number of I/O operations per second (IOPS) that the volume supports. + // For io1, this represents the number of IOPS that are provisioned for the + // volume. For gp2, this represents the baseline performance of the volume and + // the rate at which the volume accumulates I/O credits for bursting. For more + // information about General Purpose SSD baseline performance, I/O credits, + // and bursting, see Amazon EBS Volume Types (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html) + // in the Amazon Elastic Compute Cloud User Guide. + // + // Constraint: Range is 100-20000 IOPS for io1 volumes and 100-10000 IOPS for + // gp2 volumes. + // + // Condition: This parameter is required for requests to create io1 volumes; + // it is not used in requests to create gp2, st1, sc1, or standard volumes. + Iops *int64 `json:"iops,omitempty"` + + // The size of the volume, in GiB. + // + // Constraints: 1-16384 for General Purpose SSD (gp2), 4-16384 for Provisioned + // IOPS SSD (io1), 500-16384 for Throughput Optimized HDD (st1), 500-16384 for + // Cold HDD (sc1), and 1-1024 for Magnetic (standard) volumes. If you specify + // a snapshot, the volume size must be equal to or larger than the snapshot + // size. + // + // Default: If you're creating the volume from a snapshot and don't specify + // a volume size, the default is the snapshot size. + VolumeSize *int64 `json:"volumeSize,omitempty"` + + // The volume type: gp2, io1, st1, sc1, or standard. + // Default: standard + VolumeType *string `json:"volumeType,omitempty"` } // AWSResourceReference is a reference to a specific AWS resource by ID, ARN, or filters. @@ -143,22 +219,24 @@ type AWSMachineProviderConfig struct { // a validation error. type AWSResourceReference struct { // ID of resource - ID *string `json:"id"` + // +optional + ID *string `json:"id,omitempty"` // ARN of resource - ARN *string `json:"arn"` + // +optional + ARN *string `json:"arn,omitempty"` // Filters is a set of filters used to identify a resource - Filters []Filter `json:"filters"` + Filters []Filter `json:"filters,omitempty"` } // Placement indicates where to create the instance in AWS type Placement struct { // Region is the region to use to create the instance - Region string `json:"region"` + Region string `json:"region,omitempty"` // AvailabilityZone is the availability zone of the instance - AvailabilityZone string `json:"availabilityZone"` + AvailabilityZone string `json:"availabilityZone,omitempty"` } // Filter is a filter used to identify an AWS resource @@ -167,7 +245,7 @@ type Filter struct { Name string `json:"name"` // Values includes one or more filter values. Filter values are case-sensitive. - Values []string `json:"values"` + Values []string `json:"values,omitempty"` } // TagSpecification is the name/value pair for a tag diff --git a/vendor/sigs.k8s.io/cluster-api-provider-aws/pkg/apis/awsproviderconfig/v1alpha1/register.go b/vendor/sigs.k8s.io/cluster-api-provider-aws/pkg/apis/awsproviderconfig/v1alpha1/register.go index 7be24fcb93f..298aa7e27f8 100644 --- a/vendor/sigs.k8s.io/cluster-api-provider-aws/pkg/apis/awsproviderconfig/v1alpha1/register.go +++ b/vendor/sigs.k8s.io/cluster-api-provider-aws/pkg/apis/awsproviderconfig/v1alpha1/register.go @@ -73,8 +73,8 @@ func NewCodec() (*AWSProviderConfigCodec, error) { return &codec, nil } -// DecodeProviderConfig deserialises an object from the provider config -func (codec *AWSProviderConfigCodec) DecodeProviderConfig(providerSpec *clusterv1.ProviderSpec, out runtime.Object) error { +// DecodeProviderSpec deserialises an object from the provider config +func (codec *AWSProviderConfigCodec) DecodeProviderSpec(providerSpec *clusterv1.ProviderSpec, out runtime.Object) error { if providerSpec.Value != nil { _, _, err := codec.decoder.Decode(providerSpec.Value.Raw, nil, out) if err != nil { @@ -84,8 +84,8 @@ func (codec *AWSProviderConfigCodec) DecodeProviderConfig(providerSpec *clusterv return nil } -// EncodeProviderConfig serialises an object to the provider config -func (codec *AWSProviderConfigCodec) EncodeProviderConfig(in runtime.Object) (*clusterv1.ProviderSpec, error) { +// EncodeProviderSpec serialises an object to the provider config +func (codec *AWSProviderConfigCodec) EncodeProviderSpec(in runtime.Object) (*clusterv1.ProviderSpec, error) { var buf bytes.Buffer if err := codec.encoder.Encode(in, &buf); err != nil { return nil, fmt.Errorf("encoding failed: %v", err) diff --git a/vendor/sigs.k8s.io/cluster-api-provider-aws/pkg/apis/awsproviderconfig/v1alpha1/zz_generated.deepcopy.go b/vendor/sigs.k8s.io/cluster-api-provider-aws/pkg/apis/awsproviderconfig/v1alpha1/zz_generated.deepcopy.go index 26e80f4a189..5af190171bc 100644 --- a/vendor/sigs.k8s.io/cluster-api-provider-aws/pkg/apis/awsproviderconfig/v1alpha1/zz_generated.deepcopy.go +++ b/vendor/sigs.k8s.io/cluster-api-provider-aws/pkg/apis/awsproviderconfig/v1alpha1/zz_generated.deepcopy.go @@ -92,6 +92,13 @@ func (in *AWSMachineProviderConfig) DeepCopyInto(out *AWSMachineProviderConfig) *out = make([]LoadBalancerReference, len(*in)) copy(*out, *in) } + if in.BlockDevices != nil { + in, out := &in.BlockDevices, &out.BlockDevices + *out = make([]BlockDeviceMappingSpec, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } return } @@ -221,6 +228,83 @@ func (in *AWSResourceReference) DeepCopy() *AWSResourceReference { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BlockDeviceMappingSpec) DeepCopyInto(out *BlockDeviceMappingSpec) { + *out = *in + if in.DeviceName != nil { + in, out := &in.DeviceName, &out.DeviceName + *out = new(string) + **out = **in + } + if in.EBS != nil { + in, out := &in.EBS, &out.EBS + *out = new(EBSBlockDeviceSpec) + (*in).DeepCopyInto(*out) + } + if in.NoDevice != nil { + in, out := &in.NoDevice, &out.NoDevice + *out = new(string) + **out = **in + } + if in.VirtualName != nil { + in, out := &in.VirtualName, &out.VirtualName + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BlockDeviceMappingSpec. +func (in *BlockDeviceMappingSpec) DeepCopy() *BlockDeviceMappingSpec { + if in == nil { + return nil + } + out := new(BlockDeviceMappingSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EBSBlockDeviceSpec) DeepCopyInto(out *EBSBlockDeviceSpec) { + *out = *in + if in.DeleteOnTermination != nil { + in, out := &in.DeleteOnTermination, &out.DeleteOnTermination + *out = new(bool) + **out = **in + } + if in.Encrypted != nil { + in, out := &in.Encrypted, &out.Encrypted + *out = new(bool) + **out = **in + } + if in.Iops != nil { + in, out := &in.Iops, &out.Iops + *out = new(int64) + **out = **in + } + if in.VolumeSize != nil { + in, out := &in.VolumeSize, &out.VolumeSize + *out = new(int64) + **out = **in + } + if in.VolumeType != nil { + in, out := &in.VolumeType, &out.VolumeType + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EBSBlockDeviceSpec. +func (in *EBSBlockDeviceSpec) DeepCopy() *EBSBlockDeviceSpec { + if in == nil { + return nil + } + out := new(EBSBlockDeviceSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Filter) DeepCopyInto(out *Filter) { *out = *in