Skip to content

Commit

Permalink
remove iscsi portals
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmyseto committed Sep 22, 2020
1 parent a8ec6fc commit 28560d4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 20 deletions.
2 changes: 1 addition & 1 deletion docs/persistentvolume-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
| kube_persistentvolume_capacity_bytes | Gauge | `persistentvolume`=<pv-name> | STABLE |
| kube_persistentvolume_status_phase | Gauge | `persistentvolume`=&lt;pv-name&gt; <br>`phase`=&lt;Bound\|Failed\|Pending\|Available\|Released&gt;| STABLE |
| kube_persistentvolume_labels | Gauge | `persistentvolume`=&lt;persistentvolume-name&gt; <br> `label_PERSISTENTVOLUME_LABEL`=&lt;PERSISTENTVOLUME_LABEL&gt; | STABLE |
| kube_persistentvolume_info | Gauge | `persistentvolume`=&lt;pv-name&gt; <br> `storageclass`=&lt;storageclass-name&gt; <br> `gce_persistent_disk_name`=&lt;pd-name&gt; <br> `ebs_volume_id`=&lt;ebs-volume-id&gt; <br> `fc_wwids`=&lt;fc-wwids-comma-separated&gt; <br> `fc_lun`=&lt;fc-lun&gt; <br> `fc_target_wwns`=&lt;fc-target-wwns-comma-separated&gt; <br> `iscsi_target_portal`=&lt;iscsi-target-portal&gt; <br> `iscsi_iqn`=&lt;iscsi-iqn&gt; <br> `iscsi_lun`=&lt;iscsi-lun&gt; <br> `iscsi_initiator_name`=&lt;iscsi-initiator-name&gt; <br> `iscsi_portals`=&lt;iscsi-portals-comma-separated&gt; <br> `nfs_server`=&lt;nfs-server&gt; <br> `nfs_path`=&lt;nfs-path&gt; | STABLE |
| kube_persistentvolume_info | Gauge | `persistentvolume`=&lt;pv-name&gt; <br> `storageclass`=&lt;storageclass-name&gt; <br> `gce_persistent_disk_name`=&lt;pd-name&gt; <br> `ebs_volume_id`=&lt;ebs-volume-id&gt; <br> `fc_wwids`=&lt;fc-wwids-comma-separated&gt; <br> `fc_lun`=&lt;fc-lun&gt; <br> `fc_target_wwns`=&lt;fc-target-wwns-comma-separated&gt; <br> `iscsi_target_portal`=&lt;iscsi-target-portal&gt; <br> `iscsi_iqn`=&lt;iscsi-iqn&gt; <br> `iscsi_lun`=&lt;iscsi-lun&gt; <br> `iscsi_initiator_name`=&lt;iscsi-initiator-name&gt; <br> `nfs_server`=&lt;nfs-server&gt; <br> `nfs_path`=&lt;nfs-path&gt; | STABLE |

