func patchNode(cli *k8sclient.Clientset, patchList []*agent_v1.JsonPatch) error {
	data, err := json.Marshal(patchList)
	if err != nil {
		return agentError("failed to marshal Node patches: %v", err)
	}
	pt := types.JSONPatchType
	_, err = cli.CoreV1().Nodes().Patch(context.TODO(), nodeName, pt, data, meta_v1.PatchOptions{})
	if err != nil {
		return err
	}
	return nil
}
patchNodeObject is a helper for patching a k8s Node object
package agent
import (
	"context"
	"encoding/json"
	"fmt"
	"os"
	"time"
	core_v1 "k8s.io/api/core/v1"
	meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/types"
	k8swatch "k8s.io/apimachinery/pkg/watch"
	k8sclient "k8s.io/client-go/kubernetes"
	"k8s.io/client-go/rest"
	"k8s.io/client-go/tools/clientcmd"
	resmgr "github.com/intel/cri-resource-manager/pkg/apis/resmgr/generated/clientset/versioned/typed/resmgr/v1alpha1"
	agent_v1 "github.com/intel/cri-resource-manager/pkg/agent/api/v1"
)
type namespace string
var nodeName string
func (a *agent) getK8sClient(kubeconfig string) (*k8sclient.Clientset, *resmgr.CriresmgrV1alpha1Client, error) {
	var config *rest.Config
	var err error
	if kubeconfig == "" {
		a.Info("using in-cluster kubeconfig")
		config, err = rest.InClusterConfig()
	} else {
		config, err = clientcmd.BuildConfigFromFlags("", kubeconfig)
	}
	if err != nil {
		return nil, nil, err
	}
	genCli, err := k8sclient.NewForConfig(config)
	if err != nil {
		return nil, nil, err
	}
	resmgr, err := resmgr.NewForConfig(config)
	if err != nil {
		return nil, nil, err
	}
	return genCli, resmgr, nil
}
func getNodeObject(cli *k8sclient.Clientset) (*core_v1.Node, error) {
	node, err := cli.CoreV1().Nodes().Get(context.TODO(), nodeName, meta_v1.GetOptions{})
	if err != nil {
		return nil, agentError("failed to get node object for node %q: %v", nodeName, err)
	}
	return node, nil
}