Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for Data Disks in Azure and AliCloud #397

Merged
merged 13 commits into from
Apr 26, 2020
13 changes: 13 additions & 0 deletions kubernetes/machine_classes/alicloud-machine-class.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,19 @@ spec:
zoneID: cn-hangzhou-e # Zone of the region
securityGroupID: sg-1234567890 # ID of security group, it has to be within the same VPC of vSwitch
vSwitchID: vsw-1234567890 # similar to AWS subnet ID
dataDisks: # Array of disks to be associated with this instance
- name: disk1
size: 50
category: cloud_ssd
encrypted: false
description: 50 GB disk description
deleteWithInstance: true
- name: disk2
size: 40
category: cloud_efficiency
encrypted: true
description: 40 GB disk description
deleteWithInstance: true
systemDisk:
category: cloud_efficiency # cloud, cloud_efficiency, cloud_ssd, ephemeral_ssd
size: 30 # 20-500
Expand Down
11 changes: 10 additions & 1 deletion kubernetes/machine_classes/aws-machine-class.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ spec:
namespace: default # Namespace
name: test-secret # Name of the secret
blockDevices:
- ebs:
- name: /root
hardikdr marked this conversation as resolved.
Show resolved Hide resolved
ebs:
volumeSize: 50 # Size of the root block device
volumeType: gp2 # Type of the root block device
encrypted: false
deleteOnTermination: true
- name: /dev/sdb
ebs:
volumeSize: 50 # Size of the root block device
volumeType: gp2 # Type of the root block device
encrypted: true
deleteOnTermination: true
11 changes: 11 additions & 0 deletions kubernetes/machine_classes/azure-machine-class.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ spec:
caching: "None" # Caching Strategy (None/ReadOnly/ReadWrite)
diskSizeGB: 50 # Size of disk to be created in GB
createOption: "FromImage" # Create option for disk (Empty/Attach/FromImage)
dataDisks:
- lun: 0
caching: None
diskSizeGB: 100
storageAccountType: Standard_LRS
name: sdb
- lun: 1
caching: None
diskSizeGB: 100
storageAccountType: Standard_LRS
name: sdc
osProfile:
adminUsername: "admin-name" # Admin user name
linuxConfiguration:
Expand Down
7 changes: 7 additions & 0 deletions kubernetes/machine_classes/gcp-machine-class.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ spec:
image: projects/coreos-cloud/global/images/image-name-goes-here # Disk image name
labels:
name: my-disk # Label assigned to the disk
- autoDelete: true
boot: false
sizeGb: 50
type: pd-standard
image: projects/coreos-cloud/global/images/image-name-goes-here # Disk image name
labels:
name: my-disk
labels:
name: my-instance # Label assigned to the instance
machineType: n1-standard-4 # Type of GCP instance to launch
Expand Down
20 changes: 20 additions & 0 deletions pkg/apis/machine/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,7 @@ type AzureHardwareProfile struct {
type AzureStorageProfile struct {
ImageReference AzureImageReference
OsDisk AzureOSDisk
DataDisks []AzureDataDisk
}

// AzureImageReference is specifies information about the image to use. You can specify information about platform images,
Expand All @@ -910,6 +911,14 @@ type AzureOSDisk struct {
CreateOption string
}

type AzureDataDisk struct {
Name string
Lun int32
Caching string
StorageAccountType string
DiskSizeGB int32
}

// AzureManagedDiskParameters is the parameters of a managed disk.
type AzureManagedDiskParameters struct {
ID string
Expand Down Expand Up @@ -1089,6 +1098,7 @@ type AlicloudMachineClassSpec struct {
VSwitchID string
PrivateIPAddress string
SystemDisk *AlicloudSystemDisk
DataDisks []AlicloudDataDisk
InstanceChargeType string
InternetChargeType string
InternetMaxBandwidthIn *int
Expand All @@ -1106,6 +1116,16 @@ type AlicloudSystemDisk struct {
Size int
}

// AlicloudDataDisk describes DataDisk for Alicloud.
type AlicloudDataDisk struct {
Name string
Category string
Description string
Encrypted bool
Size int
DeleteWithInstance *bool
}

/********************** PacketMachineClass APIs ***************/

// +genclient
Expand Down
20 changes: 20 additions & 0 deletions pkg/apis/machine/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -970,6 +970,7 @@ type AzureHardwareProfile struct {
type AzureStorageProfile struct {
ImageReference AzureImageReference `json:"imageReference,omitempty"`
OsDisk AzureOSDisk `json:"osDisk,omitempty"`
DataDisks []AzureDataDisk `json:"dataDisks,omitempty"`
}

// AzureImageReference is specifies information about the image to use. You can specify information about platform images,
Expand All @@ -992,6 +993,14 @@ type AzureOSDisk struct {
CreateOption string `json:"createOption,omitempty"`
}

type AzureDataDisk struct {
hardikdr marked this conversation as resolved.
Show resolved Hide resolved
Name string `json:"name,omitempty"`
Lun int32 `json:"lun,omitempty"`
Caching string `json:"caching,omitempty"`
StorageAccountType string `json:"storageAccountType,omitempty"`
DiskSizeGB int32 `json:"diskSizeGB,omitempty"`
}

// AzureManagedDiskParameters is the parameters of a managed disk.
type AzureManagedDiskParameters struct {
ID string `json:"id,omitempty"`
Expand Down Expand Up @@ -1237,6 +1246,7 @@ type AlicloudMachineClassSpec struct {
VSwitchID string `json:"vSwitchID"`
PrivateIPAddress string `json:"privateIPAddress,omitempty"`
SystemDisk *AlicloudSystemDisk `json:"systemDisk,omitempty"`
DataDisks []AlicloudDataDisk `json:"dataDisks,omitempty"`
InstanceChargeType string `json:"instanceChargeType,omitempty"`
InternetChargeType string `json:"internetChargeType,omitempty"`
InternetMaxBandwidthIn *int `json:"internetMaxBandwidthIn,omitempty"`
Expand All @@ -1248,6 +1258,16 @@ type AlicloudMachineClassSpec struct {
SecretRef *corev1.SecretReference `json:"secretRef,omitempty"`
}

type AlicloudDataDisk struct {
Name string `json:"name"`
hardikdr marked this conversation as resolved.
Show resolved Hide resolved
Category string `json:"category"`
// +optional
Description string `json:"description"`
Encrypted bool `json:"encrypted"`
DeleteWithInstance *bool `json:"deleteWithInstance"`
Size int `json:"size"`
}

// AlicloudSystemDisk describes SystemDisk for Alicloud.
type AlicloudSystemDisk struct {
Category string `json:"category"`
Expand Down
126 changes: 124 additions & 2 deletions pkg/apis/machine/v1alpha1/zz_generated.conversion.go

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

Loading