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
a8de0029
Commit
a8de0029
authored
May 07, 2018
by
sylvain.boily
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding support for VM name with extra Separator String
parent
d9ba0549
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
3 deletions
+15
-3
azure_vmss_cache.go
pkg/cloudprovider/providers/azure/azure_vmss_cache.go
+9
-3
azure_vmss_cache_test.go
pkg/cloudprovider/providers/azure/azure_vmss_cache_test.go
+6
-0
No files found.
pkg/cloudprovider/providers/azure/azure_vmss_cache.go
View file @
a8de0029
...
@@ -47,13 +47,19 @@ func (ss *scaleSet) makeVmssVMName(scaleSetName, instanceID string) string {
...
@@ -47,13 +47,19 @@ func (ss *scaleSet) makeVmssVMName(scaleSetName, instanceID string) string {
}
}
func
extractVmssVMName
(
name
string
)
(
string
,
string
,
error
)
{
func
extractVmssVMName
(
name
string
)
(
string
,
string
,
error
)
{
ret
:=
strings
.
Split
(
name
,
vmssNameSeparator
)
split
:=
strings
.
SplitAfter
(
name
,
vmssNameSeparator
)
if
len
(
ret
)
!=
2
{
if
len
(
split
)
<
2
{
glog
.
Errorf
(
"Failed to extract vmssVMName %q"
,
name
)
glog
.
Errorf
(
"Failed to extract vmssVMName %q"
,
name
)
return
""
,
""
,
ErrorNotVmssInstance
return
""
,
""
,
ErrorNotVmssInstance
}
}
return
ret
[
0
],
ret
[
1
],
nil
ssName
:=
strings
.
Join
(
split
[
0
:
len
(
split
)
-
1
],
""
)
// removing the trailing `vmssNameSeparator` since we used SplitAfter
ssName
=
ssName
[
:
len
(
ssName
)
-
1
]
instanceID
:=
split
[
len
(
split
)
-
1
]
return
ssName
,
instanceID
,
nil
}
}
func
(
ss
*
scaleSet
)
newVmssCache
()
(
*
timedCache
,
error
)
{
func
(
ss
*
scaleSet
)
newVmssCache
()
(
*
timedCache
,
error
)
{
...
...
pkg/cloudprovider/providers/azure/azure_vmss_cache_test.go
View file @
a8de0029
...
@@ -46,6 +46,12 @@ func TestExtractVmssVMName(t *testing.T) {
...
@@ -46,6 +46,12 @@ func TestExtractVmssVMName(t *testing.T) {
expectedScaleSet
:
"vm"
,
expectedScaleSet
:
"vm"
,
expectedInstanceID
:
"1234"
,
expectedInstanceID
:
"1234"
,
},
},
{
description
:
"correct vmss VM name with Extra Separator should return correct scaleSet and instanceID"
,
vmName
:
"vm_test_1234"
,
expectedScaleSet
:
"vm_test"
,
expectedInstanceID
:
"1234"
,
},
}
}
for
_
,
c
:=
range
cases
{
for
_
,
c
:=
range
cases
{
...
...
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