Skip to content

Commit

Permalink
Merge pull request #566 from travisn/backport-exporter-4.14
Browse files Browse the repository at this point in the history
Bug 2253429: exporter: Don't delete exporter service on daemon deletion
  • Loading branch information
agarwal-mudit authored Mar 7, 2024
2 parents 29e71f9 + 9b19df1 commit 7522dc8
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions pkg/operator/ceph/cluster/nodedaemon/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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) {
Expand All @@ -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)
}
Expand Down

0 comments on commit 7522dc8

Please sign in to comment.