common

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsExpired

func IsExpired(resource client.Object, config *Config) (bool, time.Time, error)

func NewResourceInstance

func NewResourceInstance(apiVersionKind string) *unstructured.Unstructured

func NewResourceInstanceList

func NewResourceInstanceList(apiVersionKind string) *unstructured.UnstructuredList

Types

type Config

type Config struct {
	EnableLeaderElection bool          `env:"ENABLE_LEADER_ELECTION" envDefault:"false"`
	SyncPeriod           time.Duration `env:"SYNC_PERIOD" envDefault:"30m"`
	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/v1alpha1;ScheduledResource"`
}

func NewConfig

func NewConfig() *Config

type Scheduler

type Scheduler struct {
	// contains filtered or unexported fields
}

func NewScheduler

func NewScheduler(config *Config, client client.Client) *Scheduler

func (*Scheduler) CreateOrUpdateTask

func (s *Scheduler) CreateOrUpdateTask(tag string, date time.Time, task func() error) error

func (*Scheduler) DeleteTask

func (s *Scheduler) DeleteTask(tag string) error

Jump to

Keyboard shortcuts

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