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
c0aa62eb
Commit
c0aa62eb
authored
Aug 14, 2015
by
markturansky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added PersistentVolumeSource to describer output
parent
5dfc904c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
87 additions
and
0 deletions
+87
-0
describe.go
pkg/kubectl/describe.go
+19
-0
describe_test.go
pkg/kubectl/describe_test.go
+68
-0
No files found.
pkg/kubectl/describe.go
View file @
c0aa62eb
...
...
@@ -595,6 +595,25 @@ func (d *PersistentVolumeDescriber) Describe(namespace, name string) (string, er
fmt
.
Fprintf
(
out
,
"Access Modes:
\t
%s
\n
"
,
volume
.
GetAccessModesAsString
(
pv
.
Spec
.
AccessModes
))
fmt
.
Fprintf
(
out
,
"Capacity:
\t
%s
\n
"
,
storage
.
String
())
fmt
.
Fprintf
(
out
,
"Message:
\t
%s
\n
"
,
pv
.
Status
.
Message
)
fmt
.
Fprintf
(
out
,
"Source:
\n
"
)
switch
{
case
pv
.
Spec
.
HostPath
!=
nil
:
printHostPathVolumeSource
(
pv
.
Spec
.
HostPath
,
out
)
case
pv
.
Spec
.
GCEPersistentDisk
!=
nil
:
printGCEPersistentDiskVolumeSource
(
pv
.
Spec
.
GCEPersistentDisk
,
out
)
case
pv
.
Spec
.
AWSElasticBlockStore
!=
nil
:
printAWSElasticBlockStoreVolumeSource
(
pv
.
Spec
.
AWSElasticBlockStore
,
out
)
case
pv
.
Spec
.
NFS
!=
nil
:
printNFSVolumeSource
(
pv
.
Spec
.
NFS
,
out
)
case
pv
.
Spec
.
ISCSI
!=
nil
:
printISCSIVolumeSource
(
pv
.
Spec
.
ISCSI
,
out
)
case
pv
.
Spec
.
Glusterfs
!=
nil
:
printGlusterfsVolumeSource
(
pv
.
Spec
.
Glusterfs
,
out
)
case
pv
.
Spec
.
RBD
!=
nil
:
printRBDVolumeSource
(
pv
.
Spec
.
RBD
,
out
)
}
return
nil
})
}
...
...
pkg/kubectl/describe_test.go
View file @
c0aa62eb
...
...
@@ -411,3 +411,71 @@ func TestGetPodsTotalRequests(t *testing.T) {
}
}
}
func
TestPersistentVolumeDescriber
(
t
*
testing
.
T
)
{
tests
:=
map
[
string
]
*
api
.
PersistentVolume
{
"hostpath"
:
{
Spec
:
api
.
PersistentVolumeSpec
{
PersistentVolumeSource
:
api
.
PersistentVolumeSource
{
HostPath
:
&
api
.
HostPathVolumeSource
{},
},
},
},
"gce"
:
{
Spec
:
api
.
PersistentVolumeSpec
{
PersistentVolumeSource
:
api
.
PersistentVolumeSource
{
GCEPersistentDisk
:
&
api
.
GCEPersistentDiskVolumeSource
{},
},
},
},
"ebs"
:
{
Spec
:
api
.
PersistentVolumeSpec
{
PersistentVolumeSource
:
api
.
PersistentVolumeSource
{
AWSElasticBlockStore
:
&
api
.
AWSElasticBlockStoreVolumeSource
{},
},
},
},
"nfs"
:
{
Spec
:
api
.
PersistentVolumeSpec
{
PersistentVolumeSource
:
api
.
PersistentVolumeSource
{
NFS
:
&
api
.
NFSVolumeSource
{},
},
},
},
"iscsi"
:
{
Spec
:
api
.
PersistentVolumeSpec
{
PersistentVolumeSource
:
api
.
PersistentVolumeSource
{
ISCSI
:
&
api
.
ISCSIVolumeSource
{},
},
},
},
"gluster"
:
{
Spec
:
api
.
PersistentVolumeSpec
{
PersistentVolumeSource
:
api
.
PersistentVolumeSource
{
Glusterfs
:
&
api
.
GlusterfsVolumeSource
{},
},
},
},
"rbd"
:
{
Spec
:
api
.
PersistentVolumeSpec
{
PersistentVolumeSource
:
api
.
PersistentVolumeSource
{
RBD
:
&
api
.
RBDVolumeSource
{},
},
},
},
}
for
name
,
pv
:=
range
tests
{
fake
:=
testclient
.
NewSimpleFake
(
pv
)
c
:=
PersistentVolumeDescriber
{
fake
}
str
,
err
:=
c
.
Describe
(
"foo"
,
"bar"
)
if
err
!=
nil
{
t
.
Errorf
(
"Unexpected error for test %s: %v"
,
name
,
err
)
}
if
str
==
""
{
t
.
Errorf
(
"Unexpected empty string for test %s. Expected PV Describer output"
,
name
)
}
}
}
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