core

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: Apache-2.0 Imports: 29 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// ConfigHashAnnotation is the key of the annotation on the PodTemplate that
	// holds the configuration hash
	ConfigHashAnnotation = "wave.pusher.com/config-hash"

	// FinalizerString is the finalizer added to deployments to allow Wave to
	// perform advanced deletion logic
	FinalizerString = "wave.pusher.com/finalizer"

	// SchedulingDisabledAnnotation is set on a deployment if scheduling has been disabled
	// due to missing children and contains the original scheduler
	SchedulingDisabledAnnotation = "wave.pusher.com/scheduling-disabled"

	// SchedulingDisabledSchedulerName is the dummy scheduler to disable scheduling of pods
	SchedulingDisabledSchedulerName = "wave.pusher.com/invalid"

	// ExtraConfigMapsAnnotation is the key of the annotation that contains additional
	// ConfigMaps which Wave should watch
	ExtraConfigMapsAnnotation = "wave.pusher.com/extra-configmaps"

	// ExtraSecretsAnnotation is the key of the annotation that contains additional
	// Secrets which Wave should watch
	ExtraSecretsAnnotation = "wave.pusher.com/extra-secrets"

	// RequiredAnnotation is the key of the annotation on the Deployment that Wave
	// checks for before processing the deployment
	RequiredAnnotation = "wave.pusher.com/update-on-config-change"
)

Variables

This section is empty.

Functions

func AddController added in v0.9.0

func AddController[I InstanceType](name string, typeInstance I, mgr manager.Manager, r reconcile.Reconciler, h *Handler[I]) error

add adds a new Controller to mgr with r as the reconcile.Reconciler

func BuildCacheDefaultNamespaces added in v0.9.0

func BuildCacheDefaultNamespaces(namespaces string) map[string]cache.Config

BuildCacheDefaultNamespaces builds a cache config to watch namespaces

func ControllerTestSuite added in v0.9.0

func ControllerTestSuite[I InstanceType](
	t **envtest.Environment, cfg **rest.Config, mRef *utils.Matcher,
	requestsStart *<-chan reconcile.Request, requests *<-chan reconcile.Request,
	makeObject func() I)

func EnqueueRequestForWatcher added in v0.7.0

func EnqueueRequestForWatcher(watcherList WatcherList) handler.EventHandler

func GetNamespacedName added in v0.7.0

func GetNamespacedName(name string, namespace string) types.NamespacedName

func GetNamespacedNameFromObject added in v0.7.0

func GetNamespacedNameFromObject(obj ObjectWithNameAndNamespace) types.NamespacedName

func GetPodTemplate added in v0.9.0

func GetPodTemplate[I InstanceType](instance I) *corev1.PodTemplateSpec

func Run added in v0.9.0

func Run(ctx context.Context, k8sManager ctrl.Manager) error

Run runs the webhook server.

func SetPodTemplate added in v0.9.0

func SetPodTemplate[I InstanceType](instance I, template *corev1.PodTemplateSpec)

func SetupControllerTestReconcile added in v0.9.0

func SetupControllerTestReconcile(inner reconcile.Reconciler) (reconcile.Reconciler, chan reconcile.Request, chan reconcile.Request)

SetupControllerTestReconcile returns a reconcile.Reconcile implementation that delegates to inner and writes the request to requests after Reconcile is finished.

Types

type DeplyomentInterface added in v0.9.0

type DeplyomentInterface interface {
	metav1.TypeMeta
	metav1.ObjectMeta
}

type Handler

type Handler[I InstanceType] struct {
	client.Client
	// contains filtered or unexported fields
}

Handler performs the main business logic of the Wave controller

func NewHandler

func NewHandler[I InstanceType](c client.Client, r record.EventRecorder) *Handler[I]

NewHandler constructs a new instance of Handler

func (*Handler[I]) GetWatchedConfigmaps added in v0.7.0

func (h *Handler[I]) GetWatchedConfigmaps() WatcherList

func (*Handler[I]) GetWatchedSecrets added in v0.7.0

func (h *Handler[I]) GetWatchedSecrets() WatcherList

func (*Handler[I]) Handle added in v0.9.0

func (h *Handler[I]) Handle(ctx context.Context, namespacesName types.NamespacedName, instance I) (reconcile.Result, error)

Handle is called by the controller to reconcile its object

func (*Handler[I]) HandleWebhook added in v0.9.0

func (h *Handler[I]) HandleWebhook(instance I, dryRun *bool, isCreate bool) error

HandleWebhook is called by the webhook

func (*Handler[I]) RemoveWatches added in v0.7.0

func (h *Handler[I]) RemoveWatches(instanceName types.NamespacedName)

type InstanceType added in v0.9.0

type Object

type Object interface {
	client.Object
	metav1.Object
}

Object is used as a helper interface when passing Kubernetes resources between methods. Adjusted to satisfy client.Object directly.

type ObjectWithNameAndNamespace added in v0.7.0

type ObjectWithNameAndNamespace interface {
	GetNamespace() string
	GetName() string
}

type WatcherList added in v0.8.0

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

Jump to

Keyboard shortcuts

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