Skip to content
This repository was archived by the owner on May 9, 2025. It is now read-only.

Commit a6f5a3b

Browse files
authored
fix: removing reconciliation status (#83)
* fix: removing reconciliation status * using the right version
1 parent 9c1afc8 commit a6f5a3b

File tree

6 files changed

+11
-21
lines changed

6 files changed

+11
-21
lines changed

controllers/delivery/sync_controller.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ import (
1010
"fmt"
1111
"time"
1212

13-
eventv1 "github.com/fluxcd/pkg/apis/event/v1beta1"
1413
"github.com/fluxcd/pkg/apis/meta"
15-
"github.com/fluxcd/pkg/runtime/conditions"
1614
"github.com/fluxcd/pkg/runtime/patch"
1715
rreconcile "github.com/fluxcd/pkg/runtime/reconcile"
1816
"github.com/open-component-model/ocm-controller/pkg/status"
@@ -31,7 +29,6 @@ import (
3129
"github.com/open-component-model/git-controller/apis/delivery/v1alpha1"
3230
mpasv1alpha1 "github.com/open-component-model/git-controller/apis/mpas/v1alpha1"
3331
"github.com/open-component-model/git-controller/pkg"
34-
"github.com/open-component-model/git-controller/pkg/event"
3532
"github.com/open-component-model/git-controller/pkg/providers"
3633
)
3734

@@ -89,8 +86,7 @@ func (r *SyncReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctr
8986

9087
// it's important that this happens here so any residual status condition can be overwritten / set.
9188
if obj.Status.Digest != "" {
92-
event.New(r.EventRecorder, obj, eventv1.EventSeverityInfo, fmt.Sprintf("sync object already synced with digest %s", obj.Status.Digest), nil)
93-
conditions.MarkTrue(obj, meta.ReadyCondition, meta.SucceededReason, "Reconciliation success")
89+
status.MarkReady(r.EventRecorder, obj, "Digest already reconciled")
9490

9591
return ctrl.Result{}, nil
9692
}
@@ -199,8 +195,7 @@ func (r *SyncReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctr
199195
obj.Status.PullRequestID = id
200196
}
201197

202-
conditions.MarkTrue(obj, meta.ReadyCondition, meta.SucceededReason, "Reconciliation success")
203-
event.New(r.EventRecorder, obj, eventv1.EventSeverityInfo, "Reconciliation success", nil)
198+
status.MarkReady(r.EventRecorder, obj, "Reconciliation success")
204199

205200
return ctrl.Result{}, nil
206201
}

controllers/mpas/repository_controller.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ import (
99
"errors"
1010
"fmt"
1111

12-
eventv1 "github.com/fluxcd/pkg/apis/event/v1beta1"
1312
"github.com/fluxcd/pkg/apis/meta"
14-
"github.com/fluxcd/pkg/runtime/conditions"
1513
"github.com/fluxcd/pkg/runtime/patch"
1614
rreconcile "github.com/fluxcd/pkg/runtime/reconcile"
1715
"github.com/open-component-model/ocm-controller/pkg/status"
@@ -24,7 +22,6 @@ import (
2422
"sigs.k8s.io/controller-runtime/pkg/predicate"
2523

2624
mpasv1alpha1 "github.com/open-component-model/git-controller/apis/mpas/v1alpha1"
27-
"github.com/open-component-model/git-controller/pkg/event"
2825
"github.com/open-component-model/git-controller/pkg/providers"
2926
)
3027

@@ -107,7 +104,7 @@ func (r *RepositoryReconciler) reconcile(ctx context.Context, obj *mpasv1alpha1.
107104

108105
if err := r.Provider.CreateBranchProtection(ctx, *obj); err != nil {
109106
if errors.Is(err, providers.NotSupportedError) {
110-
r.markAsDone(obj)
107+
status.MarkReady(r.EventRecorder, obj, "Successful reconciliation")
111108

112109
// ignore and return without branch protection rules.
113110
return ctrl.Result{}, nil
@@ -119,12 +116,7 @@ func (r *RepositoryReconciler) reconcile(ctx context.Context, obj *mpasv1alpha1.
119116
return ctrl.Result{}, err
120117
}
121118

122-
r.markAsDone(obj)
119+
status.MarkReady(r.EventRecorder, obj, "Successful reconciliation")
123120

124121
return ctrl.Result{}, nil
125122
}
126-
127-
func (r *RepositoryReconciler) markAsDone(obj *mpasv1alpha1.Repository) {
128-
conditions.MarkTrue(obj, meta.ReadyCondition, meta.SucceededReason, "Reconciliation success")
129-
event.New(r.EventRecorder, obj, eventv1.EventSeverityInfo, "Reconciliation success", nil)
130-
}

docs/release_notes/v0.10.1.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Release 0.10.1
2+
3+
- fix: removing reconciliation status (#83)

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ require (
3636
github.com/go-logr/logr v1.2.4
3737
github.com/google/go-github/v52 v52.0.0
3838
github.com/open-component-model/ocm v0.4.0
39-
github.com/open-component-model/ocm-controller v0.16.0
39+
github.com/open-component-model/ocm-controller v0.16.1
4040
github.com/stretchr/testify v1.8.4
4141
golang.org/x/oauth2 v0.11.0
4242
k8s.io/api v0.28.1

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,8 +1226,8 @@ github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI=
12261226
github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M=
12271227
github.com/open-component-model/ocm v0.4.0 h1:S+rPJGoDnSvxhBn3QS2HXURxugTjCM4XWEJLZSaH6Ek=
12281228
github.com/open-component-model/ocm v0.4.0/go.mod h1:7RAqaUMmA4BlwW5ZEUBm8amWIb1TL9FhNigNXQ6wiu0=
1229-
github.com/open-component-model/ocm-controller v0.16.0 h1:yhZI95pg/DVs59RwOl41xcePaEVQMZDx0P5CKhhebqc=
1230-
github.com/open-component-model/ocm-controller v0.16.0/go.mod h1:lYax3VEjWAZ7qEr90opJQl+qm/gO3wIeoz1WSEdje2c=
1229+
github.com/open-component-model/ocm-controller v0.16.1 h1:Vr04cTivp/kBYktTwDMG4FgmpIS+DdgxX1QnBdBp/hA=
1230+
github.com/open-component-model/ocm-controller v0.16.1/go.mod h1:lYax3VEjWAZ7qEr90opJQl+qm/gO3wIeoz1WSEdje2c=
12311231
github.com/opencontainers/go-digest v0.0.0-20170106003457-a6d0ee40d420/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
12321232
github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
12331233
github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=

pkg/version/release.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
package version
66

77
// ReleaseVersion is the version number in semver format "vX.Y.Z", prefixed with "v".
8-
var ReleaseVersion = "v0.10.0"
8+
var ReleaseVersion = "v0.10.1"
99

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

0 commit comments

Comments
 (0)