mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
convert EndpointNamespace showing string rather than pointer
Signed-off-by: Zou Nengren <zouyee1989@gmail.com>
This commit is contained in:
parent
47e78f3de5
commit
96928b9f8b
@ -997,12 +997,16 @@ func printGlusterfsVolumeSource(glusterfs *corev1.GlusterfsVolumeSource, w Prefi
|
|||||||
}
|
}
|
||||||
|
|
||||||
func printGlusterfsPersistentVolumeSource(glusterfs *corev1.GlusterfsPersistentVolumeSource, w PrefixWriter) {
|
func printGlusterfsPersistentVolumeSource(glusterfs *corev1.GlusterfsPersistentVolumeSource, w PrefixWriter) {
|
||||||
|
endpointsNamespace := "<unset>"
|
||||||
|
if glusterfs.EndpointsNamespace != nil {
|
||||||
|
endpointsNamespace = *glusterfs.EndpointsNamespace
|
||||||
|
}
|
||||||
w.Write(LEVEL_2, "Type:\tGlusterfs (a Glusterfs mount on the host that shares a pod's lifetime)\n"+
|
w.Write(LEVEL_2, "Type:\tGlusterfs (a Glusterfs mount on the host that shares a pod's lifetime)\n"+
|
||||||
" EndpointsName:\t%v\n"+
|
" EndpointsName:\t%v\n"+
|
||||||
" EndpointsNamespace:\t%v\n"+
|
" EndpointsNamespace:\t%v\n"+
|
||||||
" Path:\t%v\n"+
|
" Path:\t%v\n"+
|
||||||
" ReadOnly:\t%v\n",
|
" ReadOnly:\t%v\n",
|
||||||
glusterfs.EndpointsName, glusterfs.EndpointsNamespace, glusterfs.Path, glusterfs.ReadOnly)
|
glusterfs.EndpointsName, endpointsNamespace, glusterfs.Path, glusterfs.ReadOnly)
|
||||||
}
|
}
|
||||||
|
|
||||||
func printPersistentVolumeClaimVolumeSource(claim *corev1.PersistentVolumeClaimVolumeSource, w PrefixWriter) {
|
func printPersistentVolumeClaimVolumeSource(claim *corev1.PersistentVolumeClaimVolumeSource, w PrefixWriter) {
|
||||||
|
@ -937,6 +937,7 @@ func TestGetPodsTotalRequests(t *testing.T) {
|
|||||||
func TestPersistentVolumeDescriber(t *testing.T) {
|
func TestPersistentVolumeDescriber(t *testing.T) {
|
||||||
block := corev1.PersistentVolumeBlock
|
block := corev1.PersistentVolumeBlock
|
||||||
file := corev1.PersistentVolumeFilesystem
|
file := corev1.PersistentVolumeFilesystem
|
||||||
|
foo := "glusterfsendpointname"
|
||||||
deletionTimestamp := metav1.Time{Time: time.Now().UTC().AddDate(-10, 0, 0)}
|
deletionTimestamp := metav1.Time{Time: time.Now().UTC().AddDate(-10, 0, 0)}
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
name string
|
name string
|
||||||
@ -1023,6 +1024,7 @@ func TestPersistentVolumeDescriber(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
expectedElements: []string{"EndpointsNamespace", "<unset>"},
|
||||||
unexpectedElements: []string{"VolumeMode", "Filesystem"},
|
unexpectedElements: []string{"VolumeMode", "Filesystem"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1273,6 +1275,22 @@ func TestPersistentVolumeDescriber(t *testing.T) {
|
|||||||
},
|
},
|
||||||
expectedElements: []string{"Driver", "VolumeHandle", "ReadOnly", "VolumeAttributes"},
|
expectedElements: []string{"Driver", "VolumeHandle", "ReadOnly", "VolumeAttributes"},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "test19",
|
||||||
|
plugin: "gluster",
|
||||||
|
pv: &corev1.PersistentVolume{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{Name: "bar"},
|
||||||
|
Spec: corev1.PersistentVolumeSpec{
|
||||||
|
PersistentVolumeSource: corev1.PersistentVolumeSource{
|
||||||
|
Glusterfs: &corev1.GlusterfsPersistentVolumeSource{
|
||||||
|
EndpointsNamespace: &foo,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
expectedElements: []string{"EndpointsNamespace", "glusterfsendpointname"},
|
||||||
|
unexpectedElements: []string{"VolumeMode", "Filesystem"},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
|
Loading…
Reference in New Issue
Block a user