kubernetes/pkg/volume
Kubernetes Submit Queue d9632f66af
Merge pull request #59328 from vmware/vSphereVolumeMetricsProvider
Automatic merge from submit-queue (batch tested with PRs 58317, 58687, 57872, 59063, 59328). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Volume metrics support for vSphere Cloud Provider

**What this PR does / why we need it**:
This PR adds Volume metrics support for vSphere Cloud Provider. With this we can monitor the available space, capacity and used space on volumes created using vSphere. 

**Which issue(s) this PR fixes**
Fixes # https://github.com/kubernetes/kubernetes/issues/43527
Fixes # https://github.com/vmware/kubernetes/issues/208

**Special notes for your reviewer**:
Performed following steps to ensure metrics are reported correctly for vSphere Volumes.

- Created Dynamic PV using the PV claim of size 1Gi.
```
$ kubectl get pvc
NAME        STATUS    VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE
thinclaim   Bound     pvc-bbc18f6a-0a04-11e8-bb1c-0050569c126b   1Gi        RWO            thin           5m
```

- Created Pod using this claim.
- Verified volume stats metrics.

```
/ # df -h | grep /dev/sdb
Filesystem                Size      Used Available Use% Mounted on
/dev/sdb                975.9M      1.3M    923.4M   0% /mnt/volume1
```

```
# HELP kubelet_volume_stats_available_bytes Number of available bytes in the volume
# TYPE kubelet_volume_stats_available_bytes gauge
kubelet_volume_stats_available_bytes{namespace="default",persistentvolumeclaim="thinclaim"} 9.68261632e+08

# HELP kubelet_volume_stats_capacity_bytes Capacity in bytes of the volume
# TYPE kubelet_volume_stats_capacity_bytes gauge
kubelet_volume_stats_capacity_bytes{namespace="default",persistentvolumeclaim="thinclaim"} 1.02330368e+09

# HELP kubelet_volume_stats_used_bytes Number of used bytes in the volume
# TYPE kubelet_volume_stats_used_bytes gauge
kubelet_volume_stats_used_bytes{namespace="default",persistentvolumeclaim="thinclaim"} 1.355776e+06
```

- Download 512MB file in the Pod on attached volume and Verified volume stats metrics is updated successfully.

```
/mnt/volume1 # df -h | grep /dev/sdb
Filesystem                Size      Used Available Use% Mounted on
/dev/sdb                975.9M    513.8M    410.9M  56% /mnt/volume1
```
```
# HELP kubelet_volume_stats_available_bytes Number of available bytes in the volume
# TYPE kubelet_volume_stats_available_bytes gauge
kubelet_volume_stats_available_bytes{namespace="default",persistentvolumeclaim="thinclaim"} 4.30862336e+08

# HELP kubelet_volume_stats_capacity_bytes Capacity in bytes of the volume
# TYPE kubelet_volume_stats_capacity_bytes gauge
kubelet_volume_stats_capacity_bytes{namespace="default",persistentvolumeclaim="thinclaim"} 1.02330368e+09

# HELP kubelet_volume_stats_used_bytes Number of used bytes in the volume
# TYPE kubelet_volume_stats_used_bytes gauge
kubelet_volume_stats_used_bytes{namespace="default",persistentvolumeclaim="thinclaim"} 5.38755072e+08
```

**Release note**:

