Mark resources as progressing on spec changes
This commit is contained in:
parent
42706a342b
commit
7a3a5938d3
|
@ -99,6 +99,11 @@ type GitRepositoryVerification struct {
|
|||
|
||||
// GitRepositoryStatus defines the observed state of a Git repository.
|
||||
type GitRepositoryStatus struct {
|
||||
// ObservedGeneration is the last observed generation.
|
||||
// +optional
|
||||
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
|
||||
|
||||
// Conditions holds the conditions for the GitRepository.
|
||||
// +optional
|
||||
Conditions []SourceCondition `json:"conditions,omitempty"`
|
||||
|
||||
|
@ -126,6 +131,7 @@ const (
|
|||
// 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.ObservedGeneration = repository.Generation
|
||||
repository.Status.URL = ""
|
||||
repository.Status.Artifact = nil
|
||||
repository.Status.Conditions = []SourceCondition{}
|
||||
|
|
|
@ -62,6 +62,11 @@ type LocalHelmChartSourceReference struct {
|
|||
|
||||
// HelmChartStatus defines the observed state of the HelmChart.
|
||||
type HelmChartStatus struct {
|
||||
// ObservedGeneration is the last observed generation.
|
||||
// +optional
|
||||
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
|
||||
|
||||
// Conditions holds the conditions for the HelmChart.
|
||||
// +optional
|
||||
Conditions []SourceCondition `json:"conditions,omitempty"`
|
||||
|
||||
|
@ -95,6 +100,7 @@ const (
|
|||
// HelmChartProgressing resets any failures and registers progress toward reconciling the given HelmChart
|
||||
// by setting the ReadyCondition to ConditionUnknown for ProgressingReason.
|
||||
func HelmChartProgressing(chart HelmChart) HelmChart {
|
||||
chart.Status.ObservedGeneration = chart.Generation
|
||||
chart.Status.URL = ""
|
||||
chart.Status.Artifact = nil
|
||||
chart.Status.Conditions = []SourceCondition{}
|
||||
|
|
|
@ -54,6 +54,11 @@ type HelmRepositorySpec struct {
|
|||
|
||||
// HelmRepositoryStatus defines the observed state of the HelmRepository.
|
||||
type HelmRepositoryStatus struct {
|
||||
// ObservedGeneration is the last observed generation.
|
||||
// +optional
|
||||
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
|
||||
|
||||
// Conditions holds the conditions for the HelmRepository.
|
||||
// +optional
|
||||
Conditions []SourceCondition `json:"conditions,omitempty"`
|
||||
|
||||
|
@ -80,6 +85,7 @@ const (
|
|||
// 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.ObservedGeneration = repository.Generation
|
||||
repository.Status.URL = ""
|
||||
repository.Status.Artifact = nil
|
||||
repository.Status.Conditions = []SourceCondition{}
|
||||
|
|
|
@ -153,6 +153,7 @@ spec:
|
|||
- url
|
||||
type: object
|
||||
conditions:
|
||||
description: Conditions holds the conditions for the GitRepository.
|
||||
items:
|
||||
description: SourceCondition contains condition information for
|
||||
a source.
|
||||
|
@ -182,6 +183,10 @@ spec:
|
|||
- type
|
||||
type: object
|
||||
type: array
|
||||
observedGeneration:
|
||||
description: ObservedGeneration is the last observed generation.
|
||||
format: int64
|
||||
type: integer
|
||||
url:
|
||||
description: URL is the download link for the artifact output of the
|
||||
last repository sync.
|
||||
|
|
|
@ -125,6 +125,7 @@ spec:
|
|||
- url
|
||||
type: object
|
||||
conditions:
|
||||
description: Conditions holds the conditions for the HelmChart.
|
||||
items:
|
||||
description: SourceCondition contains condition information for
|
||||
a source.
|
||||
|
@ -154,6 +155,10 @@ spec:
|
|||
- type
|
||||
type: object
|
||||
type: array
|
||||
observedGeneration:
|
||||
description: ObservedGeneration is the last observed generation.
|
||||
format: int64
|
||||
type: integer
|
||||
url:
|
||||
description: URL is the download link for the last chart pulled.
|
||||
type: string
|
||||
|
|
|
@ -105,6 +105,7 @@ spec:
|
|||
- url
|
||||
type: object
|
||||
conditions:
|
||||
description: Conditions holds the conditions for the HelmRepository.
|
||||
items:
|
||||
description: SourceCondition contains condition information for
|
||||
a source.
|
||||
|
@ -134,6 +135,10 @@ spec:
|
|||
- type
|
||||
type: object
|
||||
type: array
|
||||
observedGeneration:
|
||||
description: ObservedGeneration is the last observed generation.
|
||||
format: int64
|
||||
type: integer
|
||||
url:
|
||||
description: URL is the download link for the last index fetched.
|
||||
type: string
|
||||
|
|
|
@ -99,7 +99,8 @@ func (r *GitRepositoryReconciler) Reconcile(req ctrl.Request) (ctrl.Result, erro
|
|||
}
|
||||
|
||||
// set initial status
|
||||
if repository.Generation == 0 || repository.GetArtifact() != nil && !r.Storage.ArtifactExist(*repository.GetArtifact()) {
|
||||
if repository.Generation != repository.Status.ObservedGeneration ||
|
||||
repository.GetArtifact() != nil && !r.Storage.ArtifactExist(*repository.GetArtifact()) {
|
||||
repository = sourcev1.GitRepositoryProgressing(repository)
|
||||
if err := r.Status().Update(ctx, &repository); err != nil {
|
||||
log.Error(err, "unable to update status")
|
||||
|
|
|
@ -104,7 +104,8 @@ func (r *HelmChartReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
|
|||
}
|
||||
|
||||
// set initial status
|
||||
if chart.Generation == 0 || chart.GetArtifact() != nil && !r.Storage.ArtifactExist(*chart.GetArtifact()) {
|
||||
if chart.Generation != chart.Status.ObservedGeneration ||
|
||||
chart.GetArtifact() != nil && !r.Storage.ArtifactExist(*chart.GetArtifact()) {
|
||||
chart = sourcev1.HelmChartProgressing(chart)
|
||||
if err := r.Status().Update(ctx, &chart); err != nil {
|
||||
log.Error(err, "unable to update status")
|
||||
|
|
|
@ -104,7 +104,8 @@ func (r *HelmRepositoryReconciler) Reconcile(req ctrl.Request) (ctrl.Result, err
|
|||
}
|
||||
|
||||
// set initial status
|
||||
if repository.Generation == 0 || repository.GetArtifact() != nil && !r.Storage.ArtifactExist(*repository.GetArtifact()) {
|
||||
if repository.Generation != repository.Status.ObservedGeneration ||
|
||||
repository.GetArtifact() != nil && !r.Storage.ArtifactExist(*repository.GetArtifact()) {
|
||||
repository = sourcev1.HelmRepositoryProgressing(repository)
|
||||
if err := r.Status().Update(ctx, &repository); err != nil {
|
||||
log.Error(err, "unable to update status")
|
||||
|
|
|
@ -744,6 +744,18 @@ are.</p>
|
|||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>observedGeneration</code><br>
|
||||
<em>
|
||||
int64
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<em>(Optional)</em>
|
||||
<p>ObservedGeneration is the last observed generation.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>conditions</code><br>
|
||||
<em>
|
||||
<a href="#source.toolkit.fluxcd.io/v1alpha1.SourceCondition">
|
||||
|
@ -753,6 +765,7 @@ are.</p>
|
|||
</td>
|
||||
<td>
|
||||
<em>(Optional)</em>
|
||||
<p>Conditions holds the conditions for the GitRepository.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -921,6 +934,18 @@ Kubernetes meta/v1.Duration
|
|||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>observedGeneration</code><br>
|
||||
<em>
|
||||
int64
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<em>(Optional)</em>
|
||||
<p>ObservedGeneration is the last observed generation.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>conditions</code><br>
|
||||
<em>
|
||||
<a href="#source.toolkit.fluxcd.io/v1alpha1.SourceCondition">
|
||||
|
@ -930,6 +955,7 @@ Kubernetes meta/v1.Duration
|
|||
</td>
|
||||
<td>
|
||||
<em>(Optional)</em>
|
||||
<p>Conditions holds the conditions for the HelmChart.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -1059,6 +1085,18 @@ Kubernetes meta/v1.Duration
|
|||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>observedGeneration</code><br>
|
||||
<em>
|
||||
int64
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<em>(Optional)</em>
|
||||
<p>ObservedGeneration is the last observed generation.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>conditions</code><br>
|
||||
<em>
|
||||
<a href="#source.toolkit.fluxcd.io/v1alpha1.SourceCondition">
|
||||
|
@ -1068,6 +1106,7 @@ Kubernetes meta/v1.Duration
|
|||
</td>
|
||||
<td>
|
||||
<em>(Optional)</em>
|
||||
<p>Conditions holds the conditions for the HelmRepository.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
Loading…
Reference in New Issue