controller

package
v0.0.0-...-560103a Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//Components
	OrchestDatabase   = "orchest-database"
	OrchestApi        = "orchest-api"
	OrchestApiCleanup = "orchest-api-cleanup"
	Rabbitmq          = "rabbitmq-server"
	CeleryWorker      = "celery-worker"
	AuthServer        = "auth-server"
	OrchestWebserver  = "orchest-webserver"
	NodeAgent         = "node-agent"
	BuildKitDaemon    = "buildkit-daemon"

	// PVC names
	UserDirName            = "userdir-pvc"
	OrchestStateVolumeName = "orchest-state"

	// Deprecated, the PVC is removed.
	OldBuilderDirName = "image-builder-cache-pvc"

	// Mount paths
	UserdirMountPath      = "/userdir"
	OrchestStateMountPath = "/orchest/state"

	// database paths
	DBMountPath = "/userdir/.orchest/database/data"
	DBSubPath   = ".orchest/database/data"

	// rabbitmq paths
	RabbitmountPath = "/var/lib/rabbitmq/mnesia"
	RabbitSubPath   = ".orchest/rabbitmq-mnesia"

	// Ingress constants
	PrefixPathType = netsv1.PathType("Prefix")

	// Labels and Annotations
	OrchestHashLabelKey    = "orchest.io/orchest-hash"
	DeploymentHashLabelKey = "orchest.io/deployment-hash"
	GenerationKey          = "controller.orchest.io/generation"
	OwnerLabelKey          = "controller.orchest.io/owner"
	ControllerPartOfLabel  = "controller.orchest.io/part-of"
	ComponentLabelKey      = "controller.orchest.io/component"
	K8sDistroAnnotationKey = "controller.orchest.io/k8s"
	IngressAnnotationKey   = "controller.orchest.io/deploy-ingress"
	RestartAnnotationKey   = "orchest.io/restart"

	// Runtime annotations
	KubeAdmCRISocketAnnotationKey           = "kubeadm.alpha.kubernetes.io/cri-socket"
	ContainerRuntimeSocketPathAnnotationKey = "orchest.io/container-runtime-socket"
)

Functions

func AddFinalizerIfNotPresent

func AddFinalizerIfNotPresent(ctx context.Context,
	generalClient client.Client,
	object client.Object,
	finalizer string) (bool, error)

AddFinalizer adds specified finalizer string to object

func AnnotateIfNotPresent

func AnnotateIfNotPresent(ctx context.Context, generalClient client.Client, object client.Object, key, value string) (bool, error)

func AnnotateObject

func AnnotateObject(ctx context.Context, generalClient client.Client, object client.Object, key, value string) (bool, error)

func GetMetadata

func GetMetadata(resourceName, hash string,
	object client.Object, kind schema.GroupVersionKind) metav1.ObjectMeta

func GetOrchestLabelSelector

func GetOrchestLabelSelector(object client.Object) (labels.Selector, error)

func GetOrchestMatchLabels

func GetOrchestMatchLabels(object client.Object) map[string]string

func GetRbacManifest

func GetRbacManifest(metadata metav1.ObjectMeta) []client.Object

func GetResourceLables

func GetResourceLables(resourceName, hash string,
	object client.Object) map[string]string

func GetResourceMatchLables

func GetResourceMatchLables(resourceName string, object client.Object) map[string]string

func IsComponentReady

func IsComponentReady(component orchestv1alpha1.OrchestComponent) bool

IsComponentReady checks if the OrchestComponent is ready or not

func IsNginxIngressClass

func IsNginxIngressClass(name string) bool

IsComponentReady checks if the OrchestComponent is ready or not

func RemoveAnnotation

func RemoveAnnotation(ctx context.Context, generalClient client.Client, object client.Object, key string) (bool, error)

func RemoveFinalizerIfPresent

func RemoveFinalizerIfPresent(ctx context.Context,
	generalClient client.Client,
	object client.Object,
	finalizer string) (bool, error)

RemoveFinalizers removes finalizersfrom object

func UpsertObject

func UpsertObject(ctx context.Context, generalClient client.Client, object client.Object) error

Types

type ControleeGetterFunction

type ControleeGetterFunction func(namespace, name string) (interface{}, error)

type Controller

type Controller[Object client.Object] struct {

	// sync function
	SyncHandler SyncHandlerFunction

	// The lister of controlee
	ControleeGetter ControleeGetterFunction

	// the list of informerSynced
	InformerSyncedList []cache.InformerSynced
	// contains filtered or unexported fields
}

OrchestClusterController reconciles OrchestCluster CRD.

func NewController

func NewController[Object client.Object](name string, threadiness int,
	kubeClient kubernetes.Interface,
	gvk *schema.GroupVersionKind) *Controller[Object]

func (*Controller[Object]) Client

func (c *Controller[Object]) Client() kubernetes.Interface

func (*Controller[Object]) Enqueue

func (c *Controller[Object]) Enqueue(obj interface{})

func (*Controller[Object]) EnqueueAfter

func (c *Controller[Object]) EnqueueAfter(obj interface{})

func (*Controller[Object]) Run

func (c *Controller[Object]) Run(stopCh <-chan struct{})

Run will not return until stopCh is closed. workers determines how many objects will be handled in parallel.

type SyncHandlerFunction

type SyncHandlerFunction func(ctx context.Context, key string) error

type Watcher

type Watcher[WatchObject, ControllerObject client.Object] struct {
	*Controller[ControllerObject]
	// contains filtered or unexported fields
}

func NewControlleeWatcher

func NewControlleeWatcher[WatchObject, ControllerObject client.Object](ctrl *Controller[ControllerObject]) Watcher[WatchObject, ControllerObject]

func NewControllerWatcher

func NewControllerWatcher[ControllerObject client.Object](ctrl *Controller[ControllerObject]) Watcher[ControllerObject, ControllerObject]

func (*Watcher[WatchObject, ControllerObject]) AddObject

func (w *Watcher[WatchObject, ControllerObject]) AddObject(obj interface{})

func (*Watcher[WatchObject, ControllerObject]) DeleteObject

func (w *Watcher[WatchObject, ControllerObject]) DeleteObject(obj interface{})

func (*Watcher[WatchObject, ControllerObject]) UpdateObject

func (w *Watcher[WatchObject, ControllerObject]) UpdateObject(old, cur interface{})

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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