Skip to content

Commit 1c9728c

Browse files
authored
Add SnapShotID field in AWSMachineClass (#464)
1 parent 726ce7c commit 1c9728c

File tree

7 files changed

+68
-1
lines changed

7 files changed

+68
-1
lines changed

pkg/apis/machine/types.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,18 @@ type AWSEbsBlockDeviceSpec struct {
775775
// it is not used in requests to create gp2, st1, sc1, or standard volumes.
776776
Iops int64
777777

778+
// Identifier (key ID, key alias, ID ARN, or alias ARN) for a customer managed
779+
// CMK under which the EBS volume is encrypted.
780+
//
781+
// This parameter is only supported on BlockDeviceMapping objects called by
782+
// RunInstances (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RunInstances.html),
783+
// RequestSpotFleet (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RequestSpotFleet.html),
784+
// and RequestSpotInstances (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RequestSpotInstances.html).
785+
KmsKeyID *string
786+
787+
// The ID of the snapshot.
788+
SnapshotID *string
789+
778790
// The size of the volume, in GiB.
779791
//
780792
// Constraints: 1-16384 for General Purpose SSD (gp2), 4-16384 for Provisioned

pkg/apis/machine/v1alpha1/types.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,6 +850,18 @@ type AWSEbsBlockDeviceSpec struct {
850850
// it is not used in requests to create gp2, st1, sc1, or standard volumes.
851851
Iops int64 `json:"iops,omitempty"`
852852

853+
// Identifier (key ID, key alias, ID ARN, or alias ARN) for a customer managed
854+
// CMK under which the EBS volume is encrypted.
855+
//
856+
// This parameter is only supported on BlockDeviceMapping objects called by
857+
// RunInstances (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RunInstances.html),
858+
// RequestSpotFleet (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RequestSpotFleet.html),
859+
// and RequestSpotInstances (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RequestSpotInstances.html).
860+
KmsKeyID *string `json:"kmsKeyID,omitempty"`
861+
862+
// The ID of the snapshot.
863+
SnapshotID *string `json:"snapshotID,omitempty"`
864+
853865
// The size of the volume, in GiB.
854866
//
855867
// Constraints: 1-16384 for General Purpose SSD (gp2), 4-16384 for Provisioned
@@ -993,7 +1005,7 @@ type AzureOSDisk struct {
9931005

9941006
type AzureDataDisk struct {
9951007
Name string `json:"name,omitempty"`
996-
Lun *int32 `json:"lun,omitempty"`
1008+
Lun *int32 `json:"lun,omitempty"`
9971009
Caching string `json:"caching,omitempty"`
9981010
StorageAccountType string `json:"storageAccountType,omitempty"`
9991011
DiskSizeGB int32 `json:"diskSizeGB,omitempty"`

pkg/apis/machine/v1alpha1/zz_generated.conversion.go

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/machine/v1alpha1/zz_generated.deepcopy.go

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/machine/zz_generated.deepcopy.go

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/driver/driver_aws.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ func (d *AWSDriver) generateBlockDevices(blockDevices []v1alpha1.AWSBlockDeviceM
183183
volumeSize := disk.Ebs.VolumeSize
184184
volumeType := disk.Ebs.VolumeType
185185
encrypted := disk.Ebs.Encrypted
186+
snapshotID := disk.Ebs.SnapshotID
186187

187188
blkDeviceMapping := ec2.BlockDeviceMapping{
188189
DeviceName: aws.String(deviceName),
@@ -199,6 +200,10 @@ func (d *AWSDriver) generateBlockDevices(blockDevices []v1alpha1.AWSBlockDeviceM
199200
if volumeType == "io1" {
200201
blkDeviceMapping.Ebs.Iops = aws.Int64(disk.Ebs.Iops)
201202
}
203+
204+
if snapshotID != nil {
205+
blkDeviceMapping.Ebs.SnapshotId = snapshotID
206+
}
202207
blkDeviceMappings = append(blkDeviceMappings, &blkDeviceMapping)
203208
}
204209

pkg/openapi/openapi_generated.go

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)