exporter: dont delete exporter service on daemon deletion
The exporter service and service monitor should not
be deleted if an individual daemon is being removed
from a node. As long as the exporter is enabled with
v18 and newer, the exporter service and service monitor
should exist. Clusters were seeing their metrics stop
collection when the exporter service and service monitor
would disappear, especially when multiple clusters are
configured.
Signed-off-by: travisn <tnielsen@redhat.com>
(cherry picked from commit a1fc70f2fc)
This commit is contained in:
1 parent
e987985eb2
commit
f274def404
1 file changed
+3
-7
@@ -85,12 +85,12 @@ func (r *ReconcileNode) Reconcile(context context.Context, request reconcile.Req
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (r *ReconcileNode) cleanupExporterResources(clusterNamespace string, ns string, nodeName string) (reconcile.Result, error) {
|
||||
func (r *ReconcileNode) cleanupExporterResources(ns string, nodeName string) (reconcile.Result, error) {
|
||||
err := k8sutil.DeleteServiceMonitor(r.context, r.opManagerContext, ns, cephExporterAppName)
|
||||
if err != nil {
|
||||
logger.Debugf("failed to delete service monitor for ceph exporter in namespace %q on node %q. %v", ns, nodeName, err)
|
||||
}
|
||||
err = k8sutil.DeleteService(r.opManagerContext, r.context.Clientset, r.opConfig.OperatorNamespace, cephExporterAppName)
|
||||
err = k8sutil.DeleteService(r.opManagerContext, r.context.Clientset, ns, cephExporterAppName)
|
||||
if err != nil {
|
||||
return reconcile.Result{}, errors.Wrapf(err, "failed to delete ceph exporter metrics service in namespace %q on node %q", ns, nodeName)
|
||||
}
|
||||
@@ -207,10 +207,6 @@ func (r *ReconcileNode) reconcile(request reconcile.Request) (reconcile.Result,
|
||||
if err != nil {
|
||||
return reconcile.Result{}, errors.Wrapf(err, "failed to list and delete deployments in namespace %q on node %q", namespace, request.Name)
|
||||
}
|
||||
result, err := r.cleanupExporterResources(cephCluster.Namespace, namespace, request.Name)
|
||||
if err != nil {
|
||||
return result, errors.Wrapf(err, "failed to cleanup exporter resources in namespace %q on node %q", namespace, request.Name)
|
||||
}
|
||||
}
|
||||
// Cleanup exporter if the ceph version isn't supported
|
||||
if !cephVersion.IsAtLeast(MinVersionForCephExporter) {
|
||||
@@ -219,7 +215,7 @@ func (r *ReconcileNode) reconcile(request reconcile.Request) (reconcile.Result,
|
||||
if err := r.listDeploymentAndDelete(cephExporterAppName, request.Name, namespace); err != nil {
|
||||
return reconcile.Result{}, errors.Wrap(err, "failed to delete ceph-exporter")
|
||||
}
|
||||
result, err := r.cleanupExporterResources(cephCluster.Namespace, namespace, request.Name)
|
||||
result, err := r.cleanupExporterResources(namespace, request.Name)
|
||||
if err != nil {
|
||||
return result, errors.Wrapf(err, "failed to cleanup exporter resources in namespace %q on node %q", namespace, request.Name)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user