mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
Merge pull request #81554 from zouyee/ctl
convert EndpointNamespace showing string rather than pointer
This commit is contained in:
commit
0ba470db37
@ -997,12 +997,16 @@ func printGlusterfsVolumeSource(glusterfs *corev1.GlusterfsVolumeSource, w Prefi
|
||||
}
|
||||
|
||||
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"+
|
||||
" EndpointsName:\t%v\n"+
|
||||
" EndpointsNamespace:\t%v\n"+
|
||||
" Path:\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) {
|
||||
|
@ -937,6 +937,7 @@ func TestGetPodsTotalRequests(t *testing.T) {
|
||||
func TestPersistentVolumeDescriber(t *testing.T) {
|
||||
block := corev1.PersistentVolumeBlock
|
||||
file := corev1.PersistentVolumeFilesystem
|
||||
foo := "glusterfsendpointname"
|
||||
deletionTimestamp := metav1.Time{Time: time.Now().UTC().AddDate(-10, 0, 0)}
|
||||
testCases := []struct {
|
||||
name string
|
||||
@ -1023,6 +1024,7 @@ func TestPersistentVolumeDescriber(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
expectedElements: []string{"EndpointsNamespace", "<unset>"},
|
||||
unexpectedElements: []string{"VolumeMode", "Filesystem"},
|
||||
},
|
||||
{
|
||||
@ -1273,6 +1275,22 @@ func TestPersistentVolumeDescriber(t *testing.T) {
|
||||
},
|
||||
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 {
|
||||
|
Loading…
Reference in New Issue
Block a user