mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
add ultrassd support
update stagin Godeps.json update godeps license fix test failure fix comments
This commit is contained in:
parent
d210b4bcf3
commit
f1bd292c76
2
Godeps/LICENSES
generated
2
Godeps/LICENSES
generated
@ -8137,7 +8137,7 @@ SOFTWARE.
|
||||
|
||||
|
||||
================================================================================
|
||||
= vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute licensed under: =
|
||||
= vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-10-01/compute licensed under: =
|
||||
|
||||
|
||||
Apache License
|
||||
|
@ -24,7 +24,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-10-01/compute"
|
||||
"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2018-07-01/storage"
|
||||
"github.com/Azure/go-autorest/autorest/to"
|
||||
"github.com/golang/glog"
|
||||
|
||||
"k8s.io/api/core/v1"
|
||||
@ -35,6 +35,12 @@ import (
|
||||
"k8s.io/kubernetes/pkg/volume/util"
|
||||
)
|
||||
|
||||
const (
|
||||
// default IOPS Caps & Throughput Cap (MBps) per https://docs.microsoft.com/en-us/azure/virtual-machines/linux/disks-ultra-ssd
|
||||
defaultDiskIOPSReadWrite = 1200
|
||||
defaultDiskMBpsReadWrite = 300
|
||||
)
|
||||
|
||||
//ManagedDiskController : managed disk controller struct
|
||||
type ManagedDiskController struct {
|
||||
common *controllerCommon
|
||||
@ -55,7 +61,11 @@ type ManagedDiskOptions struct {
|
||||
// The tags of the disk.
|
||||
Tags map[string]string
|
||||
// The SKU of storage account.
|
||||
StorageAccountType storage.SkuName
|
||||
StorageAccountType compute.DiskStorageAccountTypes
|
||||
// IOPS Caps for UltraSSD disk
|
||||
DiskIOPSReadWrite string
|
||||
// Throughput Cap (MBps) for UltraSSD disk
|
||||
DiskMBpsReadWrite string
|
||||
}
|
||||
|
||||
func newManagedDiskController(common *controllerCommon) (*ManagedDiskController, error) {
|
||||
@ -87,17 +97,49 @@ func (c *ManagedDiskController) CreateManagedDisk(options *ManagedDiskOptions) (
|
||||
}
|
||||
|
||||
diskSizeGB := int32(options.SizeGB)
|
||||
diskSku := compute.DiskStorageAccountTypes(options.StorageAccountType)
|
||||
diskProperties := compute.DiskProperties{
|
||||
DiskSizeGB: &diskSizeGB,
|
||||
CreationData: &compute.CreationData{CreateOption: compute.Empty},
|
||||
}
|
||||
|
||||
if diskSku == compute.UltraSSDLRS {
|
||||
diskIOPSReadWrite := int64(defaultDiskIOPSReadWrite)
|
||||
if options.DiskIOPSReadWrite != "" {
|
||||
v, err := strconv.Atoi(options.DiskIOPSReadWrite)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("AzureDisk - failed to parse DiskIOPSReadWrite: %v", err)
|
||||
}
|
||||
diskIOPSReadWrite = int64(v)
|
||||
}
|
||||
diskProperties.DiskIOPSReadWrite = to.Int64Ptr(diskIOPSReadWrite)
|
||||
|
||||
diskMBpsReadWrite := int32(defaultDiskMBpsReadWrite)
|
||||
if options.DiskMBpsReadWrite != "" {
|
||||
v, err := strconv.Atoi(options.DiskMBpsReadWrite)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("AzureDisk - failed to parse DiskMBpsReadWrite: %v", err)
|
||||
}
|
||||
diskMBpsReadWrite = int32(v)
|
||||
}
|
||||
diskProperties.DiskMBpsReadWrite = to.Int32Ptr(diskMBpsReadWrite)
|
||||
} else {
|
||||
if options.DiskIOPSReadWrite != "" {
|
||||
return "", fmt.Errorf("AzureDisk - DiskIOPSReadWrite parameter is only applicable in UltraSSD_LRS disk type")
|
||||
}
|
||||
if options.DiskMBpsReadWrite != "" {
|
||||
return "", fmt.Errorf("AzureDisk - DiskMBpsReadWrite parameter is only applicable in UltraSSD_LRS disk type")
|
||||
}
|
||||
}
|
||||
|
||||
model := compute.Disk{
|
||||
Location: &c.common.location,
|
||||
Tags: newTags,
|
||||
Zones: createZones,
|
||||
Sku: &compute.DiskSku{
|
||||
Name: compute.DiskStorageAccountTypes(options.StorageAccountType),
|
||||
},
|
||||
DiskProperties: &compute.DiskProperties{
|
||||
DiskSizeGB: &diskSizeGB,
|
||||
CreationData: &compute.CreationData{CreateOption: compute.Empty},
|
||||
Name: diskSku,
|
||||
},
|
||||
DiskProperties: &diskProperties,
|
||||
}
|
||||
|
||||
if options.ResourceGroup == "" {
|
||||
|
@ -76,7 +76,6 @@ go_test(
|
||||
"//staging/src/k8s.io/apimachinery/pkg/types:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/util/testing:go_default_library",
|
||||
"//vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-10-01/compute:go_default_library",
|
||||
"//vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2018-07-01/storage:go_default_library",
|
||||
"//vendor/github.com/Azure/go-autorest/autorest/to:go_default_library",
|
||||
"//vendor/github.com/stretchr/testify/assert:go_default_library",
|
||||
],
|
||||
|
@ -25,7 +25,7 @@ import (
|
||||
"strconv"
|
||||
libstrings "strings"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2018-07-01/storage"
|
||||
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-10-01/compute"
|
||||
|
||||
"k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
@ -38,7 +38,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
defaultStorageAccountType = storage.StandardLRS
|
||||
defaultStorageAccountType = compute.StandardLRS
|
||||
defaultAzureDiskKind = v1.AzureManagedDisk
|
||||
defaultAzureDataDiskCachingMode = v1.AzureDataDiskCachingNone
|
||||
)
|
||||
@ -124,13 +124,13 @@ func normalizeKind(kind string) (v1.AzureDataDiskKind, error) {
|
||||
return v1.AzureDataDiskKind(kind), nil
|
||||
}
|
||||
|
||||
func normalizeStorageAccountType(storageAccountType string) (storage.SkuName, error) {
|
||||
func normalizeStorageAccountType(storageAccountType string) (compute.DiskStorageAccountTypes, error) {
|
||||
if storageAccountType == "" {
|
||||
return defaultStorageAccountType, nil
|
||||
}
|
||||
|
||||
sku := storage.SkuName(storageAccountType)
|
||||
supportedSkuNames := storage.PossibleSkuNameValues()
|
||||
sku := compute.DiskStorageAccountTypes(storageAccountType)
|
||||
supportedSkuNames := compute.PossibleDiskStorageAccountTypesValues()
|
||||
for _, s := range supportedSkuNames {
|
||||
if sku == s {
|
||||
return sku, nil
|
||||
|
@ -24,7 +24,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2018-07-01/storage"
|
||||
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-10-01/compute"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"k8s.io/kubernetes/pkg/util/mount"
|
||||
@ -141,12 +141,12 @@ func TestIoHandler(t *testing.T) {
|
||||
func TestNormalizeStorageAccountType(t *testing.T) {
|
||||
tests := []struct {
|
||||
storageAccountType string
|
||||
expectedAccountType storage.SkuName
|
||||
expectedAccountType compute.DiskStorageAccountTypes
|
||||
expectError bool
|
||||
}{
|
||||
{
|
||||
storageAccountType: "",
|
||||
expectedAccountType: storage.StandardLRS,
|
||||
expectedAccountType: compute.StandardLRS,
|
||||
expectError: false,
|
||||
},
|
||||
{
|
||||
@ -156,27 +156,22 @@ func TestNormalizeStorageAccountType(t *testing.T) {
|
||||
},
|
||||
{
|
||||
storageAccountType: "Standard_LRS",
|
||||
expectedAccountType: storage.StandardLRS,
|
||||
expectedAccountType: compute.StandardLRS,
|
||||
expectError: false,
|
||||
},
|
||||
{
|
||||
storageAccountType: "Premium_LRS",
|
||||
expectedAccountType: storage.PremiumLRS,
|
||||
expectedAccountType: compute.PremiumLRS,
|
||||
expectError: false,
|
||||
},
|
||||
{
|
||||
storageAccountType: "Standard_GRS",
|
||||
expectedAccountType: storage.StandardGRS,
|
||||
storageAccountType: "StandardSSD_LRS",
|
||||
expectedAccountType: compute.StandardSSDLRS,
|
||||
expectError: false,
|
||||
},
|
||||
{
|
||||
storageAccountType: "Standard_RAGRS",
|
||||
expectedAccountType: storage.StandardRAGRS,
|
||||
expectError: false,
|
||||
},
|
||||
{
|
||||
storageAccountType: "Standard_ZRS",
|
||||
expectedAccountType: storage.StandardZRS,
|
||||
storageAccountType: "UltraSSD_LRS",
|
||||
expectedAccountType: compute.UltraSSDLRS,
|
||||
expectError: false,
|
||||
},
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2018-07-01/storage"
|
||||
"k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
@ -127,6 +128,9 @@ func (p *azureDiskProvisioner) Provision(selectedNode *v1.Node, allowedTopologie
|
||||
availabilityZone string
|
||||
availabilityZones sets.String
|
||||
selectedAvailabilityZone string
|
||||
|
||||
diskIopsReadWrite string
|
||||
diskMbpsReadWrite string
|
||||
)
|
||||
// maxLength = 79 - (4 for ".vhd") = 75
|
||||
name := util.GenerateVolumeName(p.options.ClusterName, p.options.PVName, 75)
|
||||
@ -165,6 +169,10 @@ func (p *azureDiskProvisioner) Provision(selectedNode *v1.Node, allowedTopologie
|
||||
}
|
||||
case "zoned":
|
||||
strZoned = v
|
||||
case "diskiopsreadwrite":
|
||||
diskIopsReadWrite = v
|
||||
case "diskmbpsreadwrite":
|
||||
diskMbpsReadWrite = v
|
||||
default:
|
||||
return nil, fmt.Errorf("AzureDisk - invalid option %s in storage class", k)
|
||||
}
|
||||
@ -241,6 +249,8 @@ func (p *azureDiskProvisioner) Provision(selectedNode *v1.Node, allowedTopologie
|
||||
SizeGB: requestGiB,
|
||||
Tags: tags,
|
||||
AvailabilityZone: selectedAvailabilityZone,
|
||||
DiskIOPSReadWrite: diskIopsReadWrite,
|
||||
DiskMBpsReadWrite: diskMbpsReadWrite,
|
||||
}
|
||||
diskURI, err = diskController.CreateManagedDisk(volumeOptions)
|
||||
if err != nil {
|
||||
@ -257,7 +267,7 @@ func (p *azureDiskProvisioner) Provision(selectedNode *v1.Node, allowedTopologie
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
diskURI, err = diskController.CreateBlobDisk(name, skuName, requestGiB)
|
||||
diskURI, err = diskController.CreateBlobDisk(name, storage.SkuName(storageAccountType), requestGiB)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
12
staging/src/k8s.io/client-go/Godeps/Godeps.json
generated
12
staging/src/k8s.io/client-go/Godeps/Godeps.json
generated
@ -16,27 +16,27 @@
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/Azure/go-autorest/autorest",
|
||||
"Rev": "a88c19ef2016e095f0b6c3b451074b4663f53bed"
|
||||
"Rev": "ea233b6412b0421a65dc6160e16c893364664a95"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/Azure/go-autorest/autorest/adal",
|
||||
"Rev": "a88c19ef2016e095f0b6c3b451074b4663f53bed"
|
||||
"Rev": "ea233b6412b0421a65dc6160e16c893364664a95"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/Azure/go-autorest/autorest/azure",
|
||||
"Rev": "a88c19ef2016e095f0b6c3b451074b4663f53bed"
|
||||
"Rev": "ea233b6412b0421a65dc6160e16c893364664a95"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/Azure/go-autorest/autorest/date",
|
||||
"Rev": "a88c19ef2016e095f0b6c3b451074b4663f53bed"
|
||||
"Rev": "ea233b6412b0421a65dc6160e16c893364664a95"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/Azure/go-autorest/logger",
|
||||
"Rev": "a88c19ef2016e095f0b6c3b451074b4663f53bed"
|
||||
"Rev": "ea233b6412b0421a65dc6160e16c893364664a95"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/Azure/go-autorest/version",
|
||||
"Rev": "a88c19ef2016e095f0b6c3b451074b4663f53bed"
|
||||
"Rev": "ea233b6412b0421a65dc6160e16c893364664a95"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/davecgh/go-spew/spew",
|
||||
|
@ -17,6 +17,7 @@ limitations under the License.
|
||||
package azure
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
@ -115,8 +116,8 @@ func token2Cfg(token *azureToken) map[string]string {
|
||||
cfg[cfgClientID] = token.clientID
|
||||
cfg[cfgTenantID] = token.tenantID
|
||||
cfg[cfgApiserverID] = token.apiserverID
|
||||
cfg[cfgExpiresIn] = token.token.ExpiresIn
|
||||
cfg[cfgExpiresOn] = token.token.ExpiresOn
|
||||
cfg[cfgExpiresIn] = string(token.token.ExpiresIn)
|
||||
cfg[cfgExpiresOn] = string(token.token.ExpiresOn)
|
||||
return cfg
|
||||
}
|
||||
|
||||
@ -125,8 +126,8 @@ func newFackeAzureToken(accessToken string, expiresOn string) adal.Token {
|
||||
AccessToken: accessToken,
|
||||
RefreshToken: "fake",
|
||||
ExpiresIn: "3600",
|
||||
ExpiresOn: expiresOn,
|
||||
NotBefore: expiresOn,
|
||||
ExpiresOn: json.Number(expiresOn),
|
||||
NotBefore: json.Number(expiresOn),
|
||||
Resource: "fake",
|
||||
Type: "fake",
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user