From 55e36b66f8ee25caeda743530ec8f0d89dc65407 Mon Sep 17 00:00:00 2001 From: Shachar Sharon Date: Thu, 30 Mar 2023 11:55:49 +0300 Subject: [PATCH] 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 (cherry picked from commit 7b28f1de05b2c00731bee4f09a3a69c5acfc7607) --- pkg/operator/ceph/nfs/spec.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/pkg/operator/ceph/nfs/spec.go b/pkg/operator/ceph/nfs/spec.go index bcddd1d4e..cf5d37f84 100644 --- a/pkg/operator/ceph/nfs/spec.go +++ b/pkg/operator/ceph/nfs/spec.go @@ -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, + }, }, }, }