core

package
v0.0.0-...-164f795 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BackupState

func BackupState[T types.CloudRunCRD, S CloudRunCRDSpec](obj T, spec S) error

func CommonHistory

func CommonHistory[T types.CloudRunCRD, S CloudRunCRDSpec](obj T, spec S) (string, error)

func CreateAndWatchJob

func CreateAndWatchJob[T types.CloudRunCRD](
	ctx Context,
	obj T,
	newJob func() (*batchv1.Job, error),
	deleteJobAfterDone bool,
	hookAfterSuccess func() error,
) error

func DeleteJob

func DeleteJob(ctx Context, round int) error

func GetJob

func GetJob(ctx Context, round int) (*batchv1.Job, error)

func GetStatusFromPod

func GetStatusFromPod(ctx Context, selector *metav1.LabelSelector) (status types.Status, message string, pod *apiv1.Pod, err error)

func IsDoneOrFailed

func IsDoneOrFailed(crd types.CloudRunCRD) bool

func Ptr

func Ptr[T any](b T) *T

func PublishStatus

func PublishStatus(ctx Context, obj types.CloudRunCRD, err error)

Types

type CloudRunCRDSpec

type CloudRunCRDSpec interface {
	v1alpha1.BuilderSpec | v1alpha1.DeployerSpec | v1alpha1.WorkflowSpec
}

type Context

type Context interface {
	context.Context
	client.Client

	Info(msg string, keysAndValues ...interface{})
	Infof(format string, args ...interface{})
	Error(err error, msg string, keysAndValues ...interface{})
	Errorf(err error, format string, args ...interface{})

	Name() string
	Namespace() string
	NamespacedName() types.NamespacedName
	NewObjectMeta(round int) apimetav1.ObjectMeta

	GetServiceLabels(round int) map[string]string

	CreateResource(obj client.Object, force, update bool) error
	GetSubResource(obj client.Object, round int) (bool, error)
}

type DefaultContext

type DefaultContext struct {
	context.Context
	client.Client
	logr.Logger

	NamespacedNameVar types.NamespacedName

	GetMasterResource  func() (client.Object, error)
	GetOwnerReferences func() (apimetav1.OwnerReference, error)
}

func (*DefaultContext) CreateResource

func (ctx *DefaultContext) CreateResource(obj client.Object, force, update bool) error

func (*DefaultContext) Error

func (ctx *DefaultContext) Error(err error, msg string, keysAndValues ...interface{})

func (*DefaultContext) Errorf

func (ctx *DefaultContext) Errorf(err error, format string, args ...interface{})

func (*DefaultContext) GetServiceLabels

func (ctx *DefaultContext) GetServiceLabels(round int) map[string]string

func (*DefaultContext) GetSubResource

func (ctx *DefaultContext) GetSubResource(obj client.Object, round int) (bool, error)

func (*DefaultContext) Info

func (ctx *DefaultContext) Info(msg string, keysAndValues ...interface{})

func (*DefaultContext) Infof

func (ctx *DefaultContext) Infof(format string, args ...interface{})

func (*DefaultContext) Name

func (ctx *DefaultContext) Name() string

func (*DefaultContext) Namespace

func (ctx *DefaultContext) Namespace() string

func (*DefaultContext) NamespacedName

func (ctx *DefaultContext) NamespacedName() types.NamespacedName

func (*DefaultContext) NewObjectMeta

func (ctx *DefaultContext) NewObjectMeta(round int) apimetav1.ObjectMeta

type History

type History[T CloudRunCRDSpec] struct {
	Round     int          `json:"round"`
	Status    types.Status `json:"status"`
	Spec      T            `json:"spec"`
	StartTime int64        `json:"startTime"`
	EndTime   int64        `json:"endTime"`
}

Jump to

Keyboard shortcuts

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