mirror of https://github.com/kubernetes/kops.git
Merge pull request #17171 from ajgupta42/azurevoltype
Adding VolumeType for Azure for etcdMembers
This commit is contained in:
commit
dee0e95924
|
@ -21,6 +21,7 @@ import (
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
armcompute "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute"
|
||||||
ec2types "github.com/aws/aws-sdk-go-v2/service/ec2/types"
|
ec2types "github.com/aws/aws-sdk-go-v2/service/ec2/types"
|
||||||
"github.com/scaleway/scaleway-sdk-go/api/instance/v1"
|
"github.com/scaleway/scaleway-sdk-go/api/instance/v1"
|
||||||
"k8s.io/kops/pkg/apis/kops"
|
"k8s.io/kops/pkg/apis/kops"
|
||||||
|
@ -48,6 +49,7 @@ const (
|
||||||
DefaultAWSEtcdVolumeIonIops = 100
|
DefaultAWSEtcdVolumeIonIops = 100
|
||||||
DefaultAWSEtcdVolumeGp3Iops = 3000
|
DefaultAWSEtcdVolumeGp3Iops = 3000
|
||||||
DefaultAWSEtcdVolumeGp3Throughput = 125
|
DefaultAWSEtcdVolumeGp3Throughput = 125
|
||||||
|
DefaultAZUREEtcdVolumeType = "StandardSSD_LRS"
|
||||||
DefaultGCEEtcdVolumeType = "pd-ssd"
|
DefaultGCEEtcdVolumeType = "pd-ssd"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -363,6 +365,10 @@ func (b *MasterVolumeBuilder) addAzureVolume(
|
||||||
m kops.EtcdMemberSpec,
|
m kops.EtcdMemberSpec,
|
||||||
allMembers []string,
|
allMembers []string,
|
||||||
) error {
|
) error {
|
||||||
|
volumeType := fi.ValueOf(m.VolumeType)
|
||||||
|
if volumeType == "" {
|
||||||
|
volumeType = DefaultAZUREEtcdVolumeType
|
||||||
|
}
|
||||||
// The tags are use by Protokube to mount the volume and use it for etcd.
|
// The tags are use by Protokube to mount the volume and use it for etcd.
|
||||||
tags := map[string]*string{
|
tags := map[string]*string{
|
||||||
// This is the configuration of the etcd cluster.
|
// This is the configuration of the etcd cluster.
|
||||||
|
@ -396,6 +402,7 @@ func (b *MasterVolumeBuilder) addAzureVolume(
|
||||||
},
|
},
|
||||||
SizeGB: fi.PtrTo(volumeSize),
|
SizeGB: fi.PtrTo(volumeSize),
|
||||||
Tags: tags,
|
Tags: tags,
|
||||||
|
VolumeType: fi.PtrTo(armcompute.DiskStorageAccountTypes(volumeType)),
|
||||||
Zones: []*string{&zoneNumber},
|
Zones: []*string{&zoneNumber},
|
||||||
}
|
}
|
||||||
c.AddTask(t)
|
c.AddTask(t)
|
||||||
|
|
|
@ -35,6 +35,7 @@ type Disk struct {
|
||||||
ResourceGroup *ResourceGroup
|
ResourceGroup *ResourceGroup
|
||||||
SizeGB *int32
|
SizeGB *int32
|
||||||
Tags map[string]*string
|
Tags map[string]*string
|
||||||
|
VolumeType *compute.DiskStorageAccountTypes
|
||||||
Zones []*string
|
Zones []*string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,6 +78,9 @@ func (d *Disk) Find(c *fi.CloudupContext) (*Disk, error) {
|
||||||
Tags: found.Tags,
|
Tags: found.Tags,
|
||||||
Zones: found.Zones,
|
Zones: found.Zones,
|
||||||
}
|
}
|
||||||
|
if found.SKU != nil && found.SKU.Name != nil {
|
||||||
|
disk.VolumeType = found.SKU.Name
|
||||||
|
}
|
||||||
if found.Properties != nil {
|
if found.Properties != nil {
|
||||||
disk.SizeGB = found.Properties.DiskSizeGB
|
disk.SizeGB = found.Properties.DiskSizeGB
|
||||||
}
|
}
|
||||||
|
@ -129,7 +133,7 @@ func (*Disk) RenderAzure(t *azure.AzureAPITarget, a, e, changes *Disk) error {
|
||||||
DiskSizeGB: e.SizeGB,
|
DiskSizeGB: e.SizeGB,
|
||||||
},
|
},
|
||||||
SKU: &compute.DiskSKU{
|
SKU: &compute.DiskSKU{
|
||||||
Name: to.Ptr(compute.DiskStorageAccountTypesStandardSSDLRS),
|
Name: e.VolumeType,
|
||||||
},
|
},
|
||||||
Tags: e.Tags,
|
Tags: e.Tags,
|
||||||
Zones: e.Zones,
|
Zones: e.Zones,
|
||||||
|
|
|
@ -31,6 +31,7 @@ import (
|
||||||
const (
|
const (
|
||||||
testTagKey = "key"
|
testTagKey = "key"
|
||||||
testTagValue = "value"
|
testTagValue = "value"
|
||||||
|
testVolumeType = "StandardSSD_LRS"
|
||||||
)
|
)
|
||||||
|
|
||||||
func newTestDisk() *Disk {
|
func newTestDisk() *Disk {
|
||||||
|
@ -41,6 +42,7 @@ func newTestDisk() *Disk {
|
||||||
Name: to.Ptr("rg"),
|
Name: to.Ptr("rg"),
|
||||||
},
|
},
|
||||||
SizeGB: to.Ptr[int32](32),
|
SizeGB: to.Ptr[int32](32),
|
||||||
|
VolumeType: to.Ptr(compute.DiskStorageAccountTypesStandardSSDLRS),
|
||||||
Tags: map[string]*string{
|
Tags: map[string]*string{
|
||||||
testTagKey: to.Ptr(testTagValue),
|
testTagKey: to.Ptr(testTagValue),
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue