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
Show 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.
...
@@ -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
Apache
License
pkg/cloudprovider/providers/azure/azure_managedDiskController.go
View file @
f1bd292c
...
@@ -24,7 +24,7 @@ import (
...
@@ -24,7 +24,7 @@ import (
"strings"
"strings"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-10-01/compute"
"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"
"github.com/golang/glog"
"k8s.io/api/core/v1"
"k8s.io/api/core/v1"
...
@@ -35,6 +35,12 @@ import (
...
@@ -35,6 +35,12 @@ import (
"k8s.io/kubernetes/pkg/volume/util"
"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
//ManagedDiskController : managed disk controller struct
type
ManagedDiskController
struct
{
type
ManagedDiskController
struct
{
common
*
controllerCommon
common
*
controllerCommon
...
@@ -55,7 +61,11 @@ type ManagedDiskOptions struct {
...
@@ -55,7 +61,11 @@ type ManagedDiskOptions struct {
// The tags of the disk.
// The tags of the disk.
Tags
map
[
string
]
string
Tags
map
[
string
]
string
// The SKU of storage account.
// 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
)
{
func
newManagedDiskController
(
common
*
controllerCommon
)
(
*
ManagedDiskController
,
error
)
{
...
@@ -87,17 +97,49 @@ func (c *ManagedDiskController) CreateManagedDisk(options *ManagedDiskOptions) (
...
@@ -87,17 +97,49 @@ func (c *ManagedDiskController) CreateManagedDisk(options *ManagedDiskOptions) (
}
}
diskSizeGB
:=
int32
(
options
.
SizeGB
)
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
{
model
:=
compute
.
Disk
{
Location
:
&
c
.
common
.
location
,
Location
:
&
c
.
common
.
location
,
Tags
:
newTags
,
Tags
:
newTags
,
Zones
:
createZones
,
Zones
:
createZones
,
Sku
:
&
compute
.
DiskSku
{
Sku
:
&
compute
.
DiskSku
{
Name
:
compute
.
DiskStorageAccountTypes
(
options
.
StorageAccountType
),
Name
:
diskSku
,
},
DiskProperties
:
&
compute
.
DiskProperties
{
DiskSizeGB
:
&
diskSizeGB
,
CreationData
:
&
compute
.
CreationData
{
CreateOption
:
compute
.
Empty
},
},
},
DiskProperties
:
&
diskProperties
,
}
}
if
options
.
ResourceGroup
==
""
{
if
options
.
ResourceGroup
==
""
{
...
...
pkg/volume/azure_dd/BUILD
View file @
f1bd292c
...
@@ -76,7 +76,6 @@ go_test(
...
@@ -76,7 +76,6 @@ go_test(
"//staging/src/k8s.io/apimachinery/pkg/types:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/types:go_default_library",
"//staging/src/k8s.io/client-go/util/testing: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/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/Azure/go-autorest/autorest/to:go_default_library",
"//vendor/github.com/stretchr/testify/assert: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 (
...
@@ -25,7 +25,7 @@ import (
"strconv"
"strconv"
libstrings
"strings"
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/api/core/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/types"
...
@@ -38,7 +38,7 @@ import (
...
@@ -38,7 +38,7 @@ import (
)
)
const
(
const
(
defaultStorageAccountType
=
storag
e
.
StandardLRS
defaultStorageAccountType
=
comput
e
.
StandardLRS
defaultAzureDiskKind
=
v1
.
AzureManagedDisk
defaultAzureDiskKind
=
v1
.
AzureManagedDisk
defaultAzureDataDiskCachingMode
=
v1
.
AzureDataDiskCachingNone
defaultAzureDataDiskCachingMode
=
v1
.
AzureDataDiskCachingNone
)
)
...
@@ -124,13 +124,13 @@ func normalizeKind(kind string) (v1.AzureDataDiskKind, error) {
...
@@ -124,13 +124,13 @@ func normalizeKind(kind string) (v1.AzureDataDiskKind, error) {
return
v1
.
AzureDataDiskKind
(
kind
),
nil
return
v1
.
AzureDataDiskKind
(
kind
),
nil
}
}
func
normalizeStorageAccountType
(
storageAccountType
string
)
(
storage
.
SkuName
,
error
)
{
func
normalizeStorageAccountType
(
storageAccountType
string
)
(
compute
.
DiskStorageAccountTypes
,
error
)
{
if
storageAccountType
==
""
{
if
storageAccountType
==
""
{
return
defaultStorageAccountType
,
nil
return
defaultStorageAccountType
,
nil
}
}
sku
:=
storage
.
SkuName
(
storageAccountType
)
sku
:=
compute
.
DiskStorageAccountTypes
(
storageAccountType
)
supportedSkuNames
:=
storage
.
PossibleSkuName
Values
()
supportedSkuNames
:=
compute
.
PossibleDiskStorageAccountTypes
Values
()
for
_
,
s
:=
range
supportedSkuNames
{
for
_
,
s
:=
range
supportedSkuNames
{
if
sku
==
s
{
if
sku
==
s
{
return
sku
,
nil
return
sku
,
nil
...
...
pkg/volume/azure_dd/azure_common_test.go
View file @
f1bd292c
...
@@ -24,7 +24,7 @@ import (
...
@@ -24,7 +24,7 @@ import (
"testing"
"testing"
"time"
"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"
"github.com/stretchr/testify/assert"
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/util/mount"
...
@@ -141,12 +141,12 @@ func TestIoHandler(t *testing.T) {
...
@@ -141,12 +141,12 @@ func TestIoHandler(t *testing.T) {
func
TestNormalizeStorageAccountType
(
t
*
testing
.
T
)
{
func
TestNormalizeStorageAccountType
(
t
*
testing
.
T
)
{
tests
:=
[]
struct
{
tests
:=
[]
struct
{
storageAccountType
string
storageAccountType
string
expectedAccountType
storage
.
SkuName
expectedAccountType
compute
.
DiskStorageAccountTypes
expectError
bool
expectError
bool
}{
}{
{
{
storageAccountType
:
""
,
storageAccountType
:
""
,
expectedAccountType
:
storag
e
.
StandardLRS
,
expectedAccountType
:
comput
e
.
StandardLRS
,
expectError
:
false
,
expectError
:
false
,
},
},
{
{
...
@@ -156,27 +156,22 @@ func TestNormalizeStorageAccountType(t *testing.T) {
...
@@ -156,27 +156,22 @@ func TestNormalizeStorageAccountType(t *testing.T) {
},
},
{
{
storageAccountType
:
"Standard_LRS"
,
storageAccountType
:
"Standard_LRS"
,
expectedAccountType
:
storag
e
.
StandardLRS
,
expectedAccountType
:
comput
e
.
StandardLRS
,
expectError
:
false
,
expectError
:
false
,
},
},
{
{
storageAccountType
:
"Premium_LRS"
,
storageAccountType
:
"Premium_LRS"
,
expectedAccountType
:
storag
e
.
PremiumLRS
,
expectedAccountType
:
comput
e
.
PremiumLRS
,
expectError
:
false
,
expectError
:
false
,
},
},
{
{
storageAccountType
:
"Standard
_G
RS"
,
storageAccountType
:
"Standard
SSD_L
RS"
,
expectedAccountType
:
storage
.
StandardG
RS
,
expectedAccountType
:
compute
.
StandardSSDL
RS
,
expectError
:
false
,
expectError
:
false
,
},
},
{
{
storageAccountType
:
"Standard_RAGRS"
,
storageAccountType
:
"UltraSSD_LRS"
,
expectedAccountType
:
storage
.
StandardRAGRS
,
expectedAccountType
:
compute
.
UltraSSDLRS
,
expectError
:
false
,
},
{
storageAccountType
:
"Standard_ZRS"
,
expectedAccountType
:
storage
.
StandardZRS
,
expectError
:
false
,
expectError
:
false
,
},
},
}
}
...
...
pkg/volume/azure_dd/azure_provision.go
View file @
f1bd292c
...
@@ -22,6 +22,7 @@ import (
...
@@ -22,6 +22,7 @@ import (
"strconv"
"strconv"
"strings"
"strings"
"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2018-07-01/storage"
"k8s.io/api/core/v1"
"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
"k8s.io/apimachinery/pkg/api/resource"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
...
@@ -127,6 +128,9 @@ func (p *azureDiskProvisioner) Provision(selectedNode *v1.Node, allowedTopologie
...
@@ -127,6 +128,9 @@ func (p *azureDiskProvisioner) Provision(selectedNode *v1.Node, allowedTopologie
availabilityZone
string
availabilityZone
string
availabilityZones
sets
.
String
availabilityZones
sets
.
String
selectedAvailabilityZone
string
selectedAvailabilityZone
string
diskIopsReadWrite
string
diskMbpsReadWrite
string
)
)
// maxLength = 79 - (4 for ".vhd") = 75
// maxLength = 79 - (4 for ".vhd") = 75
name
:=
util
.
GenerateVolumeName
(
p
.
options
.
ClusterName
,
p
.
options
.
PVName
,
75
)
name
:=
util
.
GenerateVolumeName
(
p
.
options
.
ClusterName
,
p
.
options
.
PVName
,
75
)
...
@@ -165,6 +169,10 @@ func (p *azureDiskProvisioner) Provision(selectedNode *v1.Node, allowedTopologie
...
@@ -165,6 +169,10 @@ func (p *azureDiskProvisioner) Provision(selectedNode *v1.Node, allowedTopologie
}
}
case
"zoned"
:
case
"zoned"
:
strZoned
=
v
strZoned
=
v
case
"diskiopsreadwrite"
:
diskIopsReadWrite
=
v
case
"diskmbpsreadwrite"
:
diskMbpsReadWrite
=
v
default
:
default
:
return
nil
,
fmt
.
Errorf
(
"AzureDisk - invalid option %s in storage class"
,
k
)
return
nil
,
fmt
.
Errorf
(
"AzureDisk - invalid option %s in storage class"
,
k
)
}
}
...
@@ -241,6 +249,8 @@ func (p *azureDiskProvisioner) Provision(selectedNode *v1.Node, allowedTopologie
...
@@ -241,6 +249,8 @@ func (p *azureDiskProvisioner) Provision(selectedNode *v1.Node, allowedTopologie
SizeGB
:
requestGiB
,
SizeGB
:
requestGiB
,
Tags
:
tags
,
Tags
:
tags
,
AvailabilityZone
:
selectedAvailabilityZone
,
AvailabilityZone
:
selectedAvailabilityZone
,
DiskIOPSReadWrite
:
diskIopsReadWrite
,
DiskMBpsReadWrite
:
diskMbpsReadWrite
,
}
}
diskURI
,
err
=
diskController
.
CreateManagedDisk
(
volumeOptions
)
diskURI
,
err
=
diskController
.
CreateManagedDisk
(
volumeOptions
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -257,7 +267,7 @@ func (p *azureDiskProvisioner) Provision(selectedNode *v1.Node, allowedTopologie
...
@@ -257,7 +267,7 @@ func (p *azureDiskProvisioner) Provision(selectedNode *v1.Node, allowedTopologie
return
nil
,
err
return
nil
,
err
}
}
}
else
{
}
else
{
diskURI
,
err
=
diskController
.
CreateBlobDisk
(
name
,
s
kuName
,
requestGiB
)
diskURI
,
err
=
diskController
.
CreateBlobDisk
(
name
,
s
torage
.
SkuName
(
storageAccountType
)
,
requestGiB
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
...
staging/src/k8s.io/client-go/Godeps/Godeps.json
View file @
f1bd292c
...
@@ -16,27 +16,27 @@
...
@@ -16,27 +16,27 @@
},
},
{
{
"ImportPath"
:
"github.com/Azure/go-autorest/autorest"
,
"ImportPath"
:
"github.com/Azure/go-autorest/autorest"
,
"Rev"
:
"
a88c19ef2016e095f0b6c3b451074b4663f53bed
"
"Rev"
:
"
ea233b6412b0421a65dc6160e16c893364664a95
"
},
},
{
{
"ImportPath"
:
"github.com/Azure/go-autorest/autorest/adal"
,
"ImportPath"
:
"github.com/Azure/go-autorest/autorest/adal"
,
"Rev"
:
"
a88c19ef2016e095f0b6c3b451074b4663f53bed
"
"Rev"
:
"
ea233b6412b0421a65dc6160e16c893364664a95
"
},
},
{
{
"ImportPath"
:
"github.com/Azure/go-autorest/autorest/azure"
,
"ImportPath"
:
"github.com/Azure/go-autorest/autorest/azure"
,
"Rev"
:
"
a88c19ef2016e095f0b6c3b451074b4663f53bed
"
"Rev"
:
"
ea233b6412b0421a65dc6160e16c893364664a95
"
},
},
{
{
"ImportPath"
:
"github.com/Azure/go-autorest/autorest/date"
,
"ImportPath"
:
"github.com/Azure/go-autorest/autorest/date"
,
"Rev"
:
"
a88c19ef2016e095f0b6c3b451074b4663f53bed
"
"Rev"
:
"
ea233b6412b0421a65dc6160e16c893364664a95
"
},
},
{
{
"ImportPath"
:
"github.com/Azure/go-autorest/logger"
,
"ImportPath"
:
"github.com/Azure/go-autorest/logger"
,
"Rev"
:
"
a88c19ef2016e095f0b6c3b451074b4663f53bed
"
"Rev"
:
"
ea233b6412b0421a65dc6160e16c893364664a95
"
},
},
{
{
"ImportPath"
:
"github.com/Azure/go-autorest/version"
,
"ImportPath"
:
"github.com/Azure/go-autorest/version"
,
"Rev"
:
"
a88c19ef2016e095f0b6c3b451074b4663f53bed
"
"Rev"
:
"
ea233b6412b0421a65dc6160e16c893364664a95
"
},
},
{
{
"ImportPath"
:
"github.com/davecgh/go-spew/spew"
,
"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.
...
@@ -17,6 +17,7 @@ limitations under the License.
package
azure
package
azure
import
(
import
(
"encoding/json"
"strconv"
"strconv"
"strings"
"strings"
"sync"
"sync"
...
@@ -115,8 +116,8 @@ func token2Cfg(token *azureToken) map[string]string {
...
@@ -115,8 +116,8 @@ func token2Cfg(token *azureToken) map[string]string {
cfg
[
cfgClientID
]
=
token
.
clientID
cfg
[
cfgClientID
]
=
token
.
clientID
cfg
[
cfgTenantID
]
=
token
.
tenantID
cfg
[
cfgTenantID
]
=
token
.
tenantID
cfg
[
cfgApiserverID
]
=
token
.
apiserverID
cfg
[
cfgApiserverID
]
=
token
.
apiserverID
cfg
[
cfgExpiresIn
]
=
token
.
token
.
ExpiresIn
cfg
[
cfgExpiresIn
]
=
string
(
token
.
token
.
ExpiresIn
)
cfg
[
cfgExpiresOn
]
=
token
.
token
.
ExpiresOn
cfg
[
cfgExpiresOn
]
=
string
(
token
.
token
.
ExpiresOn
)
return
cfg
return
cfg
}
}
...
@@ -125,8 +126,8 @@ func newFackeAzureToken(accessToken string, expiresOn string) adal.Token {
...
@@ -125,8 +126,8 @@ func newFackeAzureToken(accessToken string, expiresOn string) adal.Token {
AccessToken
:
accessToken
,
AccessToken
:
accessToken
,
RefreshToken
:
"fake"
,
RefreshToken
:
"fake"
,
ExpiresIn
:
"3600"
,
ExpiresIn
:
"3600"
,
ExpiresOn
:
expiresOn
,
ExpiresOn
:
json
.
Number
(
expiresOn
)
,
NotBefore
:
expiresOn
,
NotBefore
:
json
.
Number
(
expiresOn
)
,
Resource
:
"fake"
,
Resource
:
"fake"
,
Type
:
"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