Compare commits

...

3 Commits

Author SHA1 Message Date
Stewart Thomson 91ce588090
Merge ebb857b325 into 0baa4f6b09 2025-10-22 16:41:43 +02:00
dependabot[bot] 0baa4f6b09
Bump github/codeql-action from 3 to 4 in the actions group (#4281)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-22 11:26:36 +02:00
Stewart Thomson ebb857b325
1802_scaling: - add scale subresource kubebuilder directives for runnerdeployment and runnersets 2024-02-14 13:51:19 -05:00
9 changed files with 55 additions and 3 deletions

View File

@ -33,12 +33,12 @@ jobs:
go-version-file: go.mod
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
uses: github/codeql-action/init@v4
with:
languages: go, actions
- name: Autobuild
uses: github/codeql-action/autobuild@v3
uses: github/codeql-action/autobuild@v4
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
uses: github/codeql-action/analyze@v4

View File

@ -72,11 +72,16 @@ type RunnerDeploymentStatus struct {
// Replicas is the total number of replicas
// +optional
Replicas *int `json:"replicas"`
// Selector is the string form of the pod selector
// +optional
Selector string `json:"selector"`
}
// +kubebuilder:object:root=true
// +kubebuilder:resource:shortName=rdeploy
// +kubebuilder:subresource:status
// +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas,selectorpath=.status.selector
// +kubebuilder:printcolumn:JSONPath=".spec.template.spec.enterprise",name=Enterprise,type=string
// +kubebuilder:printcolumn:JSONPath=".spec.template.spec.organization",name=Organization,type=string
// +kubebuilder:printcolumn:JSONPath=".spec.template.spec.repository",name=Repository,type=string

View File

@ -69,10 +69,15 @@ type RunnerSetStatus struct {
// Replicas is the total number of replicas
// +optional
Replicas *int `json:"replicas"`
// Selector is the string form of the pod selector
// +optional
Selector string `json:"selector"`
}
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas,selectorpath=.status.selector
// +kubebuilder:printcolumn:JSONPath=".spec.replicas",name=Desired,type=number
// +kubebuilder:printcolumn:JSONPath=".status.replicas",name=Current,type=number
// +kubebuilder:printcolumn:JSONPath=".status.updatedReplicas",name=Up-To-Date,type=number

View File

@ -9882,6 +9882,9 @@ spec:
replicas:
description: Replicas is the total number of replicas
type: integer
selector:
description: Selector is the string form of the pod selector
type: string
updatedReplicas:
description: |-
ReadyReplicas is the total number of available runners which have been successfully registered to GitHub and still running.
@ -9892,4 +9895,8 @@ spec:
served: true
storage: true
subresources:
scale:
labelSelectorPath: .status.selector
specReplicasPath: .spec.replicas
statusReplicasPath: .status.replicas
status: {}

View File

@ -8759,6 +8759,9 @@ spec:
replicas:
description: Replicas is the total number of replicas
type: integer
selector:
description: Selector is the string form of the pod selector
type: string
updatedReplicas:
description: |-
ReadyReplicas is the total number of available runners which have been successfully registered to GitHub and still running.
@ -8769,4 +8772,8 @@ spec:
served: true
storage: true
subresources:
scale:
labelSelectorPath: .status.selector
specReplicasPath: .spec.replicas
statusReplicasPath: .status.replicas
status: {}

View File

@ -9882,6 +9882,9 @@ spec:
replicas:
description: Replicas is the total number of replicas
type: integer
selector:
description: Selector is the string form of the pod selector
type: string
updatedReplicas:
description: |-
ReadyReplicas is the total number of available runners which have been successfully registered to GitHub and still running.
@ -9892,4 +9895,8 @@ spec:
served: true
storage: true
subresources:
scale:
labelSelectorPath: .status.selector
specReplicasPath: .spec.replicas
statusReplicasPath: .status.replicas
status: {}

View File

@ -8759,6 +8759,9 @@ spec:
replicas:
description: Replicas is the total number of replicas
type: integer
selector:
description: Selector is the string form of the pod selector
type: string
updatedReplicas:
description: |-
ReadyReplicas is the total number of available runners which have been successfully registered to GitHub and still running.
@ -8769,4 +8772,8 @@ spec:
served: true
storage: true
subresources:
scale:
labelSelectorPath: .status.selector
specReplicasPath: .spec.replicas
statusReplicasPath: .status.replicas
status: {}

View File

@ -313,6 +313,13 @@ func (r *RunnerDeploymentReconciler) Reconcile(ctx context.Context, req ctrl.Req
status.DesiredReplicas = &newDesiredReplicas
status.Replicas = &totalCurrentReplicas
status.UpdatedReplicas = &updatedReplicas
selector, err := metav1.LabelSelectorAsSelector(rd.Spec.Selector)
if err != nil {
log.Error(err, "Failed to retrieve pod labels")
return ctrl.Result{}, err
}
status.Selector = selector.String()
if !reflect.DeepEqual(rd.Status, status) {
updated := rd.DeepCopy()

View File

@ -157,6 +157,13 @@ func (r *RunnerSetReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
status.DesiredReplicas = &newDesiredReplicas
status.Replicas = &statusReplicas
status.UpdatedReplicas = &updatedReplicas
selector, err := metav1.LabelSelectorAsSelector(runnerSet.Spec.Selector)
if err != nil {
log.Error(err, "Failed to retrieve pod labels")
return ctrl.Result{}, err
}
status.Selector = selector.String()
if !reflect.DeepEqual(runnerSet.Status, status) {
updated := runnerSet.DeepCopy()