Documentation ¶
Index ¶
Constants ¶
const ( KERNEL_EXECUTION_STATE_IDLE = "idle" KERNEL_EXECUTION_STATE_BUSY = "busy" KERNEL_EXECUTION_STATE_STARTING = "starting" )
const AnnotationHeadersRequestSet = "notebooks.kubeflow.org/http-headers-request-set"
const AnnotationRewriteURI = "notebooks.kubeflow.org/http-rewrite-uri"
const DEFAULT_CLUSTER_DOMAIN = "cluster.local"
const DEFAULT_CULL_IDLE_TIME = "1440" // One day
const DEFAULT_DEV = "false"
const DEFAULT_ENABLE_CULLING = "false"
const DEFAULT_IDLENESS_CHECK_PERIOD = "1"
const DefaultContainerPort = 8888
const DefaultFSGroup = int64(100)
The default fsGroup of PodSecurityContext. https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#podsecuritycontext-v1-core
const DefaultServingPort = 80
const LAST_ACTIVITY_ANNOTATION = "notebooks.kubeflow.org/last-activity"
const LAST_ACTIVITY_CHECK_TIMESTAMP_ANNOTATION = "notebooks.kubeflow.org/last_activity_check_timestamp"
const PrefixEnvVar = "NB_PREFIX"
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 ¶
var CLUSTER_DOMAIN = ""
var CULL_IDLE_TIME = 0
var DEV = false
var ENABLE_CULLING = false
var IDLENESS_CHECK_PERIOD = 0
Functions ¶
func GetEnvDefault ¶
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) 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) SetupWithManager ¶
func (r *NotebookReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.