utils

package
v0.0.0-...-fb37531 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultBackoffLimit for PlxJobs
	DefaultBackoffLimit = 1
	// DefaultRestartPolicy for PlxJobs
	DefaultRestartPolicy = "Never"
)

Variables

This section is empty.

Functions

func CopyDeploymentFields

func CopyDeploymentFields(from, to *appsv1.Deployment) bool

CopyDeploymentFields copies the owned fields from one Deployment to another Returns true if the fields copied from don't match to.

func CopyJobFields

func CopyJobFields(from, to *batchv1.Job) bool

CopyJobFields copies the owned fields from one Job to another Returns true if the fields copied from don't match to.

func CopyServiceFields

func CopyServiceFields(from, to *corev1.Service) bool

CopyServiceFields copies the owned fields from one Service to another

func GeneratePlxDeployment

func GeneratePlxDeployment(
	name string,
	namespace string,
	labels map[string]string,
	port int,
	replicas int32,
	podSpec corev1.PodSpec,
) (*appsv1.Deployment, error)

GeneratePlxDeployment returns a deployment given a PolyaxonDeploymentSpec

func GeneratePlxJob

func GeneratePlxJob(
	name string,
	namespace string,
	labels map[string]string,
	backoffLimit *int32,
	activeDeadlineSeconds *int64,
	ttlSecondsAfterFinished *int32,
	podSpec corev1.PodSpec,
) *batchv1.Job

GeneratePlxJob returns a a batch job given a PolyaxonBaseJobSpec

func GeneratePlxService

func GeneratePlxService(name string, namespace string, labels map[string]string, port int) *corev1.Service

GeneratePlxService returns a service given info from a PolyaxonDeploymentSpec

func GetLastPod

func GetLastPod(pods corev1.PodList) (*corev1.Pod, error)

GetLastPod returns the last pod bassed on the creation time of the items

func GetPodPort

func GetPodPort(podSpec corev1.PodSpec, defaultPort int) int

GetPodPort returns the pod's port from the container definition

func GetReplicas

func GetReplicas(dreplicas int, plxDeployment corev1alpha1.PolyaxonDeploymentSpec) int32

GetReplicas Get replicas for PolyaxonDeploymentSpec

func IgnoreNotFound

func IgnoreNotFound(err error) error

IgnoreNotFound allows to ignore (not requeue) NotFound errors, since we'll get a reconciliation request once the object exists, and requeuing in the meantime won't help, and we can get them on deleted requests.

func IsPlxDeploymentRunning

func IsPlxDeploymentRunning(ds appsv1.DeploymentStatus, dc appsv1.DeploymentCondition) bool

IsPlxDeploymentRunning return true if deploymeny is running

func IsPlxDeploymentWarning

func IsPlxDeploymentWarning(ds appsv1.DeploymentStatus, dc appsv1.DeploymentCondition) bool

IsPlxDeploymentWarning return true if deploymeny is in warning state

func IsPlxJobFailed

func IsPlxJobFailed(jc batchv1.JobCondition) bool

IsPlxJobFailed return true if job is running

func IsPlxJobSucceded

func IsPlxJobSucceded(jc batchv1.JobCondition) bool

IsPlxJobSucceded return true if job is running

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL