status: record progressing
Set ready condition to unknown while the reconciliation is progressing. This allows other operators to wait for a sync to complete.
This commit is contained in:
parent
9af721f431
commit
8071dadbf0
|
@ -69,4 +69,8 @@ const (
|
||||||
// VerificationFailedReason represents the fact that the cryptographic provenance
|
// VerificationFailedReason represents the fact that the cryptographic provenance
|
||||||
// verification for the source failed.
|
// verification for the source failed.
|
||||||
VerificationFailedReason string = "VerificationFailed"
|
VerificationFailedReason string = "VerificationFailed"
|
||||||
|
|
||||||
|
// ProgressingReason represents the fact that a source reconciliation
|
||||||
|
// is underway.
|
||||||
|
ProgressingReason string = "Progressing"
|
||||||
)
|
)
|
||||||
|
|
|
@ -113,7 +113,7 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
// GitRepositoryReady sets the given artifact and url on the
|
// GitRepositoryReady sets the given artifact and url on the
|
||||||
// HelmRepository and resets the conditions to SourceCondition of
|
// GitRepository and resets the conditions to SourceCondition of
|
||||||
// type Ready with status true and the given reason and message.
|
// type Ready with status true and the given reason and message.
|
||||||
// It returns the modified GitRepository.
|
// It returns the modified GitRepository.
|
||||||
func GitRepositoryReady(repository GitRepository, artifact Artifact, url, reason, message string) GitRepository {
|
func GitRepositoryReady(repository GitRepository, artifact Artifact, url, reason, message string) GitRepository {
|
||||||
|
@ -139,7 +139,23 @@ func GitRepositoryReady(repository GitRepository, artifact Artifact, url, reason
|
||||||
return repository
|
return repository
|
||||||
}
|
}
|
||||||
|
|
||||||
// GitRepositoryNotReady resets the conditions of the HelmRepository
|
// GitRepositoryProgressing resets the conditions of the GitRepository
|
||||||
|
// to SourceCondition of type Ready with status unknown and
|
||||||
|
// progressing reason and message. It returns the modified GitRepository.
|
||||||
|
func GitRepositoryProgressing(repository GitRepository) GitRepository {
|
||||||
|
repository.Status.Conditions = []SourceCondition{
|
||||||
|
{
|
||||||
|
Type: ReadyCondition,
|
||||||
|
Status: corev1.ConditionUnknown,
|
||||||
|
LastTransitionTime: metav1.Now(),
|
||||||
|
Reason: ProgressingReason,
|
||||||
|
Message: "reconciliation in progress",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return repository
|
||||||
|
}
|
||||||
|
|
||||||
|
// GitRepositoryNotReady resets the conditions of the GitRepository
|
||||||
// to SourceCondition of type Ready with status false and the given
|
// to SourceCondition of type Ready with status false and the given
|
||||||
// reason and message. It returns the modified GitRepository.
|
// reason and message. It returns the modified GitRepository.
|
||||||
func GitRepositoryNotReady(repository GitRepository, reason, message string) GitRepository {
|
func GitRepositoryNotReady(repository GitRepository, reason, message string) GitRepository {
|
||||||
|
|
|
@ -93,6 +93,22 @@ func HelmChartReady(chart HelmChart, artifact Artifact, url, reason, message str
|
||||||
return chart
|
return chart
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HelmChartProgressing resets the conditions of the HelmChart
|
||||||
|
// to SourceCondition of type Ready with status unknown and
|
||||||
|
// progressing reason and message. It returns the modified HelmChart.
|
||||||
|
func HelmChartProgressing(chart HelmChart) HelmChart {
|
||||||
|
chart.Status.Conditions = []SourceCondition{
|
||||||
|
{
|
||||||
|
Type: ReadyCondition,
|
||||||
|
Status: corev1.ConditionUnknown,
|
||||||
|
LastTransitionTime: metav1.Now(),
|
||||||
|
Reason: ProgressingReason,
|
||||||
|
Message: "reconciliation in progress",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return chart
|
||||||
|
}
|
||||||
|
|
||||||
// HelmChartNotReady resets the conditions of the HelmChart to
|
// HelmChartNotReady resets the conditions of the HelmChart to
|
||||||
// SourceCondition of type Ready with status false and the given
|
// SourceCondition of type Ready with status false and the given
|
||||||
// reason and message. It returns the modified HelmChart.
|
// reason and message. It returns the modified HelmChart.
|
||||||
|
|
|
@ -92,6 +92,22 @@ func HelmRepositoryReady(repository HelmRepository, artifact Artifact, url, reas
|
||||||
return repository
|
return repository
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HelmRepositoryProgressing resets the conditions of the HelmRepository
|
||||||
|
// to SourceCondition of type Ready with status unknown and
|
||||||
|
// progressing reason and message. It returns the modified HelmRepository.
|
||||||
|
func HelmRepositoryProgressing(repository HelmRepository) HelmRepository {
|
||||||
|
repository.Status.Conditions = []SourceCondition{
|
||||||
|
{
|
||||||
|
Type: ReadyCondition,
|
||||||
|
Status: corev1.ConditionUnknown,
|
||||||
|
LastTransitionTime: metav1.Now(),
|
||||||
|
Reason: ProgressingReason,
|
||||||
|
Message: "reconciliation in progress",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return repository
|
||||||
|
}
|
||||||
|
|
||||||
// HelmRepositoryNotReady resets the conditions of the HelmRepository
|
// HelmRepositoryNotReady resets the conditions of the HelmRepository
|
||||||
// to SourceCondition of type Ready with status false and the given
|
// to SourceCondition of type Ready with status false and the given
|
||||||
// reason and message. It returns the modified HelmRepository.
|
// reason and message. It returns the modified HelmRepository.
|
||||||
|
|
|
@ -68,6 +68,12 @@ func (r *GitRepositoryReconciler) Reconcile(req ctrl.Request) (ctrl.Result, erro
|
||||||
log.Error(err, "unable to update GitRepository status")
|
log.Error(err, "unable to update GitRepository status")
|
||||||
return ctrl.Result{Requeue: true}, err
|
return ctrl.Result{Requeue: true}, err
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
repo = sourcev1.GitRepositoryProgressing(repo)
|
||||||
|
if err := r.Status().Update(ctx, &repo); err != nil {
|
||||||
|
log.Error(err, "unable to update GitRepository status")
|
||||||
|
return ctrl.Result{Requeue: true}, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// try to remove old artifacts
|
// try to remove old artifacts
|
||||||
|
|
|
@ -68,6 +68,12 @@ func (r *HelmChartReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
|
||||||
log.Error(err, "unable to update HelmChart status")
|
log.Error(err, "unable to update HelmChart status")
|
||||||
return ctrl.Result{Requeue: true}, err
|
return ctrl.Result{Requeue: true}, err
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
chart = sourcev1.HelmChartProgressing(chart)
|
||||||
|
if err := r.Status().Update(ctx, &chart); err != nil {
|
||||||
|
log.Error(err, "unable to update HelmChart status")
|
||||||
|
return ctrl.Result{Requeue: true}, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// try to remove old artifacts
|
// try to remove old artifacts
|
||||||
|
|
|
@ -70,6 +70,12 @@ func (r *HelmRepositoryReconciler) Reconcile(req ctrl.Request) (ctrl.Result, err
|
||||||
log.Error(err, "unable to update HelmRepository status")
|
log.Error(err, "unable to update HelmRepository status")
|
||||||
return ctrl.Result{Requeue: true}, err
|
return ctrl.Result{Requeue: true}, err
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
repository = sourcev1.HelmRepositoryProgressing(repository)
|
||||||
|
if err := r.Status().Update(ctx, &repository); err != nil {
|
||||||
|
log.Error(err, "unable to update HelmRepository status")
|
||||||
|
return ctrl.Result{Requeue: true}, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// try to remove old artifacts
|
// try to remove old artifacts
|
||||||
|
|
|
@ -138,6 +138,10 @@ const (
|
||||||
// VerificationFailedReason represents the fact that the cryptographic provenance
|
// VerificationFailedReason represents the fact that the cryptographic provenance
|
||||||
// verification for the source failed.
|
// verification for the source failed.
|
||||||
VerificationFailedReason string = "VerificationFailed"
|
VerificationFailedReason string = "VerificationFailed"
|
||||||
|
|
||||||
|
// ProgressingReason represents the fact that a source reconciliation
|
||||||
|
// is underway.
|
||||||
|
ProgressingReason string = "Progressing"
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue