Skip to content

Commit

Permalink
fix: removing reconciliation status (#82)
Browse files Browse the repository at this point in the history
* fix: removing reconciliation status

* using the right version
  • Loading branch information
Skarlso authored Nov 17, 2023
1 parent 3165b5b commit e9afedd
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 16 deletions.
14 changes: 3 additions & 11 deletions controllers/componentsubscription_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,9 @@ import (
"time"

"github.com/Masterminds/semver/v3"
eventv1 "github.com/fluxcd/pkg/apis/event/v1beta1"
"github.com/fluxcd/pkg/apis/meta"
"github.com/fluxcd/pkg/runtime/conditions"
"github.com/fluxcd/pkg/runtime/patch"
rreconcile "github.com/fluxcd/pkg/runtime/reconcile"
"github.com/open-component-model/ocm-controller/pkg/event"
"github.com/open-component-model/ocm-controller/pkg/status"
corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
Expand Down Expand Up @@ -214,7 +211,7 @@ func (r *ComponentSubscriptionReconciler) reconcile(ctx context.Context, obj *v1

// Because of the predicate, this subscription will be reconciled again once there is an update to its status field.
if version == obj.Status.LastAppliedVersion {
r.markAsDone(obj)
status.MarkReady(r.EventRecorder, obj, "Reconciliation success")

return ctrl.Result{RequeueAfter: obj.GetRequeueAfter()}, nil
}
Expand All @@ -241,7 +238,7 @@ func (r *ComponentSubscriptionReconciler) reconcile(ctx context.Context, obj *v1
}

if latestSourceComponentVersion.LessThan(lastAppliedVersion) || latestSourceComponentVersion.Equal(lastAppliedVersion) {
r.markAsDone(obj)
status.MarkReady(r.EventRecorder, obj, "Reconciliation success")

return ctrl.Result{RequeueAfter: obj.GetRequeueAfter()}, nil
}
Expand Down Expand Up @@ -281,13 +278,8 @@ func (r *ComponentSubscriptionReconciler) reconcile(ctx context.Context, obj *v1
// Update the replicated version to the latest version
obj.Status.LastAppliedVersion = latestSourceComponentVersion.Original()

r.markAsDone(obj)
status.MarkReady(r.EventRecorder, obj, "Reconciliation success")

// Always requeue to constantly check for new versions.
return ctrl.Result{RequeueAfter: obj.GetRequeueAfter()}, nil
}

func (r *ComponentSubscriptionReconciler) markAsDone(obj *v1alpha1.ComponentSubscription) {
conditions.MarkTrue(obj, meta.ReadyCondition, meta.SucceededReason, "Reconciliation success")
event.New(r.EventRecorder, obj, eventv1.EventSeverityInfo, "Reconciliation success", nil)
}
6 changes: 6 additions & 0 deletions docs/release_notes/v0.10.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Release 0.10.0

- integrate proposals from Soule (#85)
- fix: removing reconciliation status #82
- fix: add missing role (#81)
- Create dependabot.yml (#78)
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@ require (
github.com/Masterminds/semver v1.5.0
github.com/Masterminds/semver/v3 v3.2.1
github.com/distribution/distribution/v3 v3.0.0-20230327091844-0c958010ace2
github.com/fluxcd/pkg/apis/event v0.5.2
github.com/fluxcd/pkg/apis/meta v1.1.2
github.com/fluxcd/pkg/runtime v0.35.0
github.com/go-logr/logr v1.2.4
github.com/open-component-model/ocm v0.4.0
github.com/open-component-model/ocm-controller v0.16.0
github.com/open-component-model/ocm-controller v0.16.1
github.com/stretchr/testify v1.8.4
k8s.io/api v0.28.1
k8s.io/apimachinery v0.28.1
Expand Down Expand Up @@ -127,6 +126,7 @@ require (
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/fluxcd/helm-controller/api v0.36.0 // indirect
github.com/fluxcd/kustomize-controller/api v1.0.0-rc.1 // indirect
github.com/fluxcd/pkg/apis/event v0.5.2 // indirect
github.com/fluxcd/pkg/apis/kustomize v1.1.1 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/fvbommel/sortorder v1.1.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1178,8 +1178,8 @@ github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI=
github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M=
github.com/open-component-model/ocm v0.4.0 h1:S+rPJGoDnSvxhBn3QS2HXURxugTjCM4XWEJLZSaH6Ek=
github.com/open-component-model/ocm v0.4.0/go.mod h1:7RAqaUMmA4BlwW5ZEUBm8amWIb1TL9FhNigNXQ6wiu0=
github.com/open-component-model/ocm-controller v0.16.0 h1:yhZI95pg/DVs59RwOl41xcePaEVQMZDx0P5CKhhebqc=
github.com/open-component-model/ocm-controller v0.16.0/go.mod h1:lYax3VEjWAZ7qEr90opJQl+qm/gO3wIeoz1WSEdje2c=
github.com/open-component-model/ocm-controller v0.16.1 h1:Vr04cTivp/kBYktTwDMG4FgmpIS+DdgxX1QnBdBp/hA=
github.com/open-component-model/ocm-controller v0.16.1/go.mod h1:lYax3VEjWAZ7qEr90opJQl+qm/gO3wIeoz1WSEdje2c=
github.com/opencontainers/go-digest v0.0.0-20170106003457-a6d0ee40d420/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
Expand Down
2 changes: 1 addition & 1 deletion pkg/version/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
package version

// ReleaseVersion is the version number in semver format "vX.Y.Z", prefixed with "v".
var ReleaseVersion = "v0.9.2"
var ReleaseVersion = "v0.10.0"

// ReleaseCandidate is the release candidate ID in format "rc.X", which will be appended to the release version.
var ReleaseCandidate = "rc.1"

0 comments on commit e9afedd

Please sign in to comment.