Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions bundle/manifests/amalthea.dev_amaltheasessions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5985,6 +5985,20 @@ spec:
- name
type: object
type: array
location:
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes in this file are just leftovers from other PRs that are already merged. They CRDs in the helm chart already have this update. This is for deploying directly from manifests.

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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
20 changes: 11 additions & 9 deletions internal/controller/amaltheasession_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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)
Expand All @@ -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 {
Expand All @@ -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 {
Expand Down
Loading