diff --git a/bundle/manifests/amalthea.dev_amaltheasessions.yaml b/bundle/manifests/amalthea.dev_amaltheasessions.yaml index a38a9a7a..02b9e16b 100644 --- a/bundle/manifests/amalthea.dev_amaltheasessions.yaml +++ b/bundle/manifests/amalthea.dev_amaltheasessions.yaml @@ -5985,6 +5985,20 @@ spec: - name type: object type: array + location: + default: local + description: |- + Specifies whether the process running the user's session is local or remote. + - A local session runs as a container in the same pod as where the AmaltheaSession is defined and running. + - A remote session runs as a remote process on an external compute resource. + The remote process is controlled by the "session_controller (TBC)" container in the session pod. + enum: + - local + - remote + type: string + x-kubernetes-validations: + - message: location is immutable + rule: self == oldSelf nodeSelector: additionalProperties: type: string @@ -6255,6 +6269,30 @@ spec: - http type: string type: object + remoteSecretRef: + description: |- + The secret containing the configuration needed to start a remote session. + This field should be populated only when the session location is set to "remote". + This secret will be loaded into environment variables passed to the remote + session controller. + See: [internal/remote/config.Config] for a list of configuration options. + properties: + adopt: + description: If the secret is adopted then the operator will + delete the secret when the custom resource that uses it + is deleted. + type: boolean + key: + description: |- + The key is optional because it may not be relevant depending on where or how the secret is used. + For example, for authentication see the `secretRef` field in `spec.authentication` + for more details. + type: string + name: + type: string + required: + - name + type: object resources: description: Resource requirements and limits in the same format as a Pod in Kubernetes @@ -6457,6 +6495,9 @@ spec: description: If the state is failed then the message will contain information about what went wrong, otherwise it is empty type: string + failedSchedulingSince: + format: date-time + type: string failingSince: format: date-time type: string diff --git a/internal/controller/amaltheasession_controller.go b/internal/controller/amaltheasession_controller.go index 57986eb2..4248b788 100644 --- a/internal/controller/amaltheasession_controller.go +++ b/internal/controller/amaltheasession_controller.go @@ -80,7 +80,7 @@ func (r *AmaltheaSessionReconciler) Reconcile(ctx context.Context, req ctrl.Requ // If the custom resource is not found then, it usually means that it was deleted or not created // In this way, we will stop the reconciliation log.Info("amaltheasession resource not found. Ignoring since object must be deleted") - return ctrl.Result{}, nil + return ctrl.Result{Requeue: false}, nil } // Error reading the object - requeue the request. log.Error(err, "Failed to get amaltheasession") @@ -141,7 +141,7 @@ func (r *AmaltheaSessionReconciler) Reconcile(ctx context.Context, req ctrl.Requ } } - return ctrl.Result{Requeue: true}, nil + return ctrl.Result{Requeue: false}, nil } children, err := NewChildResources(amaltheasession, r.ClusterType) @@ -164,7 +164,6 @@ func (r *AmaltheaSessionReconciler) Reconcile(ctx context.Context, req ctrl.Requ } newStatus := updates.Status(ctx, r, amaltheasession) - statusChanged := reflect.DeepEqual(amaltheasession.Status, newStatus) amaltheasession.Status = newStatus err = r.Status().Update(ctx, amaltheasession) if err != nil { @@ -191,13 +190,16 @@ func (r *AmaltheaSessionReconciler) Reconcile(ctx context.Context, req ctrl.Requ return ctrl.Result{}, err } - // Now requeue to make sure we can watch for idleness and other status changes - requeueAfter := time.Second * 10 - if statusChanged { - // If the status is evolving we should requeue faster - requeueAfter = 0 + switch amaltheasession.Status.State { + case amaltheadevv1alpha1.Hibernated: + if amaltheasession.Spec.Culling.MaxHibernatedDuration.Duration > 0 { + return ctrl.Result{Requeue: true, RequeueAfter: amaltheasession.Spec.Culling.MaxHibernatedDuration.Duration}, nil + } else { + return ctrl.Result{Requeue: false}, nil + } + default: + return ctrl.Result{Requeue: true, RequeueAfter: time.Second * 10}, nil } - return ctrl.Result{Requeue: true, RequeueAfter: requeueAfter}, nil } func (r *AmaltheaSessionReconciler) deleteSecrets(ctx context.Context, cr *amaltheadevv1alpha1.AmaltheaSession) error {