helper

package
v0.0.0-...-2864b0a Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DevBoxPartOf = "devbox"
)

Variables

This section is empty.

Functions

func GenerateCommand

func GenerateCommand(devbox *devboxv1alpha1.Devbox, runtime *devboxv1alpha1.Runtime) []string

GenerateCommand generates the command for the Devbox pod

func GenerateDevboxArgs

func GenerateDevboxArgs(devbox *devboxv1alpha1.Devbox, runtime *devboxv1alpha1.Runtime) []string

GenerateDevboxArgs generates the arguments for the Devbox pod

func GenerateDevboxEnvVars

func GenerateDevboxEnvVars(devbox *devboxv1alpha1.Devbox, nextCommitHistory *devboxv1alpha1.CommitHistory) []corev1.EnvVar

func GenerateDevboxPhase

func GenerateDevboxPhase(devbox *devboxv1alpha1.Devbox, podList corev1.PodList) devboxv1alpha1.DevboxPhase

func GeneratePodAnnotations

func GeneratePodAnnotations(devbox *devboxv1alpha1.Devbox, runtime *devboxv1alpha1.Runtime) map[string]string

func GeneratePodLabels

func GeneratePodLabels(devbox *devboxv1alpha1.Devbox, runtime *devboxv1alpha1.Runtime) map[string]string

func GenerateResourceRequirements

func GenerateResourceRequirements(devbox *devboxv1alpha1.Devbox,
	requestCPURate, requestMemoryRate float64,
	requestEphemeralStorage, limitEphemeralStorage string,
) corev1.ResourceRequirements

func GenerateSSHKeyPair

func GenerateSSHKeyPair() ([]byte, []byte, error)

func GenerateSSHVolume

func GenerateSSHVolume(devbox *devboxv1alpha1.Devbox) corev1.Volume

GenerateSSHVolume generates a volume for SSH keys

func GenerateSSHVolumeMounts

func GenerateSSHVolumeMounts() []corev1.VolumeMount

func GenerateWorkingDir

func GenerateWorkingDir(devbox *devboxv1alpha1.Devbox, runtime *devboxv1alpha1.Runtime) string

GenerateWorkingDir generates the working directory for the Devbox pod

func GetLastSuccessCommitHistory

func GetLastSuccessCommitHistory(devbox *devboxv1alpha1.Devbox) *devboxv1alpha1.CommitHistory

func GetLastSuccessCommitImageName

func GetLastSuccessCommitImageName(devbox *devboxv1alpha1.Devbox, runtime *devboxv1alpha1.Runtime) string

func IsExceededQuotaError

func IsExceededQuotaError(err error) bool

func MergeCommitHistory

func MergeCommitHistory(devbox *devboxv1alpha1.Devbox, latestDevbox *devboxv1alpha1.Devbox) []*devboxv1alpha1.CommitHistory

func PodMatchExpectations

func PodMatchExpectations(expectPod *corev1.Pod, pod *corev1.Pod) bool

func PredicateCommitStatus

func PredicateCommitStatus(pod *corev1.Pod) devboxv1alpha1.CommitStatus

PredicateCommitStatus returns the commit status of the pod if the pod container id is empty, it means the pod is pending or has't started, we can assume the image has not been committed otherwise, it means the pod has been started, we can assume the image has been committed

func UpdateCommitHistory

func UpdateCommitHistory(devbox *devboxv1alpha1.Devbox, pod *corev1.Pod, updateStatus bool)

func UpdateDevboxStatus

func UpdateDevboxStatus(current, latest *devboxv1alpha1.Devbox)

UpdateDevboxStatus updates the devbox status, including phase, pod phase, last terminated state and commit history, maybe we need update more fields in the future TODO: move this function to devbox types.go

func UpdatePredicatedCommitStatus

func UpdatePredicatedCommitStatus(devbox *devboxv1alpha1.Devbox, pod *corev1.Pod)

Types

This section is empty.

Jump to

Keyboard shortcuts

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