func (d *Deployment) convertToClusterSupportedKinds(obj runtime.Object, supportedKinds []string, otherobjs []runtime.Object, ir irtypes.EnhancedIR, targetCluster collecttypes.ClusterMetadata) ([]runtime.Object, bool) {
	lobj, _ := k8sschema.ConvertToLiasonScheme(obj)
	if d1, ok := lobj.(*apps.DaemonSet); ok {
		return []runtime.Object{d1}, true
	}
	if d1, ok := lobj.(*core.Pod); ok && (d1.Spec.RestartPolicy == core.RestartPolicyOnFailure || d1.Spec.RestartPolicy == core.RestartPolicyNever) {
		if common.IsStringPresent(supportedKinds, jobKind) {
			return []runtime.Object{d.podToJob(*d1, targetCluster.Spec)}, true
		}
		return []runtime.Object{obj}, true
	} else if d1, ok := lobj.(*batch.Job); ok && !common.IsStringPresent(supportedKinds, jobKind) {
		if !common.IsStringPresent(supportedKinds, jobKind) && common.IsStringPresent(supportedKinds, podKind) {
			return []runtime.Object{d.toPod(d1.ObjectMeta, d1.Spec.Template.Spec, core.RestartPolicyOnFailure, targetCluster.Spec)}, true
		}
		logrus.Warnf("Both Job and Pod not supported. No other valid way to transform this object. : %+v", obj)
		return []runtime.Object{obj}, true
	}
	if common.IsStringPresent(supportedKinds, deploymentConfigKind) {
		if d1, ok := lobj.(*apps.Deployment); ok {
			return []runtime.Object{d.toDeploymentConfig(d1.ObjectMeta, d1.Spec.Template.Spec, d1.Spec.Replicas, targetCluster.Spec)}, true
		} else if d1, ok := lobj.(*core.ReplicationController); ok {
			return []runtime.Object{d.toDeploymentConfig(d1.ObjectMeta, d1.Spec.Template.Spec, d1.Spec.Replicas, targetCluster.Spec)}, true
		} else if d1, ok := lobj.(*core.Pod); ok {
			var replicas int32 = 2
			return []runtime.Object{d.toDeploymentConfig(d1.ObjectMeta, d1.Spec, replicas, targetCluster.Spec)}, true
		}
		return []runtime.Object{obj}, true
	}
	if common.IsStringPresent(supportedKinds, common.DeploymentKind) {
		if d1, ok := obj.(*okdappsv1.DeploymentConfig); ok {
			return []runtime.Object{d.toDeployment(d1.ObjectMeta, k8sschema.ConvertToPodSpec(&d1.Spec.Template.Spec), d1.Spec.Replicas, targetCluster.Spec)}, true
		} else if d1, ok := lobj.(*core.ReplicationController); ok {
			return []runtime.Object{d.toDeployment(d1.ObjectMeta, d1.Spec.Template.Spec, d1.Spec.Replicas, targetCluster.Spec)}, true
		} else if d1, ok := lobj.(*core.Pod); ok {
			var replicas int32 = 2
			return []runtime.Object{d.toDeployment(d1.ObjectMeta, d1.Spec, replicas, targetCluster.Spec)}, true
		}
		return []runtime.Object{obj}, true
	}
	if common.IsStringPresent(supportedKinds, replicationControllerKind) {
		if d1, ok := obj.(*okdappsv1.DeploymentConfig); ok {
			return []runtime.Object{d.toReplicationController(d1.ObjectMeta, k8sschema.ConvertToPodSpec(&d1.Spec.Template.Spec), d1.Spec.Replicas, targetCluster.Spec)}, true
		} else if d1, ok := lobj.(*apps.Deployment); ok {
			return []runtime.Object{d.toReplicationController(d1.ObjectMeta, d1.Spec.Template.Spec, d1.Spec.Replicas, targetCluster.Spec)}, true
		} else if d1, ok := lobj.(*core.Pod); ok {
			var replicas int32 = 2
			return []runtime.Object{d.toReplicationController(d1.ObjectMeta, d1.Spec, replicas, targetCluster.Spec)}, true
		}
		return []runtime.Object{obj}, true
	}
	if common.IsStringPresent(supportedKinds, podKind) {
		if d1, ok := obj.(*okdappsv1.DeploymentConfig); ok {
			return []runtime.Object{d.toPod(d1.ObjectMeta, k8sschema.ConvertToPodSpec(&d1.Spec.Template.Spec), core.RestartPolicyAlways, targetCluster.Spec)}, true
		} else if d1, ok := lobj.(*apps.Deployment); ok {
			return []runtime.Object{d.toPod(d1.ObjectMeta, d1.Spec.Template.Spec, core.RestartPolicyAlways, targetCluster.Spec)}, true
		} else if d1, ok := lobj.(*core.ReplicationController); ok {
			return []runtime.Object{d.toPod(d1.ObjectMeta, d1.Spec.Template.Spec, core.RestartPolicyAlways, targetCluster.Spec)}, true
		}
		return []runtime.Object{obj}, true
	}
	if common.IsStringPresent(d.getSupportedKinds(), obj.GetObjectKind().GroupVersionKind().Kind) {
		return []runtime.Object{obj}, true
	}
	return nil, false
}
convertToClusterSupportedKinds converts objects to kind supported by the cluster
package apiresource
import (
	"strings"
	"github.com/konveyor/move2kube/common"
	"github.com/konveyor/move2kube/k8sschema"
	collecttypes "github.com/konveyor/move2kube/types/collection"
	irtypes "github.com/konveyor/move2kube/types/ir"
	okdappsv1 "github.com/openshift/api/apps/v1"
	"github.com/sirupsen/logrus"
	corev1 "k8s.io/api/core/v1"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/runtime"
	apps "k8s.io/kubernetes/pkg/apis/apps"
	batch "k8s.io/kubernetes/pkg/apis/batch"
	core "k8s.io/kubernetes/pkg/apis/core"
)
const (
	podKind string = "Pod"
	jobKind string = "Job"
	deploymentConfigKind string = "DeploymentConfig"
	replicationControllerKind string = "ReplicationController"
	daemonSetKind string = "DaemonSet"
)
type Deployment struct {
}
func (d *Deployment) getSupportedKinds() []string {
	return []string{podKind, jobKind, common.DeploymentKind, deploymentConfigKind, replicationControllerKind}
}
func (d *Deployment) createNewResources(ir irtypes.EnhancedIR, supportedKinds []string, targetCluster collecttypes.ClusterMetadata) []runtime.Object {
	objs := []runtime.Object{}
	for _, service := range ir.Services {
		var obj runtime.Object
		if service.Daemon {
			if !common.IsStringPresent(supportedKinds, daemonSetKind) {
				logrus.Errorf("Creating Daemonset even though not supported by target cluster.")
			}
			obj = d.createDaemonSet(service, targetCluster.Spec)
		} else if service.RestartPolicy == core.RestartPolicyNever || service.RestartPolicy == core.RestartPolicyOnFailure {
			if common.IsStringPresent(supportedKinds, jobKind) {
				obj = d.createJob(service, targetCluster.Spec)
			} else {
				logrus.Errorf("Could not find a valid resource type in cluster to create a job/pod.")
			}
			pod := d.createPod(service, targetCluster.Spec)
			pod.Spec.RestartPolicy = core.RestartPolicyOnFailure
			obj = pod
		} else if common.IsStringPresent(supportedKinds, deploymentConfigKind) {
			obj = d.createDeploymentConfig(service, targetCluster.Spec)
		} else if common.IsStringPresent(supportedKinds, common.DeploymentKind) {
			obj = d.createDeployment(service, targetCluster.Spec)
		} else if common.IsStringPresent(supportedKinds, replicationControllerKind) {
			obj = d.createReplicationController(service, targetCluster.Spec)
		} else if common.IsStringPresent(supportedKinds, podKind) {
			obj = d.createPod(service, targetCluster.Spec)
		} else {
			logrus.Errorf("Could not find a valid resource type in cluster to create a deployment. Creating Deployment anyhow")
			obj = d.createDeployment(service, targetCluster.Spec)
		}
		if obj != nil {
			objs = append(objs, obj)
		}
	}
	return objs
}