// CreateAndRunPod Create and run a pod according to the given specifications
CreateAndRunPod Create and run a pod according to the given specifications
// CreateAndRunPod Create and run a pod according to the given specifications
func CreateAndRunPod(clientSet *kubernetes.Clientset, creationSpec *PodCreationSpec) error {
	context := &podContext{
		creationSpec:  creationSpec,
		podsClient:    clientSet.Pods("default"),
		serviceClient: clientSet.Services("default"),
		podClosed:     make(chan bool, 2),
	}
	containerName := workflowsv1.GenerateContainerName()
	creationSpec.Cleanup.Add(1)
	go func() {
		<-creationSpec.Context.Done()
		cleanupPodIfNecessary(context)
	}()
	err := createPod(context, containerName)
	if err != nil {
		return err
	}
	log.Debugf("Created pod %v", context.pod.Name)
	printer := &podLogPrinter{
		podsClient:       context.podsClient,
		logPrefix:        creationSpec.LogPrefix,
		variableReceiver: creationSpec.VariableReceiver,
		workflowReceiver: creationSpec.WorkflowReceiver,
	}
	go waitForPod(context, printer)
	return nil
}
func CreateAndRunPod ( clientSet * kubernetes . Clientset , creationSpec * PodCreationSpec ) error { context := & podContext { creationSpec : creationSpec , podsClient : clientSet . Pods ( " " ) , serviceClient : clientSet . Services ( " " ) , podClosed : make ( chan bool , 2 ) , } containerName := workflowsv1 . GenerateContainerName ( ) creationSpec . Cleanup . Add ( 1 ) go func ( ) { <- creationSpec . Context . Done ( ) cleanupPodIfNecessary ( context ) } ( ) err := createPod ( context , containerName ) if err != nil { return err } log . Debugf ( " " , context . pod . Name ) printer := & podLogPrinter { podsClient : context . podsClient , logPrefix : creationSpec . LogPrefix , variableReceiver : creationSpec . VariableReceiver , workflowReceiver : creationSpec . WorkflowReceiver , } go waitForPod ( context , printer ) return nil }
CreateAndRunPod Create and run a pod according to the given specifications
CreateAndRunPod Create and run a pod according to the given specifications