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
b605da25
Commit
b605da25
authored
Oct 20, 2016
by
Chun Chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kubectl describe: show annotations
parent
36a5c009
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
110 additions
and
5 deletions
+110
-5
describe.go
pkg/printers/internalversion/describe.go
+71
-5
describe_test.go
pkg/printers/internalversion/describe_test.go
+34
-0
kubectl.go
test/e2e/kubectl.go
+5
-0
No files found.
pkg/printers/internalversion/describe.go
View file @
b605da25
This diff is collapsed.
Click to expand it.
pkg/printers/internalversion/describe_test.go
View file @
b605da25
...
@@ -1265,3 +1265,37 @@ func TestDescribeEvents(t *testing.T) {
...
@@ -1265,3 +1265,37 @@ func TestDescribeEvents(t *testing.T) {
}
}
}
}
}
}
func
TestPrintLabelsMultiline
(
t
*
testing
.
T
)
{
var
maxLenAnnotationStr
string
=
"MaxLenAnnotation=Multicast addressing can be used in the link layer (Layer 2 in the OSI model), such as Ethernet multicast, and at the internet layer (Layer 3 for OSI) for Internet Protocol Version 4 "
testCases
:=
[]
struct
{
annotations
map
[
string
]
string
expectPrint
string
}{
{
annotations
:
map
[
string
]
string
{
"col1"
:
"asd"
,
"COL2"
:
"zxc"
},
expectPrint
:
"Annotations:
\t
COL2=zxc
\n\t
col1=asd
\n
"
,
},
{
annotations
:
map
[
string
]
string
{
"MaxLenAnnotation"
:
maxLenAnnotationStr
[
17
:
]},
expectPrint
:
"Annotations:
\t
"
+
maxLenAnnotationStr
+
"
\n
"
,
},
{
annotations
:
map
[
string
]
string
{
"MaxLenAnnotation"
:
maxLenAnnotationStr
[
17
:
]
+
"1"
},
expectPrint
:
"Annotations:
\t
"
+
maxLenAnnotationStr
+
"...
\n
"
,
},
{
annotations
:
map
[
string
]
string
{},
expectPrint
:
"Annotations:
\t
<none>
\n
"
,
},
}
for
i
,
testCase
:=
range
testCases
{
out
:=
new
(
bytes
.
Buffer
)
writer
:=
&
PrefixWriter
{
out
}
printAnnotationsMultiline
(
writer
,
"Annotations"
,
testCase
.
annotations
)
output
:=
out
.
String
()
if
output
!=
testCase
.
expectPrint
{
t
.
Errorf
(
"Test case %d: expected to find %q in output: %q"
,
i
,
testCase
.
expectPrint
,
output
)
}
}
}
test/e2e/kubectl.go
View file @
b605da25
...
@@ -718,6 +718,7 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
...
@@ -718,6 +718,7 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
{
"Node:"
},
{
"Node:"
},
{
"Labels:"
,
"app=redis"
},
{
"Labels:"
,
"app=redis"
},
{
"role=master"
},
{
"role=master"
},
{
"Annotations:"
},
{
"Status:"
,
"Running"
},
{
"Status:"
,
"Running"
},
{
"IP:"
},
{
"IP:"
},
{
"Controllers:"
,
"ReplicationController/redis-master"
},
{
"Controllers:"
,
"ReplicationController/redis-master"
},
...
@@ -737,6 +738,7 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
...
@@ -737,6 +738,7 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
{
"Selector:"
,
"app=redis,role=master"
},
{
"Selector:"
,
"app=redis,role=master"
},
{
"Labels:"
,
"app=redis"
},
{
"Labels:"
,
"app=redis"
},
{
"role=master"
},
{
"role=master"
},
{
"Annotations:"
},
{
"Replicas:"
,
"1 current"
,
"1 desired"
},
{
"Replicas:"
,
"1 current"
,
"1 desired"
},
{
"Pods Status:"
,
"1 Running"
,
"0 Waiting"
,
"0 Succeeded"
,
"0 Failed"
},
{
"Pods Status:"
,
"1 Running"
,
"0 Waiting"
,
"0 Succeeded"
,
"0 Failed"
},
// {"Events:"} would ordinarily go in the list
// {"Events:"} would ordinarily go in the list
...
@@ -754,6 +756,7 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
...
@@ -754,6 +756,7 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
{
"Namespace:"
,
ns
},
{
"Namespace:"
,
ns
},
{
"Labels:"
,
"app=redis"
},
{
"Labels:"
,
"app=redis"
},
{
"role=master"
},
{
"role=master"
},
{
"Annotations:"
},
{
"Selector:"
,
"app=redis"
,
"role=master"
},
{
"Selector:"
,
"app=redis"
,
"role=master"
},
{
"Type:"
,
"ClusterIP"
},
{
"Type:"
,
"ClusterIP"
},
{
"IP:"
},
{
"IP:"
},
...
@@ -771,6 +774,7 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
...
@@ -771,6 +774,7 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
requiredStrings
=
[][]
string
{
requiredStrings
=
[][]
string
{
{
"Name:"
,
node
.
Name
},
{
"Name:"
,
node
.
Name
},
{
"Labels:"
},
{
"Labels:"
},
{
"Annotations:"
},
{
"CreationTimestamp:"
},
{
"CreationTimestamp:"
},
{
"Conditions:"
},
{
"Conditions:"
},
{
"Type"
,
"Status"
,
"LastHeartbeatTime"
,
"LastTransitionTime"
,
"Reason"
,
"Message"
},
{
"Type"
,
"Status"
,
"LastHeartbeatTime"
,
"LastTransitionTime"
,
"Reason"
,
"Message"
},
...
@@ -790,6 +794,7 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
...
@@ -790,6 +794,7 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
requiredStrings
=
[][]
string
{
requiredStrings
=
[][]
string
{
{
"Name:"
,
ns
},
{
"Name:"
,
ns
},
{
"Labels:"
},
{
"Labels:"
},
{
"Annotations:"
},
{
"Status:"
,
"Active"
}}
{
"Status:"
,
"Active"
}}
checkOutput
(
output
,
requiredStrings
)
checkOutput
(
output
,
requiredStrings
)
...
...
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