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
f42f79ed
Commit
f42f79ed
authored
Nov 24, 2017
by
Shiyang Wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix spaces around the /
parent
7b9affae
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
13 deletions
+13
-13
printers.go
pkg/printers/internalversion/printers.go
+4
-4
printers_test.go
pkg/printers/internalversion/printers_test.go
+9
-9
No files found.
pkg/printers/internalversion/printers.go
View file @
f42f79ed
...
...
@@ -1483,20 +1483,20 @@ func formatHPAMetrics(specs []autoscaling.MetricSpec, statuses []autoscaling.Met
if
len
(
statuses
)
>
i
&&
statuses
[
i
]
.
Pods
!=
nil
{
current
=
statuses
[
i
]
.
Pods
.
CurrentAverageValue
.
String
()
}
list
=
append
(
list
,
fmt
.
Sprintf
(
"%s
/
%s"
,
current
,
spec
.
Pods
.
TargetAverageValue
.
String
()))
list
=
append
(
list
,
fmt
.
Sprintf
(
"%s
/
%s"
,
current
,
spec
.
Pods
.
TargetAverageValue
.
String
()))
case
autoscaling
.
ObjectMetricSourceType
:
current
:=
"<unknown>"
if
len
(
statuses
)
>
i
&&
statuses
[
i
]
.
Object
!=
nil
{
current
=
statuses
[
i
]
.
Object
.
CurrentValue
.
String
()
}
list
=
append
(
list
,
fmt
.
Sprintf
(
"%s
/
%s"
,
current
,
spec
.
Object
.
TargetValue
.
String
()))
list
=
append
(
list
,
fmt
.
Sprintf
(
"%s
/
%s"
,
current
,
spec
.
Object
.
TargetValue
.
String
()))
case
autoscaling
.
ResourceMetricSourceType
:
if
spec
.
Resource
.
TargetAverageValue
!=
nil
{
current
:=
"<unknown>"
if
len
(
statuses
)
>
i
&&
statuses
[
i
]
.
Resource
!=
nil
{
current
=
statuses
[
i
]
.
Resource
.
CurrentAverageValue
.
String
()
}
list
=
append
(
list
,
fmt
.
Sprintf
(
"%s
/
%s"
,
current
,
spec
.
Resource
.
TargetAverageValue
.
String
()))
list
=
append
(
list
,
fmt
.
Sprintf
(
"%s
/
%s"
,
current
,
spec
.
Resource
.
TargetAverageValue
.
String
()))
}
else
{
current
:=
"<unknown>"
if
len
(
statuses
)
>
i
&&
statuses
[
i
]
.
Resource
!=
nil
&&
statuses
[
i
]
.
Resource
.
CurrentAverageUtilization
!=
nil
{
...
...
@@ -1507,7 +1507,7 @@ func formatHPAMetrics(specs []autoscaling.MetricSpec, statuses []autoscaling.Met
if
spec
.
Resource
.
TargetAverageUtilization
!=
nil
{
target
=
fmt
.
Sprintf
(
"%d%%"
,
*
spec
.
Resource
.
TargetAverageUtilization
)
}
list
=
append
(
list
,
fmt
.
Sprintf
(
"%s
/
%s"
,
current
,
target
))
list
=
append
(
list
,
fmt
.
Sprintf
(
"%s
/
%s"
,
current
,
target
))
}
default
:
list
=
append
(
list
,
"<unknown type>"
)
...
...
pkg/printers/internalversion/printers_test.go
View file @
f42f79ed
...
...
@@ -2182,7 +2182,7 @@ func TestPrintHPA(t *testing.T) {
DesiredReplicas
:
5
,
},
},
"some-hpa
\t
ReplicationController/some-rc
\t
<unknown>
/
100m
\t
2
\t
10
\t
4
\t
<unknown>
\n
"
,
"some-hpa
\t
ReplicationController/some-rc
\t
<unknown>
/
100m
\t
2
\t
10
\t
4
\t
<unknown>
\n
"
,
},
// pods source type
{
...
...
@@ -2219,7 +2219,7 @@ func TestPrintHPA(t *testing.T) {
},
},
},
"some-hpa
\t
ReplicationController/some-rc
\t
50m
/
100m
\t
2
\t
10
\t
4
\t
<unknown>
\n
"
,
"some-hpa
\t
ReplicationController/some-rc
\t
50m
/
100m
\t
2
\t
10
\t
4
\t
<unknown>
\n
"
,
},
// object source type (no current)
{
...
...
@@ -2251,7 +2251,7 @@ func TestPrintHPA(t *testing.T) {
DesiredReplicas
:
5
,
},
},
"some-hpa
\t
ReplicationController/some-rc
\t
<unknown>
/
100m
\t
2
\t
10
\t
4
\t
<unknown>
\n
"
,
"some-hpa
\t
ReplicationController/some-rc
\t
<unknown>
/
100m
\t
2
\t
10
\t
4
\t
<unknown>
\n
"
,
},
// object source type
{
...
...
@@ -2296,7 +2296,7 @@ func TestPrintHPA(t *testing.T) {
},
},
},
"some-hpa
\t
ReplicationController/some-rc
\t
50m
/
100m
\t
2
\t
10
\t
4
\t
<unknown>
\n
"
,
"some-hpa
\t
ReplicationController/some-rc
\t
50m
/
100m
\t
2
\t
10
\t
4
\t
<unknown>
\n
"
,
},
// resource source type, targetVal (no current)
{
...
...
@@ -2324,7 +2324,7 @@ func TestPrintHPA(t *testing.T) {
DesiredReplicas
:
5
,
},
},
"some-hpa
\t
ReplicationController/some-rc
\t
<unknown>
/
100m
\t
2
\t
10
\t
4
\t
<unknown>
\n
"
,
"some-hpa
\t
ReplicationController/some-rc
\t
<unknown>
/
100m
\t
2
\t
10
\t
4
\t
<unknown>
\n
"
,
},
// resource source type, targetVal
{
...
...
@@ -2361,7 +2361,7 @@ func TestPrintHPA(t *testing.T) {
},
},
},
"some-hpa
\t
ReplicationController/some-rc
\t
50m
/
100m
\t
2
\t
10
\t
4
\t
<unknown>
\n
"
,
"some-hpa
\t
ReplicationController/some-rc
\t
50m
/
100m
\t
2
\t
10
\t
4
\t
<unknown>
\n
"
,
},
// resource source type, targetUtil (no current)
{
...
...
@@ -2389,7 +2389,7 @@ func TestPrintHPA(t *testing.T) {
DesiredReplicas
:
5
,
},
},
"some-hpa
\t
ReplicationController/some-rc
\t
<unknown>
/
80%
\t
2
\t
10
\t
4
\t
<unknown>
\n
"
,
"some-hpa
\t
ReplicationController/some-rc
\t
<unknown>
/
80%
\t
2
\t
10
\t
4
\t
<unknown>
\n
"
,
},
// resource source type, targetUtil
{
...
...
@@ -2427,7 +2427,7 @@ func TestPrintHPA(t *testing.T) {
},
},
},
"some-hpa
\t
ReplicationController/some-rc
\t
50%
/
80%
\t
2
\t
10
\t
4
\t
<unknown>
\n
"
,
"some-hpa
\t
ReplicationController/some-rc
\t
50%
/
80%
\t
2
\t
10
\t
4
\t
<unknown>
\n
"
,
},
// multiple specs
{
...
...
@@ -2486,7 +2486,7 @@ func TestPrintHPA(t *testing.T) {
},
},
},
"some-hpa
\t
ReplicationController/some-rc
\t
50m
/ 100m, 50% /
80% + 1 more...
\t
2
\t
10
\t
4
\t
<unknown>
\n
"
,
"some-hpa
\t
ReplicationController/some-rc
\t
50m
/100m, 50%/
80% + 1 more...
\t
2
\t
10
\t
4
\t
<unknown>
\n
"
,
},
}
...
...
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