Do not mark suspended resource as not ready
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
This commit is contained in:
parent
200d4c0fb6
commit
2312d69a51
|
|
@ -78,8 +78,10 @@ type KustomizationSpec struct {
|
|||
|
||||
// This flag tells the controller to suspend subsequent kustomize executions,
|
||||
// it does not apply to already started executions. Defaults to false.
|
||||
// +kubebuilder:default:=false
|
||||
// +kubebuilder:validation:Optional
|
||||
// +optional
|
||||
Suspend bool `json:"suspend,omitempty"`
|
||||
Suspend bool `json:"suspend"`
|
||||
|
||||
// TargetNamespace sets or overrides the namespace in the
|
||||
// kustomization.yaml file.
|
||||
|
|
@ -233,6 +235,7 @@ const (
|
|||
// +kubebuilder:subresource:status
|
||||
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].status",description=""
|
||||
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].message",description=""
|
||||
// +kubebuilder:printcolumn:name="Suspended",type="boolean",JSONPath=".spec.suspend",description=""
|
||||
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description=""
|
||||
|
||||
// Kustomization is the Schema for the kustomizations API.
|
||||
|
|
|
|||
|
|
@ -25,6 +25,9 @@ spec:
|
|||
- jsonPath: .status.conditions[?(@.type=="Ready")].message
|
||||
name: Status
|
||||
type: string
|
||||
- jsonPath: .spec.suspend
|
||||
name: Suspended
|
||||
type: boolean
|
||||
- jsonPath: .metadata.creationTimestamp
|
||||
name: Age
|
||||
type: date
|
||||
|
|
@ -170,6 +173,7 @@ spec:
|
|||
- name
|
||||
type: object
|
||||
suspend:
|
||||
default: false
|
||||
description: This flag tells the controller to suspend subsequent
|
||||
kustomize executions, it does not apply to already started executions.
|
||||
Defaults to false.
|
||||
|
|
|
|||
|
|
@ -164,15 +164,9 @@ func (r *KustomizationReconciler) Reconcile(req ctrl.Request) (ctrl.Result, erro
|
|||
return r.reconcileDelete(ctx, log, kustomization)
|
||||
}
|
||||
|
||||
// Return early if the Kustomization is suspended.
|
||||
if kustomization.Spec.Suspend {
|
||||
msg := "Kustomization is suspended, skipping reconciliation"
|
||||
kustomization = kustomizev1.KustomizationNotReady(kustomization, "", meta.SuspendedReason, msg)
|
||||
if err := r.updateStatus(ctx, req, kustomization.Status); err != nil {
|
||||
log.Error(err, "unable to update status")
|
||||
return ctrl.Result{Requeue: true}, err
|
||||
}
|
||||
r.recordReadiness(kustomization)
|
||||
log.Info(msg)
|
||||
log.Info("Reconciliation is suspended for this object")
|
||||
return ctrl.Result{}, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue