executor

package
v1.11.25 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: MIT Imports: 23 Imported by: 26

Documentation

Index

Constants

View Source
const (

	// GitUsernameSecretName is git username secret name
	GitUsernameSecretName = "git-username"
	// GitTokenSecretName is git token secret name
	GitTokenSecretName = "git-token"
)

Variables

View Source
var ErrPodInitializing = errors.New("PodInitializing")
View Source
var RunnerEnvVars = []corev1.EnvVar{
	{
		Name:  "DEBUG",
		Value: os.Getenv("DEBUG"),
	},
	{
		Name:  "RUNNER_ENDPOINT",
		Value: os.Getenv("STORAGE_ENDPOINT"),
	},
	{
		Name:  "RUNNER_ACCESSKEYID",
		Value: os.Getenv("STORAGE_ACCESSKEYID"),
	},
	{
		Name:  "RUNNER_SECRETACCESSKEY",
		Value: os.Getenv("STORAGE_SECRETACCESSKEY"),
	},
	{
		Name:  "RUNNER_REGION",
		Value: os.Getenv("STORAGE_REGION"),
	},
	{
		Name:  "RUNNER_TOKEN",
		Value: os.Getenv("STORAGE_TOKEN"),
	},
	{
		Name:  "RUNNER_BUCKET",
		Value: os.Getenv("STORAGE_BUCKET"),
	},
	{
		Name:  "RUNNER_SSL",
		Value: getOr("STORAGE_SSL", "false"),
	},
	{
		Name:  "RUNNER_SCRAPPERENABLED",
		Value: getOr("SCRAPPERENABLED", "false"),
	},
	{
		Name:  "RUNNER_DATADIR",
		Value: "/data",
	},
	{
		Name:  "RUNNER_CDEVENTS_TARGET",
		Value: os.Getenv("CDEVENTS_TARGET"),
	},
	{
		Name:  "RUNNER_CLOUD_MODE",
		Value: getRunnerCloudMode(),
	},
	{
		Name:  "RUNNER_CLOUD_API_KEY",
		Value: os.Getenv("TESTKUBE_CLOUD_API_KEY"),
	},
	{
		Name:  "RUNNER_CLOUD_API_TLS_INSECURE",
		Value: getOr("TESTKUBE_CLOUD_TLS_INSECURE", "false"),
	},
	{
		Name:  "RUNNER_CLOUD_API_URL",
		Value: os.Getenv("TESTKUBE_CLOUD_URL"),
	},
	{
		Name:  "RUNNER_DASHBOARD_URI",
		Value: os.Getenv("TESTKUBE_DASHBOARD_URI"),
	},
}

Functions

func AbortJob added in v1.5.35

func AbortJob(ctx context.Context, c kubernetes.Interface, namespace string, jobName string) (*testkube.ExecutionResult, error)

AbortJob - aborts Kubernetes Job with no grace period

func GetContainerLogs added in v1.9.15

func GetContainerLogs(ctx context.Context, c kubernetes.Interface, pod *corev1.Pod, container, namespace string, tailLines *int64) ([]byte, error)

GetContainerLogs returns container logs

func GetJobPods added in v1.5.35

func GetJobPods(ctx context.Context, podsClient tcorev1.PodInterface, jobName string, retryNr, retryCount int) (*corev1.PodList, error)

GetJobPods returns job pods

func GetPodErrorMessage added in v1.10.39

func GetPodErrorMessage(pod *corev1.Pod) string

GetPodErrorMessage return pod error message

func GetPodLogs added in v1.5.35

func GetPodLogs(ctx context.Context, c kubernetes.Interface, namespace string, pod corev1.Pod, logLinesCount ...int64) (logs []byte, err error)

GetPodLogs returns pod logs bytes

func IsPodFailed added in v1.9.15

func IsPodFailed(pod *corev1.Pod) (err error)

IsPodFailed checks if pod failed pod can be in wait state with reason which is error for us on the end

func IsPodLoggable added in v1.6.11

func IsPodLoggable(ctx context.Context, c kubernetes.Interface, podName, namespace string) wait.ConditionFunc

IsPodLoggable defines if pod is ready to get logs from it

func IsPodReady added in v1.5.35

func IsPodReady(ctx context.Context, c kubernetes.Interface, podName, namespace string) wait.ConditionFunc

IsPodReady defines if pod is ready or failed for logs scrapping

func IsWaitStateFailed added in v1.9.15

func IsWaitStateFailed(state string) bool

IsWaitStateFailed defines possible failed wait state those states are defined and throwed as errors in Kubernetes runtime https://github.com/kubernetes/kubernetes/blob/127f33f63d118d8d61bebaba2a240c60f71c824a/pkg/kubelet/kuberuntime/kuberuntime_container.go#L59

func Run

func Run(dir string, command string, envMngr env.Interface, arguments ...string) (out []byte, err error)

Run runs executor process wrapped in json line output wraps stdout lines into JSON chunks we want it to have common interface for agent stdin <- testkube.Execution, stdout <- stream of json logs LoggedExecuteInDir will put wrapped JSON output to stdout AND get RAW output into out var json logs can be processed later on watch of pod logs

Types

type Images added in v1.7.16

type Images struct {
	Init    string
	Scraper string
}

Images contains images for executor

func SyncDefaultExecutors added in v1.7.16

func SyncDefaultExecutors(
	executorsClient executorsclientv1.Interface,
	namespace string,
	executors []testkube.ExecutorDetails,
	readOnlyExecutors bool,
) (images Images, err error)

SyncDefaultExecutors creates or updates default executors

type Templates added in v1.7.16

type Templates struct {
	Job     string `json:"job"`
	PVC     string `json:"pvc"`
	Scraper string `json:"scraper"`
}

Templates contains templates for executor

Directories

Path Synopsis
Package client is a generated GoMock package.
Package client is a generated GoMock package.
Package scraper is a generated GoMock package.
Package scraper is a generated GoMock package.

Jump to

Keyboard shortcuts

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