jobs

package
v0.0.0-...-4263410 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeNoop                worker.JobType = "no_operation"
	TypeLaunchInstanceAws   worker.JobType = "launch_instances_aws"
	TypeLaunchInstanceAzure worker.JobType = "launch_instances_azure"
	TypeLaunchInstanceGcp   worker.JobType = "launch_instances_gcp"
)
View Source
const (
	DefaultAzureResourceGroupName = "redhat-deployed"

	DefaultVMName = "redhat-vm"
)

Variables

View Source
var (
	ErrTypeAssertion = errors.New("type assert error")
	ErrPanicInJob    = errors.New("panic during job")
)
View Source
var ErrNoOperationFailure = errors.New("job failed on request")
View Source
var ErrTryAgain = errors.New("try again")
View Source
var LaunchInstanceAzureSteps = []string{"Prepare resource group", "Launch instance(s)"}
View Source
var LaunchInstanceGCPSteps = []string{"Launch instance(s)", "Fetch instance(s) description"}

Functions

func DoEnsureAzureResourceGroup

func DoEnsureAzureResourceGroup(ctx context.Context, args *LaunchInstanceAzureTaskArgs) error

func DoEnsurePubkeyOnAWS

func DoEnsurePubkeyOnAWS(ctx context.Context, args *LaunchInstanceAWSTaskArgs) error

DoEnsurePubkeyOnAWS is a job logic, when error is returned the job status is updated accordingly

func DoLaunchInstanceAWS

func DoLaunchInstanceAWS(ctx context.Context, args *LaunchInstanceAWSTaskArgs) error

func DoLaunchInstanceAzure

func DoLaunchInstanceAzure(ctx context.Context, args *LaunchInstanceAzureTaskArgs) error

func DoLaunchInstanceGCP

func DoLaunchInstanceGCP(ctx context.Context, args *LaunchInstanceGCPTaskArgs) error

DoLaunchInstanceGCP is a job logic, when error is returned the job status is updated accordingly

func DoNoop

func DoNoop(ctx context.Context, args *NoopJobArgs) error

DoNoop is a job logic, when error is returned the job status is updated accordingly

func FetchInstancesDescriptionAWS

func FetchInstancesDescriptionAWS(ctx context.Context, args *LaunchInstanceAWSTaskArgs) error

func FetchInstancesDescriptionGCP

func FetchInstancesDescriptionGCP(ctx context.Context, args *LaunchInstanceGCPTaskArgs) error

func HandleLaunchInstanceAWS

func HandleLaunchInstanceAWS(ctx context.Context, job *worker.Job)

HandleLaunchInstanceAWS unmarshalls arguments and handles error

func HandleLaunchInstanceAzure

func HandleLaunchInstanceAzure(ctx context.Context, job *worker.Job)

func HandleLaunchInstanceGCP

func HandleLaunchInstanceGCP(ctx context.Context, job *worker.Job)

HandleLaunchInstanceGCP unmarshalls arguments and handles error

func HandleNoop

func HandleNoop(ctx context.Context, job *worker.Job)

HandleNoop unmarshalls arguments and handle error

Types

type LaunchInstanceAWSTaskArgs

type LaunchInstanceAWSTaskArgs struct {
	// Associated reservation
	ReservationID int64

	// Region to provision the instances into
	Region string

	// Associated public key
	PubkeyID int64

	// Source ID that was used to get the ARN
	SourceID string

	// Detail information
	Detail *models.AWSDetail

	// AWS AMI as fetched from image builder
	AMI string

	// LaunchTemplateID or empty string when no template in use
	LaunchTemplateID string

	// The ARN fetched from Sources which is linked to a specific source
	ARN *clients.Authentication
}

type LaunchInstanceAzureTaskArgs

type LaunchInstanceAzureTaskArgs struct {
	// Associated reservation
	ReservationID int64

	// Location to provision the instances into when blank, uses the Resource Group location
	Location string

	// Associated public key
	PubkeyID int64

	// SourceID that was used to get the Subscription
	SourceID string

	// AzureImageID as fetched from image builder
	AzureImageID string

	// ResourceGroupName passed by a user, if left blank, defaults to 'redhat-deployed'
	ResourceGroupName string

	// The Subscription fetched from Sources which is linked to a specific source
	Subscription *clients.Authentication

	// The Name is used as prefix for a final name, for uniqueness we add uuid suffix to each instance name
	Name string
}

type LaunchInstanceGCPTaskArgs

type LaunchInstanceGCPTaskArgs struct {
	// Associated reservation
	ReservationID int64

	// Zone to provision the instances into
	Zone string

	// Associated public key
	PubkeyID int64

	// Detail information
	Detail *models.GCPDetail

	// GCP image name as fetched from image builder
	ImageName string

	// The project id from Sources which is linked to a specific source
	ProjectID *clients.Authentication

	// Launch template id or empty string when no template in use
	LaunchTemplateID string
}

type NoopJobArgs

type NoopJobArgs struct {
	ReservationID int64
	Fail          bool          // Fail forcefully (used in tests)
	Sleep         time.Duration // Sleep (delay) duration (used in tests)
}

Jump to

Keyboard shortcuts

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