From 1435f1d366028d932661ea5515aca1c1cb1ebb47 Mon Sep 17 00:00:00 2001 From: Nikola Jokic Date: Fri, 12 Jun 2026 17:10:10 +0200 Subject: [PATCH] Fix ephemeral runner set status update --- .../v1alpha1/autoscalingrunnerset_types.go | 1 + apis/actions.github.com/v1alpha1/ephemeralrunnerset_types.go | 4 ++++ .../crds/actions.github.com_autoscalingrunnersets.yaml | 1 + .../crds/actions.github.com_ephemeralrunnersets.yaml | 4 ++++ .../crds/actions.github.com_autoscalingrunnersets.yaml | 1 + .../crds/actions.github.com_ephemeralrunnersets.yaml | 4 ++++ .../templates/_mode_kubernetes.tpl | 5 ++++- .../crd/bases/actions.github.com_autoscalingrunnersets.yaml | 1 + config/crd/bases/actions.github.com_ephemeralrunnersets.yaml | 4 ++++ .../actions.github.com/ephemeralrunnerset_controller.go | 3 +-- 10 files changed, 25 insertions(+), 3 deletions(-) diff --git a/apis/actions.github.com/v1alpha1/autoscalingrunnerset_types.go b/apis/actions.github.com/v1alpha1/autoscalingrunnerset_types.go index 24ccc8e3..09f01488 100644 --- a/apis/actions.github.com/v1alpha1/autoscalingrunnerset_types.go +++ b/apis/actions.github.com/v1alpha1/autoscalingrunnerset_types.go @@ -315,6 +315,7 @@ type HistogramMetric struct { // AutoscalingRunnerSetStatus defines the observed state of AutoscalingRunnerSet type AutoscalingRunnerSetStatus struct { // +optional + // +kubebuilder:validation:Minimum=0 CurrentRunners int `json:"currentRunners"` // +optional diff --git a/apis/actions.github.com/v1alpha1/ephemeralrunnerset_types.go b/apis/actions.github.com/v1alpha1/ephemeralrunnerset_types.go index bfcd424d..9bdd8de3 100644 --- a/apis/actions.github.com/v1alpha1/ephemeralrunnerset_types.go +++ b/apis/actions.github.com/v1alpha1/ephemeralrunnerset_types.go @@ -38,12 +38,16 @@ type EphemeralRunnerSetSpec struct { // EphemeralRunnerSetStatus defines the observed state of EphemeralRunnerSet type EphemeralRunnerSetStatus struct { // CurrentReplicas is the number of currently running EphemeralRunner resources being managed by this EphemeralRunnerSet. + // +kubebuilder:validation:Minimum=0 CurrentReplicas int `json:"currentReplicas"` // +optional + // +kubebuilder:validation:Minimum=0 PendingEphemeralRunners int `json:"pendingEphemeralRunners"` // +optional + // +kubebuilder:validation:Minimum=0 RunningEphemeralRunners int `json:"runningEphemeralRunners"` // +optional + // +kubebuilder:validation:Minimum=0 FailedEphemeralRunners int `json:"failedEphemeralRunners"` // +optional Phase EphemeralRunnerSetPhase `json:"phase"` diff --git a/charts/gha-runner-scale-set-controller-experimental/crds/actions.github.com_autoscalingrunnersets.yaml b/charts/gha-runner-scale-set-controller-experimental/crds/actions.github.com_autoscalingrunnersets.yaml index 82001c24..d02ff80e 100644 --- a/charts/gha-runner-scale-set-controller-experimental/crds/actions.github.com_autoscalingrunnersets.yaml +++ b/charts/gha-runner-scale-set-controller-experimental/crds/actions.github.com_autoscalingrunnersets.yaml @@ -16544,6 +16544,7 @@ spec: description: AutoscalingRunnerSetStatus defines the observed state of AutoscalingRunnerSet properties: currentRunners: + minimum: 0 type: integer failedEphemeralRunners: type: integer diff --git a/charts/gha-runner-scale-set-controller-experimental/crds/actions.github.com_ephemeralrunnersets.yaml b/charts/gha-runner-scale-set-controller-experimental/crds/actions.github.com_ephemeralrunnersets.yaml index ae035cfb..b7a8d5e9 100644 --- a/charts/gha-runner-scale-set-controller-experimental/crds/actions.github.com_ephemeralrunnersets.yaml +++ b/charts/gha-runner-scale-set-controller-experimental/crds/actions.github.com_ephemeralrunnersets.yaml @@ -8315,15 +8315,19 @@ spec: properties: currentReplicas: description: CurrentReplicas is the number of currently running EphemeralRunner resources being managed by this EphemeralRunnerSet. + minimum: 0 type: integer failedEphemeralRunners: + minimum: 0 type: integer pendingEphemeralRunners: + minimum: 0 type: integer phase: description: EphemeralRunnerSetPhase is the phase of the ephemeral runner set resource type: string runningEphemeralRunners: + minimum: 0 type: integer required: - currentReplicas diff --git a/charts/gha-runner-scale-set-controller/crds/actions.github.com_autoscalingrunnersets.yaml b/charts/gha-runner-scale-set-controller/crds/actions.github.com_autoscalingrunnersets.yaml index 82001c24..d02ff80e 100644 --- a/charts/gha-runner-scale-set-controller/crds/actions.github.com_autoscalingrunnersets.yaml +++ b/charts/gha-runner-scale-set-controller/crds/actions.github.com_autoscalingrunnersets.yaml @@ -16544,6 +16544,7 @@ spec: description: AutoscalingRunnerSetStatus defines the observed state of AutoscalingRunnerSet properties: currentRunners: + minimum: 0 type: integer failedEphemeralRunners: type: integer diff --git a/charts/gha-runner-scale-set-controller/crds/actions.github.com_ephemeralrunnersets.yaml b/charts/gha-runner-scale-set-controller/crds/actions.github.com_ephemeralrunnersets.yaml index ae035cfb..b7a8d5e9 100644 --- a/charts/gha-runner-scale-set-controller/crds/actions.github.com_ephemeralrunnersets.yaml +++ b/charts/gha-runner-scale-set-controller/crds/actions.github.com_ephemeralrunnersets.yaml @@ -8315,15 +8315,19 @@ spec: properties: currentReplicas: description: CurrentReplicas is the number of currently running EphemeralRunner resources being managed by this EphemeralRunnerSet. + minimum: 0 type: integer failedEphemeralRunners: + minimum: 0 type: integer pendingEphemeralRunners: + minimum: 0 type: integer phase: description: EphemeralRunnerSetPhase is the phase of the ephemeral runner set resource type: string runningEphemeralRunners: + minimum: 0 type: integer required: - currentReplicas diff --git a/charts/gha-runner-scale-set-experimental/templates/_mode_kubernetes.tpl b/charts/gha-runner-scale-set-experimental/templates/_mode_kubernetes.tpl index 6589d01d..90800e80 100644 --- a/charts/gha-runner-scale-set-experimental/templates/_mode_kubernetes.tpl +++ b/charts/gha-runner-scale-set-experimental/templates/_mode_kubernetes.tpl @@ -82,7 +82,10 @@ volumeMounts: subPath: extension readOnly: true {{- end }} - {{ include "githubServerTLS.volumeMountItem" (dict "root" $ "existingVolumeMounts" (list)) | nindent 2 }} + {{- with .Values.runner.container.volumeMounts }} + {{- toYaml . | nindent 2 }} + {{- end }} + {{ include "githubServerTLS.volumeMountItem" (dict "root" $ "existingVolumeMounts" (.Values.runner.container.volumeMounts | default list)) | nindent 2 }} {{- end }} {{- define "runner-mode-kubernetes.pod-volumes" -}} diff --git a/config/crd/bases/actions.github.com_autoscalingrunnersets.yaml b/config/crd/bases/actions.github.com_autoscalingrunnersets.yaml index 82001c24..d02ff80e 100644 --- a/config/crd/bases/actions.github.com_autoscalingrunnersets.yaml +++ b/config/crd/bases/actions.github.com_autoscalingrunnersets.yaml @@ -16544,6 +16544,7 @@ spec: description: AutoscalingRunnerSetStatus defines the observed state of AutoscalingRunnerSet properties: currentRunners: + minimum: 0 type: integer failedEphemeralRunners: type: integer diff --git a/config/crd/bases/actions.github.com_ephemeralrunnersets.yaml b/config/crd/bases/actions.github.com_ephemeralrunnersets.yaml index ae035cfb..b7a8d5e9 100644 --- a/config/crd/bases/actions.github.com_ephemeralrunnersets.yaml +++ b/config/crd/bases/actions.github.com_ephemeralrunnersets.yaml @@ -8315,15 +8315,19 @@ spec: properties: currentReplicas: description: CurrentReplicas is the number of currently running EphemeralRunner resources being managed by this EphemeralRunnerSet. + minimum: 0 type: integer failedEphemeralRunners: + minimum: 0 type: integer pendingEphemeralRunners: + minimum: 0 type: integer phase: description: EphemeralRunnerSetPhase is the phase of the ephemeral runner set resource type: string runningEphemeralRunners: + minimum: 0 type: integer required: - currentReplicas diff --git a/controllers/actions.github.com/ephemeralrunnerset_controller.go b/controllers/actions.github.com/ephemeralrunnerset_controller.go index 381c9d29..f8b5f490 100644 --- a/controllers/actions.github.com/ephemeralrunnerset_controller.go +++ b/controllers/actions.github.com/ephemeralrunnerset_controller.go @@ -271,7 +271,6 @@ func (r *EphemeralRunnerSetReconciler) Reconcile(ctx context.Context, req ctrl.R } func (r *EphemeralRunnerSetReconciler) updateStatus(ctx context.Context, ephemeralRunnerSet *v1alpha1.EphemeralRunnerSet, state *ephemeralRunnersByState, log logr.Logger) error { - original := ephemeralRunnerSet.DeepCopy() total := state.scaleTotal() var phase v1alpha1.EphemeralRunnerSetPhase switch { @@ -293,7 +292,7 @@ func (r *EphemeralRunnerSetReconciler) updateStatus(ctx context.Context, ephemer // Update the status if needed. if ephemeralRunnerSet.Status != desiredStatus { ephemeralRunnerSet.Status = desiredStatus - if err := r.Status().Patch(ctx, ephemeralRunnerSet, client.MergeFrom(original)); err != nil { + if err := r.Status().Update(ctx, ephemeralRunnerSet); err != nil { log.Error(err, "Failed to update EphemeralRunnerSet status") return err }