controller

package
v0.0.0-...-bc6ebe8 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2022 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ControllerName             = "cron-restarter-controller"
	AutoRestarterAnnotationKey = "cronRestart"
	// ErrResourceExists is used as part of the Event 'reason' when a Foo fails
	// to sync due to a Deployment of the same name already existing.
	ErrResourceExists = "ErrResourceExists"
	// MessageResourceExists is the message used for Events when a resource
	// fails to sync due to a Deployment already existing
	MessageResourceExists  = "Resource %q already exists and is not managed by Deployment"
	AutoRestarterFinalizer = "cron-restarter.io/finalizer"
	AnnRestarterKey        = "auto-restarter.io/restarter"
	ServiceAccountName     = "cron-restarter"

	DefaultCronJobNamespace = "kube-system"
	DefaultKubeCtlImage     = "bitnami/kubectl:1.18.6"
)
View Source
const (
	AutoRestarterContainerName = "restarter"
)
View Source
const CronJobNameSuffix = "restarter"

Variables

This section is empty.

Functions

func BindControllerOptionsFlags

func BindControllerOptionsFlags(co *ControllerOptions, fs *pflag.FlagSet)

Types

type AutoRestarterContext

type AutoRestarterContext struct {
	Name           string
	Namespace      string
	Kind           string
	Schedule       string // optional
	Image          string // optional
	Object         metav1.Object
	ServiceAccount string            // optional
	Labels         map[string]string // optional
}

func NewAutoRestarterContext

func NewAutoRestarterContext(obj interface{}, opts ...AutoRestarterContextOptions) *AutoRestarterContext

func (*AutoRestarterContext) Log

func (ctx *AutoRestarterContext) Log(operation string)

type AutoRestarterContextOptions

type AutoRestarterContextOptions func(*AutoRestarterContext)

func WithImage

func WithImage(image string) AutoRestarterContextOptions

func WithLabels

func WithLabels(labels map[string]string) AutoRestarterContextOptions

func WithSchedule

func WithSchedule(schedule string) AutoRestarterContextOptions

func WithServiceAccount

func WithServiceAccount(serviceAccount string) AutoRestarterContextOptions

type ControllerOptions

type ControllerOptions struct {
	CronJobNamespace string `json:"cronjob_namespace" yaml:"cronJobNamespace"` // all relative CronJobs will put into this namespace
	KubeCtlImage     string `json:"kubectl_image" yaml:"kubectlImage"`         // image with kubectl
}

func NewDefaultControllerOptions

func NewDefaultControllerOptions() *ControllerOptions

type RestarterController

type RestarterController struct {
	*ControllerOptions
	// contains filtered or unexported fields
}

func NewRestarterController

func NewRestarterController(
	kubeClientset kubernetes.Interface,
	resyncPeriod time.Duration,
	co *ControllerOptions,
) (*RestarterController, error)

func (*RestarterController) Run

func (rc *RestarterController) Run(workers int, stopCh <-chan struct{}) error

Run will set up the event handlers for types we are interested in, as well as syncing informer caches and starting workers. It will block until stopCh is closed, at which point it will shutdown the workqueue and wait for workers to finish processing their current work items.

Jump to

Keyboard shortcuts

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