Use reconcile annotation helpers
Per https://github.com/fluxcd/pkg/issues/39
This commit is contained in:
parent
f39ef787c7
commit
0928cc1e4d
|
@ -3,7 +3,7 @@ module github.com/fluxcd/helm-controller/api
|
||||||
go 1.15
|
go 1.15
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/fluxcd/pkg/apis/meta v0.0.2
|
github.com/fluxcd/pkg/apis/meta v0.1.0
|
||||||
github.com/fluxcd/pkg/runtime v0.1.0
|
github.com/fluxcd/pkg/runtime v0.1.0
|
||||||
k8s.io/api v0.18.9
|
k8s.io/api v0.18.9
|
||||||
k8s.io/apiextensions-apiserver v0.18.9
|
k8s.io/apiextensions-apiserver v0.18.9
|
||||||
|
|
|
@ -63,6 +63,8 @@ github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLi
|
||||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||||
github.com/fluxcd/pkg/apis/meta v0.0.2 h1:kyA4Y0IzNjf1joBOnFqpWG7aNDHvtLExZcaHQM7qhRI=
|
github.com/fluxcd/pkg/apis/meta v0.0.2 h1:kyA4Y0IzNjf1joBOnFqpWG7aNDHvtLExZcaHQM7qhRI=
|
||||||
github.com/fluxcd/pkg/apis/meta v0.0.2/go.mod h1:nCNps5JJOcEQr3MNDmZqI4o0chjePSUYL6Q2ktDtotU=
|
github.com/fluxcd/pkg/apis/meta v0.0.2/go.mod h1:nCNps5JJOcEQr3MNDmZqI4o0chjePSUYL6Q2ktDtotU=
|
||||||
|
github.com/fluxcd/pkg/apis/meta v0.1.0 h1:CfOYHYaHslhcb3QlzgKCOXl4ziCbA5zG/fUa1qFlHis=
|
||||||
|
github.com/fluxcd/pkg/apis/meta v0.1.0/go.mod h1:nCNps5JJOcEQr3MNDmZqI4o0chjePSUYL6Q2ktDtotU=
|
||||||
github.com/fluxcd/pkg/runtime v0.1.0 h1:mCLj5GlQZqWtK3tvtZTmfgFOLsTUY1iqg3CmEyS1nRs=
|
github.com/fluxcd/pkg/runtime v0.1.0 h1:mCLj5GlQZqWtK3tvtZTmfgFOLsTUY1iqg3CmEyS1nRs=
|
||||||
github.com/fluxcd/pkg/runtime v0.1.0/go.mod h1:OXkrYtDLw3GhclbzvnzfSktUyxRmC3FFhXj0tVVaIX8=
|
github.com/fluxcd/pkg/runtime v0.1.0/go.mod h1:OXkrYtDLw3GhclbzvnzfSktUyxRmC3FFhXj0tVVaIX8=
|
||||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||||
|
|
|
@ -627,10 +627,7 @@ type HelmReleaseStatus struct {
|
||||||
// +optional
|
// +optional
|
||||||
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
|
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
|
||||||
|
|
||||||
// LastHandledReconcileAt is the last manual reconciliation request (by
|
meta.ReconcileRequestStatus `json:",inline"`
|
||||||
// annotating the HelmRelease) handled by the reconciler.
|
|
||||||
// +optional
|
|
||||||
LastHandledReconcileAt string `json:"lastHandledReconcileAt,omitempty"`
|
|
||||||
|
|
||||||
// Conditions holds the conditions for the HelmRelease.
|
// Conditions holds the conditions for the HelmRelease.
|
||||||
// +optional
|
// +optional
|
||||||
|
|
|
@ -214,6 +214,7 @@ func (in *HelmReleaseSpec) DeepCopy() *HelmReleaseSpec {
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *HelmReleaseStatus) DeepCopyInto(out *HelmReleaseStatus) {
|
func (in *HelmReleaseStatus) DeepCopyInto(out *HelmReleaseStatus) {
|
||||||
*out = *in
|
*out = *in
|
||||||
|
out.ReconcileRequestStatus = in.ReconcileRequestStatus
|
||||||
if in.Conditions != nil {
|
if in.Conditions != nil {
|
||||||
in, out := &in.Conditions, &out.Conditions
|
in, out := &in.Conditions, &out.Conditions
|
||||||
*out = make([]meta.Condition, len(*in))
|
*out = make([]meta.Condition, len(*in))
|
||||||
|
|
|
@ -474,8 +474,8 @@ spec:
|
||||||
values of the last reconciliation attempt.
|
values of the last reconciliation attempt.
|
||||||
type: string
|
type: string
|
||||||
lastHandledReconcileAt:
|
lastHandledReconcileAt:
|
||||||
description: LastHandledReconcileAt is the last manual reconciliation
|
description: LastHandledReconcileAt holds the value of the most recent
|
||||||
request (by annotating the HelmRelease) handled by the reconciler.
|
reconcile request value, so a change can be detected.
|
||||||
type: string
|
type: string
|
||||||
lastReleaseRevision:
|
lastReleaseRevision:
|
||||||
description: LastReleaseRevision is the revision of the last successful
|
description: LastReleaseRevision is the revision of the last successful
|
||||||
|
|
|
@ -115,7 +115,7 @@ func (r *HelmChartWatcher) requestReconciliation(ctx context.Context, hr v2.Helm
|
||||||
if hr.Annotations == nil {
|
if hr.Annotations == nil {
|
||||||
hr.Annotations = make(map[string]string)
|
hr.Annotations = make(map[string]string)
|
||||||
}
|
}
|
||||||
hr.Annotations[meta.ReconcileAtAnnotation] = metav1.Now().String()
|
hr.Annotations[meta.ReconcileRequestAnnotation] = metav1.Now().String()
|
||||||
err = r.Update(ctx, &hr)
|
err = r.Update(ctx, &hr)
|
||||||
return
|
return
|
||||||
})
|
})
|
||||||
|
|
|
@ -152,8 +152,8 @@ func (r *HelmReleaseReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error)
|
||||||
func (r *HelmReleaseReconciler) reconcile(ctx context.Context, log logr.Logger, hr v2.HelmRelease) (v2.HelmRelease, ctrl.Result, error) {
|
func (r *HelmReleaseReconciler) reconcile(ctx context.Context, log logr.Logger, hr v2.HelmRelease) (v2.HelmRelease, ctrl.Result, error) {
|
||||||
reconcileStart := time.Now()
|
reconcileStart := time.Now()
|
||||||
// Record the value of the reconciliation request, if any
|
// Record the value of the reconciliation request, if any
|
||||||
if v, ok := hr.GetAnnotations()[meta.ReconcileAtAnnotation]; ok {
|
if v, ok := meta.ReconcileAnnotationValue(hr.GetAnnotations()); ok {
|
||||||
hr.Status.LastHandledReconcileAt = v
|
hr.Status.SetLastHandledReconcileRequest(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Observe HelmRelease generation.
|
// Observe HelmRelease generation.
|
||||||
|
|
|
@ -846,15 +846,17 @@ int64
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<code>lastHandledReconcileAt</code><br>
|
<code>ReconcileRequestStatus</code><br>
|
||||||
<em>
|
<em>
|
||||||
string
|
<a href="https://godoc.org/github.com/fluxcd/pkg/apis/meta#ReconcileRequestStatus">
|
||||||
|
github.com/fluxcd/pkg/apis/meta.ReconcileRequestStatus
|
||||||
|
</a>
|
||||||
</em>
|
</em>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<em>(Optional)</em>
|
<p>
|
||||||
<p>LastHandledReconcileAt is the last manual reconciliation request (by
|
(Members of <code>ReconcileRequestStatus</code> are embedded into this type.)
|
||||||
annotating the HelmRelease) handled by the reconciler.</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
4
go.mod
4
go.mod
|
@ -6,8 +6,8 @@ replace github.com/fluxcd/helm-controller/api => ./api
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/fluxcd/helm-controller/api v0.1.3
|
github.com/fluxcd/helm-controller/api v0.1.3
|
||||||
github.com/fluxcd/pkg/apis/meta v0.0.2
|
github.com/fluxcd/pkg/apis/meta v0.1.0
|
||||||
github.com/fluxcd/pkg/runtime v0.1.0
|
github.com/fluxcd/pkg/runtime v0.1.2
|
||||||
github.com/fluxcd/source-controller/api v0.1.1
|
github.com/fluxcd/source-controller/api v0.1.1
|
||||||
github.com/go-logr/logr v0.1.0
|
github.com/go-logr/logr v0.1.0
|
||||||
github.com/onsi/ginkgo v1.12.1
|
github.com/onsi/ginkgo v1.12.1
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -194,8 +194,12 @@ github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
|
||||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||||
github.com/fluxcd/pkg/apis/meta v0.0.2 h1:kyA4Y0IzNjf1joBOnFqpWG7aNDHvtLExZcaHQM7qhRI=
|
github.com/fluxcd/pkg/apis/meta v0.0.2 h1:kyA4Y0IzNjf1joBOnFqpWG7aNDHvtLExZcaHQM7qhRI=
|
||||||
github.com/fluxcd/pkg/apis/meta v0.0.2/go.mod h1:nCNps5JJOcEQr3MNDmZqI4o0chjePSUYL6Q2ktDtotU=
|
github.com/fluxcd/pkg/apis/meta v0.0.2/go.mod h1:nCNps5JJOcEQr3MNDmZqI4o0chjePSUYL6Q2ktDtotU=
|
||||||
|
github.com/fluxcd/pkg/apis/meta v0.1.0 h1:CfOYHYaHslhcb3QlzgKCOXl4ziCbA5zG/fUa1qFlHis=
|
||||||
|
github.com/fluxcd/pkg/apis/meta v0.1.0/go.mod h1:nCNps5JJOcEQr3MNDmZqI4o0chjePSUYL6Q2ktDtotU=
|
||||||
github.com/fluxcd/pkg/runtime v0.1.0 h1:mCLj5GlQZqWtK3tvtZTmfgFOLsTUY1iqg3CmEyS1nRs=
|
github.com/fluxcd/pkg/runtime v0.1.0 h1:mCLj5GlQZqWtK3tvtZTmfgFOLsTUY1iqg3CmEyS1nRs=
|
||||||
github.com/fluxcd/pkg/runtime v0.1.0/go.mod h1:OXkrYtDLw3GhclbzvnzfSktUyxRmC3FFhXj0tVVaIX8=
|
github.com/fluxcd/pkg/runtime v0.1.0/go.mod h1:OXkrYtDLw3GhclbzvnzfSktUyxRmC3FFhXj0tVVaIX8=
|
||||||
|
github.com/fluxcd/pkg/runtime v0.1.2 h1:bKhjJGVOJgTQTWjqhwasyt69lBItq1ZWjX04rUkiypo=
|
||||||
|
github.com/fluxcd/pkg/runtime v0.1.2/go.mod h1:HXYTNdkK8ulcT1mhuGhio9tsX65ACKaealtd/MsnkhM=
|
||||||
github.com/fluxcd/source-controller/api v0.1.1 h1:BYxl9qc8pCx3/Bn1885TlkJPwvXqz+rAL9mzpnCrj9A=
|
github.com/fluxcd/source-controller/api v0.1.1 h1:BYxl9qc8pCx3/Bn1885TlkJPwvXqz+rAL9mzpnCrj9A=
|
||||||
github.com/fluxcd/source-controller/api v0.1.1/go.mod h1:1ac/vj49YVPKF+xBHTo/9pfFj64TcLc1RLaxi4MwVEM=
|
github.com/fluxcd/source-controller/api v0.1.1/go.mod h1:1ac/vj49YVPKF+xBHTo/9pfFj64TcLc1RLaxi4MwVEM=
|
||||||
github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4=
|
github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4=
|
||||||
|
|
|
@ -24,8 +24,8 @@
|
||||||
"docsURLTemplate": "https://godoc.org/github.com/fluxcd/pkg/runtime/dependency#CrossNamespaceDependencyReference"
|
"docsURLTemplate": "https://godoc.org/github.com/fluxcd/pkg/runtime/dependency#CrossNamespaceDependencyReference"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"typeMatchPrefix": "^github.com/fluxcd/pkg/apis/meta\\.Condition$",
|
"typeMatchPrefix": "^github.com/fluxcd/pkg/apis/meta",
|
||||||
"docsURLTemplate": "https://godoc.org/github.com/fluxcd/pkg/apis/meta#Condition"
|
"docsURLTemplate": "https://godoc.org/github.com/fluxcd/pkg/apis/meta#{{ .TypeIdentifier }}"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"typeDisplayNamePrefixOverrides": {
|
"typeDisplayNamePrefixOverrides": {
|
||||||
|
|
Loading…
Reference in New Issue