Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
f1bd292c
Commit
f1bd292c
authored
Oct 31, 2018
by
andyzhangx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add ultrassd support
update stagin Godeps.json update godeps license fix test failure fix comments
parent
d210b4bc
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
86 additions
and
39 deletions
+86
-39
LICENSES
Godeps/LICENSES
+1
-1
azure_managedDiskController.go
...udprovider/providers/azure/azure_managedDiskController.go
+49
-7
BUILD
pkg/volume/azure_dd/BUILD
+0
-1
azure_common.go
pkg/volume/azure_dd/azure_common.go
+5
-5
azure_common_test.go
pkg/volume/azure_dd/azure_common_test.go
+9
-14
azure_provision.go
pkg/volume/azure_dd/azure_provision.go
+11
-1
Godeps.json
staging/src/k8s.io/client-go/Godeps/Godeps.json
+6
-6
azure_test.go
...s.io/client-go/plugin/pkg/client/auth/azure/azure_test.go
+5
-4
No files found.
Godeps/LICENSES
View file @
f1bd292c
...
...
@@ -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
pkg/cloudprovider/providers/azure/azure_managedDiskController.go
View file @
f1bd292c
...
...
@@ -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
==
""
{
...
...
pkg/volume/azure_dd/BUILD
View file @
f1bd292c
...
...
@@ -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",
],
...
...
pkg/volume/azure_dd/azure_common.go
View file @
f1bd292c
...
...
@@ -25,7 +25,7 @@ import (
"strconv"
libstrings
"strings"
"github.com/Azure/azure-sdk-for-go/services/
storage/mgmt/2018-07-01/storag
e"
"github.com/Azure/azure-sdk-for-go/services/
compute/mgmt/2018-10-01/comput
e"
"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
...
...
@@ -38,7 +38,7 @@ import (
)
const
(
defaultStorageAccountType
=
storag
e
.
StandardLRS
defaultStorageAccountType
=
comput
e
.
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
.
PossibleSkuName
Values
()
sku
:=
compute
.
DiskStorageAccountTypes
(
storageAccountType
)
supportedSkuNames
:=
compute
.
PossibleDiskStorageAccountTypes
Values
()
for
_
,
s
:=
range
supportedSkuNames
{
if
sku
==
s
{
return
sku
,
nil
...
...
pkg/volume/azure_dd/azure_common_test.go
View file @
f1bd292c
...
...
@@ -24,7 +24,7 @@ import (
"testing"
"time"
"github.com/Azure/azure-sdk-for-go/services/
storage/mgmt/2018-07-01/storag
e"
"github.com/Azure/azure-sdk-for-go/services/
compute/mgmt/2018-10-01/comput
e"
"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
:
storag
e
.
StandardLRS
,
expectedAccountType
:
comput
e
.
StandardLRS
,
expectError
:
false
,
},
{
...
...
@@ -156,27 +156,22 @@ func TestNormalizeStorageAccountType(t *testing.T) {
},
{
storageAccountType
:
"Standard_LRS"
,
expectedAccountType
:
storag
e
.
StandardLRS
,
expectedAccountType
:
comput
e
.
StandardLRS
,
expectError
:
false
,
},
{
storageAccountType
:
"Premium_LRS"
,
expectedAccountType
:
storag
e
.
PremiumLRS
,
expectedAccountType
:
comput
e
.
PremiumLRS
,
expectError
:
false
,
},
{
storageAccountType
:
"Standard
_G
RS"
,
expectedAccountType
:
storage
.
StandardG
RS
,
storageAccountType
:
"Standard
SSD_L
RS"
,
expectedAccountType
:
compute
.
StandardSSDL
RS
,
expectError
:
false
,
},
{
storageAccountType
:
"Standard_RAGRS"
,
expectedAccountType
:
storage
.
StandardRAGRS
,
expectError
:
false
,
},
{
storageAccountType
:
"Standard_ZRS"
,
expectedAccountType
:
storage
.
StandardZRS
,
storageAccountType
:
"UltraSSD_LRS"
,
expectedAccountType
:
compute
.
UltraSSDLRS
,
expectError
:
false
,
},
}
...
...
pkg/volume/azure_dd/azure_provision.go
View file @
f1bd292c
...
...
@@ -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
,
s
kuName
,
requestGiB
)
diskURI
,
err
=
diskController
.
CreateBlobDisk
(
name
,
s
torage
.
SkuName
(
storageAccountType
)
,
requestGiB
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
staging/src/k8s.io/client-go/Godeps/Godeps.json
View file @
f1bd292c
...
...
@@ -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"
,
...
...
staging/src/k8s.io/client-go/plugin/pkg/client/auth/azure/azure_test.go
View file @
f1bd292c
...
...
@@ -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"
,
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment