common

package
v1.3.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewResourceInstance

func NewResourceInstance(apiVersionKind string) *unstructured.Unstructured

func NewResourceInstanceList

func NewResourceInstanceList(apiVersionKind string) *unstructured.UnstructuredList

func ResolveOneTimeSchedule added in v1.2.0

func ResolveOneTimeSchedule(creationTimestamp metav1.Time, dateTimeDuration string) (time.Time, error)

Types

type Config

type Config struct {
	EnableLeaderElection bool          `env:"ENABLE_LEADER_ELECTION" envDefault:"false"`
	SyncPeriod           time.Duration `env:"SYNC_PERIOD" envDefault:"60m"`
	MonitoringInterval   time.Duration `env:"MONITORING_INTERVAL" envDefault:"5s"`
	ExpirationLabel      string        `env:"EXPIRATION_LABEL" envDefault:"mayfly.cloud.namecheap.com/expire"`
	Resources            []string      `env:"RESOURCES" envSeparator:"," envDefault:"v1;Secret,cloud.namecheap.com/v1alpha2;ScheduledResource"`
}

func NewConfig

func NewConfig() *Config

type Scheduler

type Scheduler interface {
	CreateOrUpdateOneTimeTask(tag string, at time.Time, task func() error) error
	CreateOrUpdateRecurringTask(tag string, cron string, task func() error) error
	DeleteTask(tag string) error
	GetTaskNextRun(tag string) string
}

func NewScheduler

func NewScheduler(config *Config) Scheduler

Jump to

Keyboard shortcuts

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