machine: azure-ultra-disks: add data disk deletion policy
@@ -76,10 +76,14 @@ A new field will be added to the `AzureMachineProviderSpec` struct `DataDisks`.
For this reason a new Composite type field `DataDiskManagedDiskParameters` will be added and the original `ManagedDiskParameters`, used in `OSDisk`, will be renamed to `OSDiskManagedDiskParameters`.
+`DataDisk` will also need a `DeletionPolicy` field to instruct on how the Data Disk should be treated at machine deletion. In other words, it will describe whether to retain or delete the data disk when the machine is deleted from the cloud provider. This field will be marked as required in order to make it very clear with the user what the fate of the data disk is going to be.
+
A new `StorageAccountType` type that describes the possible values for the `StorageAccountType` field on `DataDisk` will be added.
A new `CachingTypeOption` type that describes the possible values for the `CachingType` field on `DataDisk` will also be added.
+A new `DiskDeletionPolicyType` type that describes the possible deletion policy types for the `DeletionPolicy` field on `DataDisk` will also be added.
+
```go
type AzureMachineProviderSpec struct {
// Existing fields will not be modified
@@ -132,8 +136,26 @@ type DataDisk struct {
// +optional
// +kubebuilder:validation:Enum=None;ReadOnly;ReadWrite
CachingType CachingTypeOption `json:"cachingType,omitempty"`
+ // DeletionPolicy specifies the data disk deletion policy upon Machine deletion.
+ // Possible values are "Delete","Detach".
+ // When "Delete" is used the data disk is deleted when the Machine is deleted.
+ // When "Detach" is used the data disk is detached from the Machine and retained when the Machine is deleted.
+ // +kubebuilder:validation:Enum=Delete;Detach
+ // +kubebuilder:validation:Required
+ DeletionPolicy DiskDeletionPolicyType `json:"deletionPolicy"`
}
+// DiskDeletionPolicyType defines the possible values for DeletionPolicy.
+type DiskDeletionPolicyType string
+
+// These are the valid DiskDeletionPolicyType values.
+const (
+ // DiskDeletionPolicyTypeDelete means the DiskDeletionPolicyType is "Delete".
+ DiskDeletionPolicyTypeDelete DiskDeletionPolicyType = "Delete"
+ // DiskDeletionPolicyTypeDetach means the DiskDeletionPolicyType is "Detach".
+ DiskDeletionPolicyTypeDetach DiskDeletionPolicyType = "Detach"
+)
+
// CachingTypeOption defines the different values for a CachingType.
type CachingTypeOption string
