Skip to content

Commit

Permalink
Merge pull request kubernetes-sigs#303 from abhinavdahiya/encyrpted_k…
Browse files Browse the repository at this point in the history
…ey_id

support KMS key for EBS encryption
  • Loading branch information
openshift-merge-robot authored Mar 16, 2020
2 parents 42fb2fb + 09f91d9 commit 923caeb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/actuators/machine/instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,15 @@ func getBlockDeviceMappings(blockDeviceMappings []providerconfigv1.BlockDeviceMa
Encrypted: blockDeviceMappings[0].EBS.Encrypted,
},
}

if aws.StringValue(blockDeviceMappings[0].EBS.KMSKey.ID) != "" {
klog.V(3).Infof("Using KMS key ID %q for encrypting EBS volume", *blockDeviceMappings[0].EBS.KMSKey.ID)
blockDeviceMapping.Ebs.KmsKeyId = blockDeviceMappings[0].EBS.KMSKey.ID
} else if aws.StringValue(blockDeviceMappings[0].EBS.KMSKey.ARN) != "" {
klog.V(3).Info("Using KMS key ARN for encrypting EBS volume") // ARN usually have account ids, therefore are sensitive data so shouldn't log the value
blockDeviceMapping.Ebs.KmsKeyId = blockDeviceMappings[0].EBS.KMSKey.ARN
}

if *volumeType == "io1" {
blockDeviceMapping.Ebs.Iops = blockDeviceMappings[0].EBS.Iops
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ type EBSBlockDeviceSpec struct {
// may only be attached to machines that support Amazon EBS encryption.
Encrypted *bool `json:"encrypted,omitempty"`

// Indicates the KMS key that should be used to encrypt the Amazon EBS volume.
KMSKey AWSResourceReference `json:"kmsKey,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
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 923caeb

Please sign in to comment.