mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
Merge pull request #51637 from mtanino/issue/51635
Automatic merge from submit-queue (batch tested with PRs 51628, 51637, 51490, 51279, 51302) Fix printISCSIVolumeSource to show kubectl describe properly **What this PR does / why we need it**: After merging #51189, 'kubectl describe' doesn't show persistent volume properly if the volume is iSCSI. This PR fixes the problem. **Which issue this PR fixes** : Fixes #51635 **Special notes for your reviewer**: Result without InitiatorName. ``` % k describe pv pv0001 Name: pv0001 Labels: <none> Annotations: volume.beta.kubernetes.io/storage-class=slow StorageClass: slow Status: Available Claim: Reclaim Policy: Recycle Access Modes: RWO Capacity: 1Gi Message: Source: Type: ISCSI (an ISCSI Disk resource that is attached to a kubelet's host machine and then exposed to the pod) TargetPortal: 192.168.122.85:3260 IQN: iqn.2017-05.com.example:rhel7 Lun: 0 ISCSIInterface default FSType: ext4 ReadOnly: true Portals: [192.168.122.7:3260] DiscoveryCHAPAuth: false SessionCHAPAuth: false SecretRef: <nil> InitiatorName: <none> Events: <none> ``` Result with InitiatorName. ``` % k describe pv pv0001 Name: pv0001 Labels: <none> Annotations: volume.beta.kubernetes.io/storage-class=slow StorageClass: slow Status: Available Claim: Reclaim Policy: Recycle Access Modes: RWO Capacity: 1Gi Message: Source: Type: ISCSI (an ISCSI Disk resource that is attached to a kubelet's host machine and then exposed to the pod) TargetPortal: 192.168.122.85:3260 IQN: iqn.2017-05.com.example:rhel7 Lun: 0 ISCSIInterface default FSType: ext4 ReadOnly: true Portals: [192.168.122.7:3260] DiscoveryCHAPAuth: false SessionCHAPAuth: false SecretRef: <nil> InitiatorName: iqn.1994-05.com.redhat:185ce16b55ad Events: <none> ``` @rootfs @humblec @jsafrane **Release note**: ``` NONE ```
This commit is contained in:
commit
c67b57d4c8
@ -835,6 +835,10 @@ func printPortworxVolumeSource(pwxVolume *api.PortworxVolumeSource, w PrefixWrit
|
||||
}
|
||||
|
||||
func printISCSIVolumeSource(iscsi *api.ISCSIVolumeSource, w PrefixWriter) {
|
||||
initiator := "<none>"
|
||||
if iscsi.InitiatorName != nil {
|
||||
initiator = *iscsi.InitiatorName
|
||||
}
|
||||
w.Write(LEVEL_2, "Type:\tISCSI (an ISCSI Disk resource that is attached to a kubelet's host machine and then exposed to the pod)\n"+
|
||||
" TargetPortal:\t%v\n"+
|
||||
" IQN:\t%v\n"+
|
||||
@ -845,9 +849,9 @@ func printISCSIVolumeSource(iscsi *api.ISCSIVolumeSource, w PrefixWriter) {
|
||||
" Portals:\t%v\n"+
|
||||
" DiscoveryCHAPAuth:\t%v\n"+
|
||||
" SessionCHAPAuth:\t%v\n"+
|
||||
" SecretRef:\t%v\n",
|
||||
" SecretRef:\t%v\n"+
|
||||
" InitiatorName:\t%v\n",
|
||||
iscsi.TargetPortal, iscsi.IQN, iscsi.Lun, iscsi.ISCSIInterface, iscsi.FSType, iscsi.ReadOnly, iscsi.Portals, iscsi.DiscoveryCHAPAuth, iscsi.SessionCHAPAuth, iscsi.SecretRef, iscsi.InitiatorName)
|
||||
iscsi.TargetPortal, iscsi.IQN, iscsi.Lun, iscsi.ISCSIInterface, iscsi.FSType, iscsi.ReadOnly, iscsi.Portals, iscsi.DiscoveryCHAPAuth, iscsi.SessionCHAPAuth, iscsi.SecretRef, initiator)
|
||||
}
|
||||
|
||||
func printGlusterfsVolumeSource(glusterfs *api.GlusterfsVolumeSource, w PrefixWriter) {
|
||||
|
Loading…
Reference in New Issue
Block a user