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