func NewGenericResourceFromPod(podResource kubeAPICoreV1.Pod, originalObject interface{}) (GenericResource, error) {
	workload := GenericResource{
		Kind:       "Pod",
		PodSpec:    &podResource.Spec,
		ObjectMeta: podResource.ObjectMeta.GetObjectMeta(),
	}
	if originalObject != nil {
		bytes, err := json.Marshal(originalObject)
		if err != nil {
			return workload, err
		}
		workload.OriginalObjectJSON = bytes
		err = json.Unmarshal(bytes, &workload.Resource.Object)
		if err != nil {
			logrus.Error("Couldn't marshal JSON for pod ", err)
			return workload, err
		}
		objMeta, err := meta.Accessor(&workload.Resource)
		if err != nil {
			logrus.Error("Couldn't create meta accessor for unstructred ", err)
			return workload, err
		}
		workload.ObjectMeta = objMeta
	}
	return workload, nil
}
NewGenericResourceFromPod builds a new workload for a given Pod without looking at parents
package kube
import (
	"context"
	"encoding/json"
	"fmt"
	"github.com/sirupsen/logrus"
	"gopkg.in/yaml.v3"
	kubeAPICoreV1 "k8s.io/api/core/v1"
	"k8s.io/apimachinery/pkg/api/meta"
	kubeAPIMetaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
	"k8s.io/apimachinery/pkg/runtime/schema"
	"k8s.io/client-go/dynamic"
)
type GenericResource struct {
	Kind               string
	ObjectMeta         kubeAPIMetaV1.Object
	Resource           unstructured.Unstructured
	PodSpec            *kubeAPICoreV1.PodSpec
	OriginalObjectJSON []byte
}
func NewGenericResourceFromUnstructured(unst unstructured.Unstructured) (GenericResource, error) {
	workload := GenericResource{
		Kind:     unst.GetKind(),
		Resource: unst,
	}
	objMeta, err := meta.Accessor(&unst)
	if err != nil {
		return workload, err
	}
	workload.ObjectMeta = objMeta
	b, err := json.Marshal(&unst)
	if err != nil {
		return workload, err
	}
	workload.OriginalObjectJSON = b
	m := make(map[string]interface{})
	err = json.Unmarshal(b, &m)
	if err != nil {
		return workload, err
	}
	podSpecMap := GetPodSpec(m)
	if podSpecMap != nil {
		b, err = json.Marshal(podSpecMap)
		if err != nil {
			return workload, err
		}
		podSpec := kubeAPICoreV1.PodSpec{}
		err = json.Unmarshal(b, &podSpec)
		if err != nil {
			return workload, err
		}
		workload.PodSpec = &podSpec
	}
	return workload, nil
}