```release-note
Volume metrics support for vSphere Cloud Provider
```
2018-02-05 18:43:43 -08:00
..
aws_ebs remove duplicated check of device path in aws attacher 2018-01-18 12:36:14 +08:00
azure_dd add remount logic if original mount path is invalid 2018-01-08 06:01:42 +00:00
azure_file initial work for azure file grow size implementation 2018-01-30 13:36:29 +00:00
cephfs Merge pull request #56851 from zouyee/ceph-1 2018-01-10 03:12:28 -08:00
cinder Fix golint for openstack and cinder packages 2018-02-04 17:15:32 -05:00
configmap Add support for binary file in configmap 2018-01-23 07:28:34 -05:00
csi Merge pull request #58462 from NickrenREN/va-to-beta 2018-02-01 18:50:25 -08:00
downwardapi Autogenerate BUILD files 2017-12-23 13:12:11 -08:00
empty_dir Autogenerate BUILD files 2017-12-23 13:12:11 -08:00
fc Cleaning up loopback removal process 2018-02-02 10:33:25 -05:00
flexvolume Remove unused command waitfordetach from flex volume driver 2018-01-03 16:02:31 +08:00
flocker Autogenerate BUILD files 2017-12-23 13:12:11 -08:00
gce_pd Autogenerate BUILD files 2017-12-23 13:12:11 -08:00
git_repo Merge pull request #51098 from jsafrane/exec-git 2018-01-11 09:22:21 -08:00
glusterfs delete duplicate function for getting volume source 2018-02-02 18:58:24 +08:00
host_path Autogenerate BUILD files 2017-12-23 13:12:11 -08:00
iscsi Cleaning up loopback removal process 2018-02-02 10:33:25 -05:00
local Autogenerate BUILD files 2017-12-23 13:12:11 -08:00
nfs Fixed TearDown of NFS with root squash. 2018-01-08 14:01:33 +01:00
photon_pd Autogenerate BUILD files 2017-12-23 13:12:11 -08:00
portworx Autogenerate BUILD files 2017-12-23 13:12:11 -08:00
projected Merge pull request #57422 from joelsmith/nested_data_vol 2018-01-18 03:20:19 -08:00
quobyte Autogenerate BUILD files 2017-12-23 13:12:11 -08:00
rbd Update comments for getting and removing loopback device at iSCSI,FC,RBD 2018-01-17 10:22:39 -05:00
scaleio Autogenerate BUILD files 2017-12-23 13:12:11 -08:00
secret Merge pull request #57422 from joelsmith/nested_data_vol 2018-01-18 03:20:19 -08:00
storageos Autogenerate BUILD files 2017-12-23 13:12:11 -08:00
testing VolumeHost.GetNodeName method added for CSI fix 2017-12-02 05:54:54 -05:00
util Merge pull request #59072 from sbezverk/fc_iscsi_loopback_cleanup 2018-02-02 18:26:41 -08:00
validation Autogenerate BUILD files 2017-12-23 13:12:11 -08:00
vsphere_volume Adding volume metrics support for vSphere Cloud Provider 2018-02-04 16:10:15 -08:00
BUILD Autogenerate BUILD files 2017-12-23 13:12:11 -08:00
doc.go Use Go canonical import paths 2016-07-16 13:48:21 -04:00
metrics_cached.go Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
metrics_du.go add volume timestamps 2017-03-02 15:01:59 -08:00
metrics_du_test.go switch from package syscall to x/sys/unix 2017-07-21 12:14:42 +02:00
metrics_errors.go Disambiguate unsupported metrics from metrics errors 2016-09-15 10:05:30 +10:00
metrics_nil.go Disambiguate unsupported metrics from metrics errors 2016-09-15 10:05:30 +10:00
metrics_nil_test.go Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
metrics_statfs.go add volume timestamps 2017-03-02 15:01:59 -08:00
metrics_statfs_test.go add volume timestamps 2017-03-02 15:01:59 -08:00
OWNERS Update volume OWNERS to reflect active sig-storage reviewers 2017-10-26 13:26:33 -07:00
plugins.go mini fix about typo 2018-01-26 15:42:57 +08:00
plugins_test.go Use const instead of hard code for volume plugin 2017-09-18 20:09:07 +08:00
util.go Merge pull request #56742 from zouyee/patch-12 2017-12-20 16:47:34 -08:00
util_test.go Revert k8s.gcr.io vanity domain 2017-12-22 14:36:16 -08:00
volume.go BlockVolumesSupport: CRI, VolumeManager and OperationExecutor changes 2017-11-20 14:10:26 -05:00
volume_linux.go Fixes cross platform build failure 2017-08-26 09:58:51 -04:00
volume_unsupported.go Fixes cross platform build failure 2017-08-26 09:58:51 -04:00