controllers

package
v0.0.0-...-bd7f250 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KERNEL_EXECUTION_STATE_IDLE     = "idle"
	KERNEL_EXECUTION_STATE_BUSY     = "busy"
	KERNEL_EXECUTION_STATE_STARTING = "starting"
)
View Source
const AnnotationHeadersRequestSet = "notebooks.kubeflow.org/http-headers-request-set"
View Source
const AnnotationRewriteURI = "notebooks.kubeflow.org/http-rewrite-uri"
View Source
const DEFAULT_CLUSTER_DOMAIN = "cluster.local"
View Source
const DEFAULT_CULL_IDLE_TIME = "1440" // One day
View Source
const DEFAULT_DEV = "false"
View Source
const DEFAULT_ENABLE_CULLING = "false"
View Source
const DEFAULT_IDLENESS_CHECK_PERIOD = "1"
View Source
const DefaultContainerPort = 8888
View Source
const DefaultFSGroup = int64(100)

The default fsGroup of PodSecurityContext. https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#podsecuritycontext-v1-core

View Source
const DefaultServingPort = 80
View Source
const LAST_ACTIVITY_ANNOTATION = "notebooks.kubeflow.org/last-activity"
View Source
const LAST_ACTIVITY_CHECK_TIMESTAMP_ANNOTATION = "notebooks.kubeflow.org/last_activity_check_timestamp"
View Source
const PrefixEnvVar = "NB_PREFIX"
View Source
const STOP_ANNOTATION = "kubeflow-resource-stopped"

When a Resource should be stopped/culled, then the controller should add this annotation in the Resource's Metadata. Then, inside the reconcile loop, the controller must check if this annotation is set and then apply the respective culling logic for that Resource. The value of the annotation will be a timestamp of when the Resource was stopped/culled.

In case of Notebooks, the controller will reduce the replicas to 0 if this annotation is set. If it's not set, then it will make the replicas 1.

Variables

View Source
var CLUSTER_DOMAIN = ""
View Source
var CULL_IDLE_TIME = 0
View Source
var DEV = false
View Source
var ENABLE_CULLING = false
View Source
var IDLENESS_CHECK_PERIOD = 0

Functions

func GetEnvDefault

func GetEnvDefault(variable string, defaultVal string) string

Some Utility Functions

func PodCondToNotebookCond

func PodCondToNotebookCond(podc corev1.PodCondition) v1beta1.NotebookCondition

func StopAnnotationIsSet

func StopAnnotationIsSet(meta metav1.ObjectMeta) bool

Types

type CullingReconciler

type CullingReconciler struct {
	client.Client
	Log     logr.Logger
	Scheme  *runtime.Scheme
	Metrics *metrics.Metrics
}

CullingReconciler : Type of a reconciler that will be culling idle notebooks

func (*CullingReconciler) Reconcile

func (r *CullingReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*CullingReconciler) SetupWithManager

func (r *CullingReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager : Add the culling controller to the manager

type KernelStatus

type KernelStatus struct {
	ID             string `json:"id"`
	Name           string `json:"name"`
	LastActivity   string `json:"last_activity"`
	ExecutionState string `json:"execution_state"`
	Connections    int    `json:"connections"`
}

Each kernel of the Notebook Server has a status. KernelStatus struct:

type NotebookReconciler

type NotebookReconciler struct {
	client.Client
	Log           logr.Logger
	Scheme        *runtime.Scheme
	Metrics       *metrics.Metrics
	EventRecorder record.EventRecorder
}

NotebookReconciler reconciles a Notebook object

func (*NotebookReconciler) Reconcile

func (r *NotebookReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*NotebookReconciler) SetupWithManager

func (r *NotebookReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

Jump to

Keyboard shortcuts

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