10 changes: 1 addition & 9 deletions internal/store/persistentvolume.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ var (
metric.Gauge,
"",
wrapPersistentVolumeFunc(func(p *v1.PersistentVolume) *metric.Family {
var gcePDDiskName, ebsVolumeID, fcWWIDs, fcLun, fcTargetWWNs, iscsiTargetPortal, iscsiIQN, iscsiLun, iscsiInitiatorName, iscsiPortals, nfsServer, nfsPath string
var gcePDDiskName, ebsVolumeID, fcWWIDs, fcLun, fcTargetWWNs, iscsiTargetPortal, iscsiIQN, iscsiLun, iscsiInitiatorName, nfsServer, nfsPath string

switch {
case p.Spec.PersistentVolumeSource.GCEPersistentDisk != nil:
Expand Down Expand Up @@ -138,12 +138,6 @@ var (
if p.Spec.PersistentVolumeSource.ISCSI.InitiatorName != nil {
iscsiInitiatorName = *p.Spec.PersistentVolumeSource.ISCSI.InitiatorName
}
for _, portal := range p.Spec.PersistentVolumeSource.ISCSI.Portals {
if len(iscsiPortals) != 0 {
iscsiPortals += ","
}
iscsiPortals += portal
}
case p.Spec.PersistentVolumeSource.NFS != nil:
nfsServer = p.Spec.PersistentVolumeSource.NFS.Server
nfsPath = p.Spec.PersistentVolumeSource.NFS.Path
Expand All @@ -163,7 +157,6 @@ var (
"iscsi_iqn",
"iscsi_lun",
"iscsi_initiator_name",
"iscsi_portals",
"nfs_server",
"nfs_path",
},
Expand All @@ -178,7 +171,6 @@ var (
iscsiIQN,
iscsiLun,
iscsiInitiatorName,
iscsiPortals,
nfsServer,
nfsPath,
},
Expand Down
19 changes: 9 additions & 10 deletions internal/store/persistentvolume_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func TestPersistentVolumeStore(t *testing.T) {
Want: `
# HELP kube_persistentvolume_info Information about persistentvolume.
# TYPE kube_persistentvolume_info gauge
kube_persistentvolume_info{ebs_volume_id="",fc_lun="",fc_target_wwns="",fc_wwids="",gce_persistent_disk_name="",iscsi_initiator_name="",iscsi_iqn="",iscsi_lun="",iscsi_portals="",iscsi_target_portal="",nfs_path="",nfs_server="",persistentvolume="test-pv-available",storageclass=""} 1
kube_persistentvolume_info{ebs_volume_id="",fc_lun="",fc_target_wwns="",fc_wwids="",gce_persistent_disk_name="",iscsi_initiator_name="",iscsi_iqn="",iscsi_lun="",iscsi_target_portal="",nfs_path="",nfs_server="",persistentvolume="test-pv-available",storageclass=""} 1
`,
MetricNames: []string{"kube_persistentvolume_info"},
},
Expand All @@ -189,7 +189,7 @@ func TestPersistentVolumeStore(t *testing.T) {
Want: `
# HELP kube_persistentvolume_info Information about persistentvolume.
# TYPE kube_persistentvolume_info gauge
kube_persistentvolume_info{ebs_volume_id="",fc_lun="",fc_target_wwns="",fc_wwids="",gce_persistent_disk_name="",iscsi_initiator_name="",iscsi_iqn="",iscsi_lun="",iscsi_portals="",iscsi_target_portal="",nfs_path="",nfs_server="",persistentvolume="test-pv-available",storageclass=""} 1
kube_persistentvolume_info{ebs_volume_id="",fc_lun="",fc_target_wwns="",fc_wwids="",gce_persistent_disk_name="",iscsi_initiator_name="",iscsi_iqn="",iscsi_lun="",iscsi_target_portal="",nfs_path="",nfs_server="",persistentvolume="test-pv-available",storageclass=""} 1
`,
MetricNames: []string{"kube_persistentvolume_info"},
},
Expand All @@ -212,7 +212,7 @@ func TestPersistentVolumeStore(t *testing.T) {
Want: `
# HELP kube_persistentvolume_info Information about persistentvolume.
# TYPE kube_persistentvolume_info gauge
kube_persistentvolume_info{ebs_volume_id="",fc_lun="",fc_target_wwns="",fc_wwids="",gce_persistent_disk_name="name",iscsi_initiator_name="",iscsi_iqn="",iscsi_lun="",iscsi_portals="",iscsi_target_portal="",nfs_path="",nfs_server="",persistentvolume="test-pv-available",storageclass=""} 1
kube_persistentvolume_info{ebs_volume_id="",fc_lun="",fc_target_wwns="",fc_wwids="",gce_persistent_disk_name="name",iscsi_initiator_name="",iscsi_iqn="",iscsi_lun="",iscsi_target_portal="",nfs_path="",nfs_server="",persistentvolume="test-pv-available",storageclass=""} 1
`,
MetricNames: []string{"kube_persistentvolume_info"},
},
Expand All @@ -235,7 +235,7 @@ func TestPersistentVolumeStore(t *testing.T) {
Want: `
# HELP kube_persistentvolume_info Information about persistentvolume.
# TYPE kube_persistentvolume_info gauge
kube_persistentvolume_info{ebs_volume_id="aws://eu-west-1c/vol-012d34d567890123b",fc_lun="",fc_target_wwns="",fc_wwids="",gce_persistent_disk_name="",iscsi_initiator_name="",iscsi_iqn="",iscsi_lun="",iscsi_portals="",iscsi_target_portal="",nfs_path="",nfs_server="",persistentvolume="test-pv-available",storageclass=""} 1
kube_persistentvolume_info{ebs_volume_id="aws://eu-west-1c/vol-012d34d567890123b",fc_lun="",fc_target_wwns="",fc_wwids="",gce_persistent_disk_name="",iscsi_initiator_name="",iscsi_iqn="",iscsi_lun="",iscsi_target_portal="",nfs_path="",nfs_server="",persistentvolume="test-pv-available",storageclass=""} 1
`,
MetricNames: []string{"kube_persistentvolume_info"},
},
Expand All @@ -259,7 +259,7 @@ func TestPersistentVolumeStore(t *testing.T) {
Want: `
# HELP kube_persistentvolume_info Information about persistentvolume.
# TYPE kube_persistentvolume_info gauge
kube_persistentvolume_info{ebs_volume_id="",fc_lun="123",fc_target_wwns="0123456789abcdef,abcdef0123456789",fc_wwids="",gce_persistent_disk_name="",iscsi_initiator_name="",iscsi_iqn="",iscsi_lun="",iscsi_portals="",iscsi_target_portal="",nfs_path="",nfs_server="",persistentvolume="test-pv-available",storageclass=""} 1
kube_persistentvolume_info{ebs_volume_id="",fc_lun="123",fc_target_wwns="0123456789abcdef,abcdef0123456789",fc_wwids="",gce_persistent_disk_name="",iscsi_initiator_name="",iscsi_iqn="",iscsi_lun="",iscsi_target_portal="",nfs_path="",nfs_server="",persistentvolume="test-pv-available",storageclass=""} 1
`,
MetricNames: []string{"kube_persistentvolume_info"},
},
Expand All @@ -282,7 +282,7 @@ func TestPersistentVolumeStore(t *testing.T) {
Want: `
# HELP kube_persistentvolume_info Information about persistentvolume.
# TYPE kube_persistentvolume_info gauge
kube_persistentvolume_info{ebs_volume_id="",fc_lun="",fc_target_wwns="",fc_wwids="0123456789abcdef,abcdef0123456789",gce_persistent_disk_name="",iscsi_initiator_name="",iscsi_iqn="",iscsi_lun="",iscsi_portals="",iscsi_target_portal="",nfs_path="",nfs_server="",persistentvolume="test-pv-available",storageclass=""} 1
kube_persistentvolume_info{ebs_volume_id="",fc_lun="",fc_target_wwns="",fc_wwids="0123456789abcdef,abcdef0123456789",gce_persistent_disk_name="",iscsi_initiator_name="",iscsi_iqn="",iscsi_lun="",iscsi_target_portal="",nfs_path="",nfs_server="",persistentvolume="test-pv-available",storageclass=""} 1
`,
MetricNames: []string{"kube_persistentvolume_info"},
},
Expand All @@ -307,7 +307,7 @@ func TestPersistentVolumeStore(t *testing.T) {
Want: `
# HELP kube_persistentvolume_info Information about persistentvolume.
# TYPE kube_persistentvolume_info gauge
kube_persistentvolume_info{ebs_volume_id="",fc_lun="",fc_target_wwns="",fc_wwids="",gce_persistent_disk_name="",iscsi_initiator_name="",iscsi_iqn="iqn.my.test.server.target00",iscsi_lun="123",iscsi_portals="",iscsi_target_portal="1.2.3.4:3260",nfs_path="",nfs_server="",persistentvolume="test-pv-available",storageclass=""} 1
kube_persistentvolume_info{ebs_volume_id="",fc_lun="",fc_target_wwns="",fc_wwids="",gce_persistent_disk_name="",iscsi_initiator_name="",iscsi_iqn="iqn.my.test.server.target00",iscsi_lun="123",iscsi_target_portal="1.2.3.4:3260",nfs_path="",nfs_server="",persistentvolume="test-pv-available",storageclass=""} 1
`,
MetricNames: []string{"kube_persistentvolume_info"},
},
Expand All @@ -320,7 +320,6 @@ func TestPersistentVolumeStore(t *testing.T) {
IQN: "iqn.my.test.server.target00",
Lun: int32(123),
InitiatorName: &iscsiInitiatorName,
Portals: []string{"portal1", "portal2"},
},
},
},
Expand All @@ -334,7 +333,7 @@ func TestPersistentVolumeStore(t *testing.T) {
Want: `
# HELP kube_persistentvolume_info Information about persistentvolume.
# TYPE kube_persistentvolume_info gauge
kube_persistentvolume_info{ebs_volume_id="",fc_lun="",fc_target_wwns="",fc_wwids="",gce_persistent_disk_name="",iscsi_initiator_name="iqn.my.test.initiator:112233",iscsi_iqn="iqn.my.test.server.target00",iscsi_lun="123",iscsi_portals="portal1,portal2",iscsi_target_portal="1.2.3.4:3260",nfs_path="",nfs_server="",persistentvolume="test-pv-available",storageclass=""} 1
kube_persistentvolume_info{ebs_volume_id="",fc_lun="",fc_target_wwns="",fc_wwids="",gce_persistent_disk_name="",iscsi_initiator_name="iqn.my.test.initiator:112233",iscsi_iqn="iqn.my.test.server.target00",iscsi_lun="123",iscsi_target_portal="1.2.3.4:3260",nfs_path="",nfs_server="",persistentvolume="test-pv-available",storageclass=""} 1
`,
MetricNames: []string{"kube_persistentvolume_info"},
},
Expand All @@ -358,7 +357,7 @@ func TestPersistentVolumeStore(t *testing.T) {
Want: `
# HELP kube_persistentvolume_info Information about persistentvolume.
# TYPE kube_persistentvolume_info gauge
kube_persistentvolume_info{ebs_volume_id="",fc_lun="",fc_target_wwns="",fc_wwids="",gce_persistent_disk_name="",iscsi_initiator_name="",iscsi_iqn="",iscsi_lun="",iscsi_portals="",iscsi_target_portal="",nfs_path="/myPath",nfs_server="1.2.3.4",persistentvolume="test-pv-available",storageclass=""} 1
kube_persistentvolume_info{ebs_volume_id="",fc_lun="",fc_target_wwns="",fc_wwids="",gce_persistent_disk_name="",iscsi_initiator_name="",iscsi_iqn="",iscsi_lun="",iscsi_target_portal="",nfs_path="/myPath",nfs_server="1.2.3.4",persistentvolume="test-pv-available",storageclass=""} 1
`,
MetricNames: []string{"kube_persistentvolume_info"},
},
Expand Down

0 comments on commit 28560d4

Please # to comment.