Compare commits
2 Commits
91ce588090
...
4b39bd41d7
| Author | SHA1 | Date |
|---|---|---|
|
|
4b39bd41d7 | |
|
|
ebb857b325 |
|
|
@ -72,11 +72,16 @@ type RunnerDeploymentStatus struct {
|
||||||
// Replicas is the total number of replicas
|
// Replicas is the total number of replicas
|
||||||
// +optional
|
// +optional
|
||||||
Replicas *int `json:"replicas"`
|
Replicas *int `json:"replicas"`
|
||||||
|
|
||||||
|
// Selector is the string form of the pod selector
|
||||||
|
// +optional
|
||||||
|
Selector string `json:"selector"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// +kubebuilder:object:root=true
|
// +kubebuilder:object:root=true
|
||||||
// +kubebuilder:resource:shortName=rdeploy
|
// +kubebuilder:resource:shortName=rdeploy
|
||||||
// +kubebuilder:subresource:status
|
// +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.enterprise",name=Enterprise,type=string
|
||||||
// +kubebuilder:printcolumn:JSONPath=".spec.template.spec.organization",name=Organization,type=string
|
// +kubebuilder:printcolumn:JSONPath=".spec.template.spec.organization",name=Organization,type=string
|
||||||
// +kubebuilder:printcolumn:JSONPath=".spec.template.spec.repository",name=Repository,type=string
|
// +kubebuilder:printcolumn:JSONPath=".spec.template.spec.repository",name=Repository,type=string
|
||||||
|
|
|
||||||
|
|
@ -69,10 +69,15 @@ type RunnerSetStatus struct {
|
||||||
// Replicas is the total number of replicas
|
// Replicas is the total number of replicas
|
||||||
// +optional
|
// +optional
|
||||||
Replicas *int `json:"replicas"`
|
Replicas *int `json:"replicas"`
|
||||||
|
|
||||||
|
// Selector is the string form of the pod selector
|
||||||
|
// +optional
|
||||||
|
Selector string `json:"selector"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// +kubebuilder:object:root=true
|
// +kubebuilder:object:root=true
|
||||||
// +kubebuilder:subresource:status
|
// +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=".spec.replicas",name=Desired,type=number
|
||||||
// +kubebuilder:printcolumn:JSONPath=".status.replicas",name=Current,type=number
|
// +kubebuilder:printcolumn:JSONPath=".status.replicas",name=Current,type=number
|
||||||
// +kubebuilder:printcolumn:JSONPath=".status.updatedReplicas",name=Up-To-Date,type=number
|
// +kubebuilder:printcolumn:JSONPath=".status.updatedReplicas",name=Up-To-Date,type=number
|
||||||
|
|
|
||||||
|
|
@ -9882,6 +9882,9 @@ spec:
|
||||||
replicas:
|
replicas:
|
||||||
description: Replicas is the total number of replicas
|
description: Replicas is the total number of replicas
|
||||||
type: integer
|
type: integer
|
||||||
|
selector:
|
||||||
|
description: Selector is the string form of the pod selector
|
||||||
|
type: string
|
||||||
updatedReplicas:
|
updatedReplicas:
|
||||||
description: |-
|
description: |-
|
||||||
ReadyReplicas is the total number of available runners which have been successfully registered to GitHub and still running.
|
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
|
served: true
|
||||||
storage: true
|
storage: true
|
||||||
subresources:
|
subresources:
|
||||||
|
scale:
|
||||||
|
labelSelectorPath: .status.selector
|
||||||
|
specReplicasPath: .spec.replicas
|
||||||
|
statusReplicasPath: .status.replicas
|
||||||
status: {}
|
status: {}
|
||||||
|
|
|
||||||
|
|
@ -8759,6 +8759,9 @@ spec:
|
||||||
replicas:
|
replicas:
|
||||||
description: Replicas is the total number of replicas
|
description: Replicas is the total number of replicas
|
||||||
type: integer
|
type: integer
|
||||||
|
selector:
|
||||||
|
description: Selector is the string form of the pod selector
|
||||||
|
type: string
|
||||||
updatedReplicas:
|
updatedReplicas:
|
||||||
description: |-
|
description: |-
|
||||||
ReadyReplicas is the total number of available runners which have been successfully registered to GitHub and still running.
|
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
|
served: true
|
||||||
storage: true
|
storage: true
|
||||||
subresources:
|
subresources:
|
||||||
|
scale:
|
||||||
|
labelSelectorPath: .status.selector
|
||||||
|
specReplicasPath: .spec.replicas
|
||||||
|
statusReplicasPath: .status.replicas
|
||||||
status: {}
|
status: {}
|
||||||
|
|
|
||||||
|
|
@ -9882,6 +9882,9 @@ spec:
|
||||||
replicas:
|
replicas:
|
||||||
description: Replicas is the total number of replicas
|
description: Replicas is the total number of replicas
|
||||||
type: integer
|
type: integer
|
||||||
|
selector:
|
||||||
|
description: Selector is the string form of the pod selector
|
||||||
|
type: string
|
||||||
updatedReplicas:
|
updatedReplicas:
|
||||||
description: |-
|
description: |-
|
||||||
ReadyReplicas is the total number of available runners which have been successfully registered to GitHub and still running.
|
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
|
served: true
|
||||||
storage: true
|
storage: true
|
||||||
subresources:
|
subresources:
|
||||||
|
scale:
|
||||||
|
labelSelectorPath: .status.selector
|
||||||
|
specReplicasPath: .spec.replicas
|
||||||
|
statusReplicasPath: .status.replicas
|
||||||
status: {}
|
status: {}
|
||||||
|
|
|
||||||
|
|
@ -8759,6 +8759,9 @@ spec:
|
||||||
replicas:
|
replicas:
|
||||||
description: Replicas is the total number of replicas
|
description: Replicas is the total number of replicas
|
||||||
type: integer
|
type: integer
|
||||||
|
selector:
|
||||||
|
description: Selector is the string form of the pod selector
|
||||||
|
type: string
|
||||||
updatedReplicas:
|
updatedReplicas:
|
||||||
description: |-
|
description: |-
|
||||||
ReadyReplicas is the total number of available runners which have been successfully registered to GitHub and still running.
|
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
|
served: true
|
||||||
storage: true
|
storage: true
|
||||||
subresources:
|
subresources:
|
||||||
|
scale:
|
||||||
|
labelSelectorPath: .status.selector
|
||||||
|
specReplicasPath: .spec.replicas
|
||||||
|
statusReplicasPath: .status.replicas
|
||||||
status: {}
|
status: {}
|
||||||
|
|
|
||||||
|
|
@ -313,6 +313,13 @@ func (r *RunnerDeploymentReconciler) Reconcile(ctx context.Context, req ctrl.Req
|
||||||
status.DesiredReplicas = &newDesiredReplicas
|
status.DesiredReplicas = &newDesiredReplicas
|
||||||
status.Replicas = &totalCurrentReplicas
|
status.Replicas = &totalCurrentReplicas
|
||||||
status.UpdatedReplicas = &updatedReplicas
|
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) {
|
if !reflect.DeepEqual(rd.Status, status) {
|
||||||
updated := rd.DeepCopy()
|
updated := rd.DeepCopy()
|
||||||
|
|
|
||||||
|
|
@ -157,6 +157,13 @@ func (r *RunnerSetReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
|
||||||
status.DesiredReplicas = &newDesiredReplicas
|
status.DesiredReplicas = &newDesiredReplicas
|
||||||
status.Replicas = &statusReplicas
|
status.Replicas = &statusReplicas
|
||||||
status.UpdatedReplicas = &updatedReplicas
|
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) {
|
if !reflect.DeepEqual(runnerSet.Status, status) {
|
||||||
updated := runnerSet.DeepCopy()
|
updated := runnerSet.DeepCopy()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue