Problem/Motivation

In both these functions, if the k8s_node is dirty, it will call the K8s service and attempt to update them.

    foreach ($nodes ?: [] as $node) {
      if (k8s_is_metrics_enabled($node->getCloudContext()) === TRUE) {
        if ($node->getDirty()) {
          $this->k8sService->setCloudContext($node->getCloudContext());
          $this->k8sService->updateNodesWithoutBatch([
            'metadata.name' => $node->getName(),
          ], FALSE);
        }

        $pod_resources = $this->getPodResources($node->getName());

        // Return a JSON object of K8s Node names, Pods capacity and Pods
        // allocation to construct a Node heatmap to display the Pods allocation
        // status by D3.js.
        $node_response = $this->generateNodeResponse($node);
        $node_response['pods'] = $pod_resources;
        $response[] = $node_response;
      }
    }

Since these functions are mainly used for the K8s graph blocks, attempting to update nodes can delay the rendering of graphs.

This should be removed. Dirty node updating should happen in Cron and the Queue.

CommentFileSizeAuthor
#3 3161340-2.patch7.81 KBbaldwinlouie

Comments

baldwinlouie created an issue. See original summary.

baldwinlouie’s picture

Issue summary: View changes
baldwinlouie’s picture

Status: Active » Needs review
StatusFileSize
new7.81 KB

Attaching patch that removes the updating of dirty nodes. Cron already takes care of updating all nodes.

yas’s picture

Status: Needs review » Reviewed & tested by the community

@baldwinlouie

Thank you for the refactoring. I tested the patch and it looks good to me. I'll merge the patch to 8.x-1.x, 8.x-2.x and 3.x and close this issue as Fixed.

  • yas committed 2feca81 on 8.x-2.x authored by baldwinlouie
    Issue #3161340 by baldwinlouie, yas: Remove updating dirty nodes in...

  • yas committed 9062172 on 3.x authored by baldwinlouie
    Issue #3161340 by baldwinlouie, yas: Remove updating dirty nodes in...
yas’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.