utils

package
v0.0.0-...-b31cdb4 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddLabelsToJobs

func AddLabelsToJobs(jobs []*batchv1.Job, labels map[string]string)

func AddResourceLimitsToJobs

func AddResourceLimitsToJobs(jobs []*batchv1.Job, limits *v1alpha1.ResourceList)

func AddResourceRequestsToJobs

func AddResourceRequestsToJobs(jobs []*batchv1.Job, requests *v1alpha1.ResourceList)

func AddTolerationToJobs

func AddTolerationToJobs(jobs []*batchv1.Job, tolerations []corev1.Toleration)

func CleanMongoDatabaseContainer

func CleanMongoDatabaseContainer(target v1alpha1.Target, database string) *corev1.Container

func CleanMysqlDatabaseContainer

func CleanMysqlDatabaseContainer(target v1alpha1.Target, database string) *corev1.Container

func CleanPGDatabaseContainer

func CleanPGDatabaseContainer(target v1alpha1.Target, database string) *corev1.Container

func DeleteJob

func DeleteJob(cli client.Client, reqCtx context.Context, jobName string, namespace string) error

func GetJobStatus

func GetJobStatus(cli client.Client, reqCtx context.Context, jobName string, namespace string) (*batchv1.JobStatus, error)

func GetLogFromPod

func GetLogFromPod(rsc *rest.Config, reqCtx context.Context, podName string, namespace string) (string, error)

func GetPodListFromJob

func GetPodListFromJob(cli client.Client, reqCtx context.Context, jobName string, namespace string) (*corev1.PodList, error)

func InitMysqlDatabaseContainer

func InitMysqlDatabaseContainer(target v1alpha1.Target, database string) *corev1.Container

InitMysqlDatabaseContainer will create a database in mysql

func InitPGDatabaseContainer

func InitPGDatabaseContainer(target v1alpha1.Target, database string) *corev1.Container

InitPGDatabaseContainer will create a database in postgresql

func IsJobExisted

func IsJobExisted(cli client.Client, reqCtx context.Context, jobName string, namespace string) (bool, error)

func IsJobSuccessful

func IsJobSuccessful(cli client.Client, reqCtx context.Context, jobName string, namespace string) (bool, error)

func JobTemplate

func JobTemplate(name, namespace string) *batchv1.Job

func LogJobPodToCond

func LogJobPodToCond(cli client.Client, restConfig *rest.Config, reqCtx context.Context, jobName string, namespace string, conditions *[]metav1.Condition, call func(string) string) error

LogJobPodToCond record the log of job's pods to the conditions

func NewMongodbPreCheckJob

func NewMongodbPreCheckJob(name string, namespace string, target v1alpha1.Target) *batchv1.Job

func NewMysqlPreCheckJob

func NewMysqlPreCheckJob(name, namespace string, target v1alpha1.Target) *batchv1.Job

NewMysqlPreCheckJob create a job to check the mysql connection

func NewPgbenchPreCheckJob

func NewPgbenchPreCheckJob(name string, namespace string, target v1alpha1.Target) *batchv1.Job

NewPgbenchPreCheckJob create a job to check the pgbench connection

func NewPreCheckJob

func NewPreCheckJob(name, namespace string, driver string, target *v1alpha1.Target) *batchv1.Job

NewPreCheckJob create a job to check the connection

func NewRedisPreCheckJob

func NewRedisPreCheckJob(name, namespace string, target v1alpha1.Target) *batchv1.Job

func RecordFailedLogToCond

func RecordFailedLogToCond(conditions *[]metav1.Condition, msg string)

func RecordSuccessfulLogToCond

func RecordSuccessfulLogToCond(conditions *[]metav1.Condition, msg string)

Types

This section is empty.

Jump to

Keyboard shortcuts

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