From 02fbfc2b4304352fce59c888031208a90d261177 Mon Sep 17 00:00:00 2001 From: Carlos Sanchez Date: Fri, 5 Jun 2026 17:38:42 +0200 Subject: [PATCH] feat(actortemplate): add per-template GoldenSnapshotWait Replace the controller-wide ATE_GOLDEN_SNAPSHOT_WAIT env var with a per-workload spec field. Slow-booting workloads (e.g. Chromium under gVisor) can now set their own wait without forcing every template in the cluster to use the slowest boot budget. --- internal/controllers/actortemplate_controller.go | 8 +++++++- .../ate-install/generated/ate.dev_actortemplates.yaml | 6 ++++++ pkg/api/v1alpha1/actortemplate_types.go | 7 +++++++ pkg/api/v1alpha1/zz_generated.deepcopy.go | 5 +++++ 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/internal/controllers/actortemplate_controller.go b/internal/controllers/actortemplate_controller.go index 3df86bc4e..6c6f4d6a3 100644 --- a/internal/controllers/actortemplate_controller.go +++ b/internal/controllers/actortemplate_controller.go @@ -32,6 +32,8 @@ import ( const ( GoldenSnapshotCreationReason = "GoldenSnapshotCreation" + + defaultGoldenSnapshotWait = 20 * time.Second ) type ActorTemplateReconciler struct { @@ -108,8 +110,12 @@ func (r *ActorTemplateReconciler) Reconcile(ctx context.Context, req ctrl.Reques return ctrl.Result{}, fmt.Errorf("while resuming golden actor: %w", err) } + wait := defaultGoldenSnapshotWait + if at.Spec.GoldenSnapshotWait != nil { + wait = at.Spec.GoldenSnapshotWait.Duration + } at.Status.Phase = atev1alpha1.PhaseWaitGoldenActor - at.Status.TakeGoldenSnapshotAt = metav1.NewTime(time.Now().Add(20 * time.Second)) + at.Status.TakeGoldenSnapshotAt = metav1.NewTime(time.Now().Add(wait)) if err := r.Status().Update(ctx, at); err != nil { return ctrl.Result{}, err } diff --git a/manifests/ate-install/generated/ate.dev_actortemplates.yaml b/manifests/ate-install/generated/ate.dev_actortemplates.yaml index 97de71c77..bb27d21ce 100644 --- a/manifests/ate-install/generated/ate.dev_actortemplates.yaml +++ b/manifests/ate-install/generated/ate.dev_actortemplates.yaml @@ -132,6 +132,12 @@ spec: type: object maxItems: 10 type: array + goldenSnapshotWait: + description: |- + GoldenSnapshotWait is how long to wait after the golden actor resumes + before taking the snapshot. Slow-booting workloads + may need longer than the 20-second default. + type: string pauseImage: description: |- PauseImage is the container to use as the root sandbox container. diff --git a/pkg/api/v1alpha1/actortemplate_types.go b/pkg/api/v1alpha1/actortemplate_types.go index 57dc551b3..1ecbc32d6 100644 --- a/pkg/api/v1alpha1/actortemplate_types.go +++ b/pkg/api/v1alpha1/actortemplate_types.go @@ -96,6 +96,13 @@ type ActorTemplateSpec struct { // // +required Runsc RunscConfig `json:"runsc,omitempty"` + + // GoldenSnapshotWait is how long to wait after the golden actor resumes + // before taking the snapshot. Slow-booting workloads + // may need longer than the 20-second default. + // + // +optional + GoldenSnapshotWait *metav1.Duration `json:"goldenSnapshotWait,omitempty"` } type GCPAuthenticationConfig struct { diff --git a/pkg/api/v1alpha1/zz_generated.deepcopy.go b/pkg/api/v1alpha1/zz_generated.deepcopy.go index 62a0a49ac..f88f9677d 100644 --- a/pkg/api/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/api/v1alpha1/zz_generated.deepcopy.go @@ -96,6 +96,11 @@ func (in *ActorTemplateSpec) DeepCopyInto(out *ActorTemplateSpec) { out.SnapshotsConfig = in.SnapshotsConfig out.WorkerPoolRef = in.WorkerPoolRef in.Runsc.DeepCopyInto(&out.Runsc) + if in.GoldenSnapshotWait != nil { + in, out := &in.GoldenSnapshotWait, &out.GoldenSnapshotWait + *out = new(metav1.Duration) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ActorTemplateSpec.