func (service *Service) AddVolume(volume core.Volume) {
	merged := false
	for _, existingVolume := range service.Volumes {
		if existingVolume.Name == volume.Name {
			logrus.Debugf("Found an existing volume. Ignoring new volume : %+v", volume)
			merged = true
			break
		}
	}
	if !merged {
		service.Volumes = append(service.Volumes, volume)
	}
}
AddVolume adds a volume to a service
package ir
import (
	"encoding/json"
	"fmt"
	"strings"
	"github.com/konveyor/move2kube/common"
	"github.com/konveyor/move2kube/common/deepcopy"
	transformertypes "github.com/konveyor/move2kube/types/transformer"
	"github.com/sirupsen/logrus"
	"k8s.io/apimachinery/pkg/util/strategicpatch"
	core "k8s.io/kubernetes/pkg/apis/core"
	networking "k8s.io/kubernetes/pkg/apis/networking"
)
const IRArtifactType transformertypes.ArtifactType = "IR"
const IRConfigType transformertypes.ConfigType = "IR"
const (
	DockerfileContainerBuildType ContainerBuildTypeValue = "Dockerfile"
	S2IContainerBuildTypeValue ContainerBuildTypeValue = "S2I"
	CNBContainerBuildTypeValue ContainerBuildTypeValue = "CNB"
)
type IR struct {
	Name            string
	ContainerImages map[string]ContainerImage  
	Services        map[string]Service
	Storages        []Storage
}
type Service struct {
	core.PodSpec
	Name                        string
	BackendServiceName          string  
	Annotations                 map[string]string
	Labels                      map[string]string
	ServiceToPodPortForwardings []ServiceToPodPortForwarding
	Replicas                    int
	Networks                    []string
	OnlyIngress                 bool
	Daemon                      bool  
}
type ServiceToPodPortForwarding struct {
	ServicePort    networking.ServiceBackendPort
	PodPort        networking.ServiceBackendPort
	ServiceRelPath string  
}
type ContainerBuildTypeValue string
type ContainerBuildArtifactTypeValue string
type ContainerImage struct {
	ExposedPorts []int32  `yaml:"ports"`
	UserID       int      `yaml:"userID"`
	AccessedDirs []string `yaml:"accessedDirs"`
	Build        ContainerBuild
}
type ContainerBuild struct {
	ContainerBuildType ContainerBuildTypeValue                      `yaml:"-"`
	ContextPath        string                                       `yaml:"-"`
	Artifacts          map[ContainerBuildArtifactTypeValue][]string `yaml:"-"`  
}
type StorageKindType string
type Storage struct {
	Name                           string
	Annotations                    map[string]string  
	core.PersistentVolumeClaimSpec                    
	StorageType                    StorageKindType    
	SecretType                     core.SecretType    
	Content                        map[string][]byte  
}
const (
	SecretKind StorageKindType = "Secret"
	ConfigMapKind StorageKindType = "ConfigMap"
	PVCKind StorageKindType = "PersistentVolumeClaim"
	PullSecretKind StorageKindType = "PullSecret"
)
func NewEnhancedIRFromIR(ir IR) EnhancedIR {
	irCopy := deepcopy.DeepCopy(ir).(IR)
	return EnhancedIR{IR: irCopy}
}
func (ir *IR) addService(service Service) {
	if os, ok := ir.Services[service.Name]; !ok {
		ir.Services[service.Name] = service
	} else {
		os.merge(service)
		ir.Services[service.Name] = os
	}
}
func (service *Service) merge(nService Service) {
	if service.Name != nService.Name {
		return
	}
	if service.BackendServiceName != nService.BackendServiceName && service.BackendServiceName != "" {
		logrus.Errorf("BackendServiceNames (%s, %s) don't seem to match during merge for service : %s. Using %s", service.BackendServiceName, nService.BackendServiceName, service.Name, nService.BackendServiceName)
	}
	if nService.BackendServiceName != "" {
		service.BackendServiceName = nService.BackendServiceName
	}
	podSpecJSON, err1 := json.Marshal(service.PodSpec)
	if err1 != nil {
		logrus.Errorf("Merge failed. Failed to marshal the first object %v to json. Error: %q", service.PodSpec, err1)
	}
	nPodSpecJSON, err2 := json.Marshal(nService.PodSpec)
	if err2 != nil {
		logrus.Errorf("Merge failed. Failed to marshal the second object %v to json. Error: %q", nService.PodSpec, err2)
	}
	if err1 != nil || err2 != nil {
		podSpec := core.PodSpec{}
		mergedJSON, err := strategicpatch.StrategicMergePatch(podSpecJSON, nPodSpecJSON, podSpec)  
		if err != nil {
			logrus.Errorf("Failed to merge the objects \n%s\n and \n%s\n Error: %q", podSpecJSON, nPodSpecJSON, err)
		} else {
			err := json.Unmarshal(mergedJSON, &podSpec)
			if err != nil {
				logrus.Errorf("Failed to unmarshall object (%+v): %q", podSpec, err)
			} else {
				service.PodSpec = podSpec
			}
		}
	}
	service.Annotations = common.MergeStringMaps(service.Annotations, nService.Annotations)
	service.Labels = common.MergeStringMaps(service.Labels, nService.Labels)
	if nService.Replicas != 0 {
		service.Replicas = nService.Replicas
	}
	service.Networks = common.MergeStringSlices(service.Networks, nService.Networks...)
	service.OnlyIngress = service.OnlyIngress && nService.OnlyIngress
	service.Daemon = service.Daemon && nService.Daemon
	for _, pf := range nService.ServiceToPodPortForwardings {
		service.AddPortForwarding(pf.ServicePort, pf.PodPort, pf.ServiceRelPath)
	}
}
func (service *Service) AddPortForwarding(servicePort networking.ServiceBackendPort, podPort networking.ServiceBackendPort, relPath string) error {
	if podPort.Number == 0 || servicePort.Number == 0 {
		return fmt.Errorf("PodPort or ServicePort can not be 0")
	}
	for _, forwarding := range service.ServiceToPodPortForwardings {
		if servicePort.Name != "" && forwarding.ServicePort.Name == servicePort.Name {
			err := fmt.Errorf("the port name %s on %s service is already in use. Not adding the new forwarding", servicePort.Name, service.Name)
			return err
		}
		if forwarding.ServicePort.Number == servicePort.Number {
			err := fmt.Errorf("the port number %d on %s service is already in use. Not adding the new forwarding", servicePort.Number, service.Name)
			return err
		}
	}
	newForwarding := ServiceToPodPortForwarding{ServicePort: servicePort, PodPort: podPort, ServiceRelPath: relPath}
	for _, pf := range service.ServiceToPodPortForwardings {
		if pf.PodPort == newForwarding.PodPort || pf.ServicePort == newForwarding.ServicePort {
			return fmt.Errorf("mapping exists for port %v:%v in service %s. Ignoring", pf.PodPort, pf.ServicePort, service.Name)
		}
	}
	service.ServiceToPodPortForwardings = append(service.ServiceToPodPortForwardings, newForwarding)
	return nil
}