Merge pull request #76463 from j-griffith/add_datasource_to_pvc_describe
Add DataSource to PVC describe Kubernetes-commit: 9dad928e6ba1d7cf8b67a9f401775d2c8b71a2d0
This commit is contained in:
commit
03b90549ea
|
|
@ -488,7 +488,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/client-go",
|
"ImportPath": "k8s.io/client-go",
|
||||||
"Rev": "48bc0598fd18"
|
"Rev": "7eecfc25a0aa"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/code-generator",
|
"ImportPath": "k8s.io/code-generator",
|
||||||
|
|
|
||||||
4
go.mod
4
go.mod
|
|
@ -38,7 +38,7 @@ require (
|
||||||
k8s.io/api v0.0.0-20190813220811-3b2b5017183f
|
k8s.io/api v0.0.0-20190813220811-3b2b5017183f
|
||||||
k8s.io/apimachinery v0.0.0-20190813220643-cbbcc3bf2cd4
|
k8s.io/apimachinery v0.0.0-20190813220643-cbbcc3bf2cd4
|
||||||
k8s.io/cli-runtime v0.0.0-20190813222619-2ebd228d24a6
|
k8s.io/cli-runtime v0.0.0-20190813222619-2ebd228d24a6
|
||||||
k8s.io/client-go v0.0.0-20190813221021-48bc0598fd18
|
k8s.io/client-go v0.0.0-20190813221022-7eecfc25a0aa
|
||||||
k8s.io/component-base v0.0.0-20190813221503-3e62d79579c8
|
k8s.io/component-base v0.0.0-20190813221503-3e62d79579c8
|
||||||
k8s.io/klog v0.4.0
|
k8s.io/klog v0.4.0
|
||||||
k8s.io/kube-openapi v0.0.0-20190709113604-33be087ad058
|
k8s.io/kube-openapi v0.0.0-20190709113604-33be087ad058
|
||||||
|
|
@ -58,7 +58,7 @@ replace (
|
||||||
k8s.io/api => k8s.io/api v0.0.0-20190813220811-3b2b5017183f
|
k8s.io/api => k8s.io/api v0.0.0-20190813220811-3b2b5017183f
|
||||||
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20190813220643-cbbcc3bf2cd4
|
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20190813220643-cbbcc3bf2cd4
|
||||||
k8s.io/cli-runtime => k8s.io/cli-runtime v0.0.0-20190813222619-2ebd228d24a6
|
k8s.io/cli-runtime => k8s.io/cli-runtime v0.0.0-20190813222619-2ebd228d24a6
|
||||||
k8s.io/client-go => k8s.io/client-go v0.0.0-20190813221021-48bc0598fd18
|
k8s.io/client-go => k8s.io/client-go v0.0.0-20190813221022-7eecfc25a0aa
|
||||||
k8s.io/code-generator => k8s.io/code-generator v0.0.0-20190813220511-4e023f69fd57
|
k8s.io/code-generator => k8s.io/code-generator v0.0.0-20190813220511-4e023f69fd57
|
||||||
k8s.io/component-base => k8s.io/component-base v0.0.0-20190813221503-3e62d79579c8
|
k8s.io/component-base => k8s.io/component-base v0.0.0-20190813221503-3e62d79579c8
|
||||||
k8s.io/metrics => k8s.io/metrics v0.0.0-20190813222520-1d09d7caf6df
|
k8s.io/metrics => k8s.io/metrics v0.0.0-20190813222520-1d09d7caf6df
|
||||||
|
|
|
||||||
2
go.sum
2
go.sum
|
|
@ -226,7 +226,7 @@ gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81
|
||||||
k8s.io/api v0.0.0-20190813220811-3b2b5017183f/go.mod h1:jQ/7CcVOYUjK7L7XC7+yxtZdjG6mm61Bmv9LU2K7M7c=
|
k8s.io/api v0.0.0-20190813220811-3b2b5017183f/go.mod h1:jQ/7CcVOYUjK7L7XC7+yxtZdjG6mm61Bmv9LU2K7M7c=
|
||||||
k8s.io/apimachinery v0.0.0-20190813220643-cbbcc3bf2cd4/go.mod h1:1Bb79pEWnDgUBI8vkD0vaOot2IDbQD8ONqOd66wgvlM=
|
k8s.io/apimachinery v0.0.0-20190813220643-cbbcc3bf2cd4/go.mod h1:1Bb79pEWnDgUBI8vkD0vaOot2IDbQD8ONqOd66wgvlM=
|
||||||
k8s.io/cli-runtime v0.0.0-20190813222619-2ebd228d24a6/go.mod h1:L4TG0tBLdYPqShnKh5j7/UPDIp9YSQwzA5rPSNvVSzA=
|
k8s.io/cli-runtime v0.0.0-20190813222619-2ebd228d24a6/go.mod h1:L4TG0tBLdYPqShnKh5j7/UPDIp9YSQwzA5rPSNvVSzA=
|
||||||
k8s.io/client-go v0.0.0-20190813221021-48bc0598fd18/go.mod h1:PRnhdyP0dDkcB8IUDIQ60Y8JMgtT8ekSpfD8y4OWYB0=
|
k8s.io/client-go v0.0.0-20190813221022-7eecfc25a0aa/go.mod h1:PRnhdyP0dDkcB8IUDIQ60Y8JMgtT8ekSpfD8y4OWYB0=
|
||||||
k8s.io/code-generator v0.0.0-20190813220511-4e023f69fd57/go.mod h1:LcwT1+yrqAoSbSGAn8xQhspc2Ks9BDeMl+amsO1Itbs=
|
k8s.io/code-generator v0.0.0-20190813220511-4e023f69fd57/go.mod h1:LcwT1+yrqAoSbSGAn8xQhspc2Ks9BDeMl+amsO1Itbs=
|
||||||
k8s.io/component-base v0.0.0-20190813221503-3e62d79579c8/go.mod h1:ErYFdqU7q+0gcmr804no7o0xvnPZTM/kgDGK3kY1tSY=
|
k8s.io/component-base v0.0.0-20190813221503-3e62d79579c8/go.mod h1:ErYFdqU7q+0gcmr804no7o0xvnPZTM/kgDGK3kY1tSY=
|
||||||
k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
|
k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
|
||||||
|
|
|
||||||
|
|
@ -1534,6 +1534,11 @@ func describePersistentVolumeClaim(pvc *corev1.PersistentVolumeClaim, events *co
|
||||||
if pvc.Spec.VolumeMode != nil {
|
if pvc.Spec.VolumeMode != nil {
|
||||||
w.Write(LEVEL_0, "VolumeMode:\t%v\n", *pvc.Spec.VolumeMode)
|
w.Write(LEVEL_0, "VolumeMode:\t%v\n", *pvc.Spec.VolumeMode)
|
||||||
}
|
}
|
||||||
|
if pvc.Spec.DataSource != nil {
|
||||||
|
w.Write(LEVEL_0, "DataSource:\n")
|
||||||
|
w.Write(LEVEL_1, "Name:\t%v\n", pvc.Spec.DataSource.Name)
|
||||||
|
w.Write(LEVEL_1, "Kind:\t%v\n", pvc.Spec.DataSource.Kind)
|
||||||
|
}
|
||||||
printPodsMultiline(w, "Mounted By", mountPods)
|
printPodsMultiline(w, "Mounted By", mountPods)
|
||||||
|
|
||||||
if len(pvc.Status.Conditions) > 0 {
|
if len(pvc.Status.Conditions) > 0 {
|
||||||
|
|
|
||||||
|
|
@ -1306,6 +1306,7 @@ func TestPersistentVolumeClaimDescriber(t *testing.T) {
|
||||||
goldClassName := "gold"
|
goldClassName := "gold"
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
deletionTimestamp := metav1.Time{Time: time.Now().UTC().AddDate(-10, 0, 0)}
|
deletionTimestamp := metav1.Time{Time: time.Now().UTC().AddDate(-10, 0, 0)}
|
||||||
|
snapshotAPIGroup := "snapshot.storage.k8s.io"
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
name string
|
name string
|
||||||
pvc *corev1.PersistentVolumeClaim
|
pvc *corev1.PersistentVolumeClaim
|
||||||
|
|
@ -1469,6 +1470,45 @@ func TestPersistentVolumeClaimDescriber(t *testing.T) {
|
||||||
},
|
},
|
||||||
expectedElements: []string{"Terminating (lasts 10y)"},
|
expectedElements: []string{"Terminating (lasts 10y)"},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "pvc-datasource",
|
||||||
|
pvc: &corev1.PersistentVolumeClaim{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
Namespace: "foo",
|
||||||
|
Name: "bar",
|
||||||
|
},
|
||||||
|
Spec: corev1.PersistentVolumeClaimSpec{
|
||||||
|
VolumeName: "volume10",
|
||||||
|
StorageClassName: &goldClassName,
|
||||||
|
DataSource: &corev1.TypedLocalObjectReference{
|
||||||
|
Name: "srcpvc",
|
||||||
|
Kind: "PersistentVolumeClaim",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Status: corev1.PersistentVolumeClaimStatus{},
|
||||||
|
},
|
||||||
|
expectedElements: []string{"\nDataSource:\n Name: srcpvc\n Kind: PersistentVolumeClaim"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "snapshot-datasource",
|
||||||
|
pvc: &corev1.PersistentVolumeClaim{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
Namespace: "foo",
|
||||||
|
Name: "bar",
|
||||||
|
},
|
||||||
|
Spec: corev1.PersistentVolumeClaimSpec{
|
||||||
|
VolumeName: "volume10",
|
||||||
|
StorageClassName: &goldClassName,
|
||||||
|
DataSource: &corev1.TypedLocalObjectReference{
|
||||||
|
Name: "src-snapshot",
|
||||||
|
Kind: "VolumeSnapshot",
|
||||||
|
APIGroup: &snapshotAPIGroup,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Status: corev1.PersistentVolumeClaimStatus{},
|
||||||
|
},
|
||||||
|
expectedElements: []string{"DataSource:\n Name: src-snapshot\n Kind: VolumeSnapshot\n"},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
|
|
@ -3090,6 +3130,12 @@ func TestDescribeStatefulSet(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// boolPtr returns a pointer to a bool
|
||||||
|
func boolPtr(b bool) *bool {
|
||||||
|
o := b
|
||||||
|
return &o
|
||||||
|
}
|
||||||
|
|
||||||
func TestControllerRef(t *testing.T) {
|
func TestControllerRef(t *testing.T) {
|
||||||
var replicas int32 = 1
|
var replicas int32 = 1
|
||||||
f := fake.NewSimpleClientset(
|
f := fake.NewSimpleClientset(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue