nfs: add support for nfs-ganesha metrics monitoring

NFS-Ganesha (as of V5-dev.2 [1]) supports Prometheus monitoring from
within the NFS server itself. It provides metrics for both connected
clients and active exports, via TCP port 9587. Expose those metrics via
existing nfs k8s-service.

[1] https://github.com/nfs-ganesha/nfs-ganesha/commit/b6c59df5a0b8a3ae5b2a87446f8906cb321ee026

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
(cherry picked from commit 7b28f1de05)
This commit is contained in:
Shachar Sharon authored and Mergify committed 2023-04-04 15:37:56 +00:00
1 parent 4f9b1e835e
commit 55e36b66f8
1 file changed
+11 -4
+11 -4
View File
@@ -35,10 +35,11 @@ import (
const (
// AppName is the name of the app
AppName = "rook-ceph-nfs"
ganeshaConfigVolume = "ganesha-config"
nfsPort = 2049
ganeshaPid = "/var/run/ganesha/ganesha.pid"
AppName = "rook-ceph-nfs"
ganeshaConfigVolume = "ganesha-config"
nfsPort = 2049
ganeshaPid = "/var/run/ganesha/ganesha.pid"
nfsGaneshaMetricsPort = 9587
)
func (r *ReconcileCephNFS) generateCephNFSService(nfs *cephv1.CephNFS, cfg daemonConfig) *v1.Service {
@@ -59,6 +60,12 @@ func (r *ReconcileCephNFS) generateCephNFSService(nfs *cephv1.CephNFS, cfg daemo
TargetPort: intstr.FromInt(int(nfsPort)),
Protocol: v1.ProtocolTCP,
},
{
Name: "nfs-metrics",
Port: nfsGaneshaMetricsPort,
TargetPort: intstr.FromInt(int(nfsGaneshaMetricsPort)),
Protocol: v1.ProtocolTCP,
},
},
},
}