controllers

package
v0.0.0-...-7217bab Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2021 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(c *scheduler.CloudSchedulerClient, p, l, n, app string) *handler

Types

type JobOption

type JobOption func(*JobRequest)

func WithRetryConfig

func WithRetryConfig(conf *JobRetryConfig) JobOption

type JobRequest

type JobRequest struct {
	Name        string
	Schedule    string
	TimeZone    string
	Description string

	RetryConfig *JobRetryConfig

	CreateJobRequest *schedulerpb.CreateJobRequest
	UpdateJobRequest *schedulerpb.UpdateJobRequest
	// contains filtered or unexported fields
}

func (JobRequest) CreateJobRequest

func (h JobRequest) CreateJobRequest(ctx context.Context, spec string, tz string, description string, options ...JobOption) *JobRequest

func (*JobRequest) Do

func (r *JobRequest) Do(ctx context.Context) (*schedulerpb.Job, error)

func (JobRequest) GetJob

func (h JobRequest) GetJob(ctx context.Context) (*schedulerpb.Job, bool)

func (*JobRequest) NewAppEngineHttpTarget

func (r *JobRequest) NewAppEngineHttpTarget(method string, service string, version string, instance string, host string, relativeUri string, headers map[string]string, body string) *JobRequest

func (*JobRequest) NewHttpTarget

func (r *JobRequest) NewHttpTarget(uri string, method string, headers map[string]string, body string) *JobRequest

func (*JobRequest) NewPubSubTarget

func (r *JobRequest) NewPubSubTarget(topic string, data string, attrs map[string]string) *JobRequest

func (JobRequest) UpdateJobRequest

func (h JobRequest) UpdateJobRequest(ctx context.Context, spec string, tz string, description string, options ...JobOption) *JobRequest

type JobRetryConfig

type JobRetryConfig struct {
	// Maximum number of retry attempts for a failed job
	MaxRetryAttempts int

	// Time limit for retrying a failed job, 0s means unlimited
	MaxRetryDuration string

	// Minimum time to wait before retrying a job after it fails
	MinBackoffDuration string

	// Maximum time to wait before retrying a job after it fails
	MaxBackoffDuration string

	// The time between retries will double max doublings times
	MaxDoublings int
}

If a job does not complete successfully, it is retried, with exponential backoff, according to the settings in retry config. Learn more https://cloud.google.com/scheduler/docs/reference/rpc/google.cloud.scheduler.v1?authuser=1&_ga=2.60975276.-1449617874.1626837834#retryconfig

type SchedulerReconciler

type SchedulerReconciler struct {
	client.Client
	Log      zerolog.Logger
	Scheme   *runtime.Scheme
	Recorder record.EventRecorder

	CloudScheduler *scheduler.CloudSchedulerClient
}

SchedulerReconciler reconciles a Scheduler object

func (*SchedulerReconciler) Reconcile

func (r *SchedulerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the Scheduler object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.8.3/pkg/reconcile

func (*SchedulerReconciler) SetupWithManager

func (r *SchedulerReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

Jump to

Keyboard shortcuts

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