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
d8ee5e00
Unverified
Commit
d8ee5e00
authored
Feb 28, 2017
by
Clayton Coleman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve statefulset describer to include volume templates
parent
39a32a62
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
8 deletions
+28
-8
describe.go
pkg/printers/internalversion/describe.go
+28
-8
No files found.
pkg/printers/internalversion/describe.go
View file @
d8ee5e00
...
@@ -1180,6 +1180,26 @@ func describeStatus(stateName string, state api.ContainerState, w *PrefixWriter)
...
@@ -1180,6 +1180,26 @@ func describeStatus(stateName string, state api.ContainerState, w *PrefixWriter)
}
}
}
}
func
describeVolumeClaimTemplates
(
templates
[]
api
.
PersistentVolumeClaim
,
w
*
PrefixWriter
)
{
if
len
(
templates
)
==
0
{
w
.
Write
(
LEVEL_0
,
"Volume Claims:
\t
<none>
\n
"
)
return
}
w
.
Write
(
LEVEL_0
,
"Volume Claims:
\n
"
)
for
_
,
pvc
:=
range
templates
{
w
.
Write
(
LEVEL_1
,
"Name:
\t
%s
\n
"
,
pvc
.
Name
)
w
.
Write
(
LEVEL_1
,
"StorageClass:
\t
%s
\n
"
,
storageutil
.
GetStorageClassAnnotation
(
pvc
.
ObjectMeta
))
printLabelsMultilineWithIndent
(
w
,
" "
,
"Labels"
,
"
\t
"
,
pvc
.
Labels
,
sets
.
NewString
())
printLabelsMultilineWithIndent
(
w
,
" "
,
"Annotations"
,
"
\t
"
,
pvc
.
Annotations
,
sets
.
NewString
())
if
capacity
,
ok
:=
pvc
.
Spec
.
Resources
.
Requests
[
api
.
ResourceStorage
];
ok
{
w
.
Write
(
LEVEL_1
,
"Capacity:
\t
%s
\n
"
,
capacity
)
}
else
{
w
.
Write
(
LEVEL_1
,
"Capacity:
\t
%s
\n
"
,
"<default>"
)
}
w
.
Write
(
LEVEL_1
,
"Access Modes:
\t
%s
\n
"
,
pvc
.
Spec
.
AccessModes
)
}
}
func
printBoolPtr
(
value
*
bool
)
string
{
func
printBoolPtr
(
value
*
bool
)
string
{
if
value
!=
nil
{
if
value
!=
nil
{
return
printBool
(
*
value
)
return
printBool
(
*
value
)
...
@@ -2081,16 +2101,16 @@ func (p *StatefulSetDescriber) Describe(namespace, name string, describerSetting
...
@@ -2081,16 +2101,16 @@ func (p *StatefulSetDescriber) Describe(namespace, name string, describerSetting
return
tabbedString
(
func
(
out
io
.
Writer
)
error
{
return
tabbedString
(
func
(
out
io
.
Writer
)
error
{
w
:=
&
PrefixWriter
{
out
}
w
:=
&
PrefixWriter
{
out
}
w
.
Write
(
LEVEL_0
,
"Name:
\t
%s
\n
"
,
ps
.
Name
)
w
.
Write
(
LEVEL_0
,
"Name:
\t
%s
\n
"
,
ps
.
ObjectMeta
.
Name
)
w
.
Write
(
LEVEL_0
,
"Namespace:
\t
%s
\n
"
,
ps
.
Namespace
)
w
.
Write
(
LEVEL_0
,
"Namespace:
\t
%s
\n
"
,
ps
.
ObjectMeta
.
Namespace
)
w
.
Write
(
LEVEL_0
,
"Image(s):
\t
%s
\n
"
,
makeImageList
(
&
ps
.
Spec
.
Template
.
Spec
))
w
.
Write
(
LEVEL_0
,
"Selector:
\t
%s
\n
"
,
metav1
.
FormatLabelSelector
(
ps
.
Spec
.
Selector
))
w
.
Write
(
LEVEL_0
,
"Labels:
\t
%s
\n
"
,
labels
.
FormatLabels
(
ps
.
Labels
))
w
.
Write
(
LEVEL_0
,
"Replicas:
\t
%d current / %d desired
\n
"
,
ps
.
Status
.
Replicas
,
ps
.
Spec
.
Replicas
)
w
.
Write
(
LEVEL_0
,
"Annotations:
\t
%s
\n
"
,
labels
.
FormatLabels
(
ps
.
Annotations
))
w
.
Write
(
LEVEL_0
,
"CreationTimestamp:
\t
%s
\n
"
,
ps
.
CreationTimestamp
.
Time
.
Format
(
time
.
RFC1123Z
))
w
.
Write
(
LEVEL_0
,
"CreationTimestamp:
\t
%s
\n
"
,
ps
.
CreationTimestamp
.
Time
.
Format
(
time
.
RFC1123Z
))
w
.
Write
(
LEVEL_0
,
"Selector:
\t
%s
\n
"
,
selector
)
printLabelsMultiline
(
w
,
"Labels"
,
ps
.
Labels
)
printAnnotationsMultiline
(
w
,
"Annotations"
,
ps
.
Annotations
)
w
.
Write
(
LEVEL_0
,
"Replicas:
\t
%d desired | %d total
\n
"
,
ps
.
Spec
.
Replicas
,
ps
.
Status
.
Replicas
)
w
.
Write
(
LEVEL_0
,
"Pods Status:
\t
%d Running / %d Waiting / %d Succeeded / %d Failed
\n
"
,
running
,
waiting
,
succeeded
,
failed
)
w
.
Write
(
LEVEL_0
,
"Pods Status:
\t
%d Running / %d Waiting / %d Succeeded / %d Failed
\n
"
,
running
,
waiting
,
succeeded
,
failed
)
describeVolumes
(
ps
.
Spec
.
Template
.
Spec
.
Volumes
,
w
,
""
)
DescribePodTemplate
(
&
ps
.
Spec
.
Template
,
out
)
describeVolumeClaimTemplates
(
ps
.
Spec
.
VolumeClaimTemplates
,
w
)
if
describerSettings
.
ShowEvents
{
if
describerSettings
.
ShowEvents
{
events
,
_
:=
p
.
client
.
Core
()
.
Events
(
namespace
)
.
Search
(
api
.
Scheme
,
ps
)
events
,
_
:=
p
.
client
.
Core
()
.
Events
(
namespace
)
.
Search
(
api
.
Scheme
,
ps
)
if
events
!=
nil
{
if
events
!=
nil
{
...
...
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