From a6f5a3b5c23adb02d458c777b41f750027c0f65c Mon Sep 17 00:00:00 2001 From: Gergely Brautigam <182850+Skarlso@users.noreply.github.com> Date: Fri, 17 Nov 2023 14:13:51 +0100 Subject: [PATCH] fix: removing reconciliation status (#83) * fix: removing reconciliation status * using the right version --- controllers/delivery/sync_controller.go | 9 ++------- controllers/mpas/repository_controller.go | 12 ++---------- docs/release_notes/v0.10.1.md | 3 +++ go.mod | 2 +- go.sum | 4 ++-- pkg/version/release.go | 2 +- 6 files changed, 11 insertions(+), 21 deletions(-) create mode 100644 docs/release_notes/v0.10.1.md diff --git a/controllers/delivery/sync_controller.go b/controllers/delivery/sync_controller.go index b6f5772..bde50ba 100644 --- a/controllers/delivery/sync_controller.go +++ b/controllers/delivery/sync_controller.go @@ -10,9 +10,7 @@ import ( "fmt" "time" - 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/status" @@ -31,7 +29,6 @@ import ( "github.com/open-component-model/git-controller/apis/delivery/v1alpha1" mpasv1alpha1 "github.com/open-component-model/git-controller/apis/mpas/v1alpha1" "github.com/open-component-model/git-controller/pkg" - "github.com/open-component-model/git-controller/pkg/event" "github.com/open-component-model/git-controller/pkg/providers" ) @@ -89,8 +86,7 @@ func (r *SyncReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctr // it's important that this happens here so any residual status condition can be overwritten / set. if obj.Status.Digest != "" { - event.New(r.EventRecorder, obj, eventv1.EventSeverityInfo, fmt.Sprintf("sync object already synced with digest %s", obj.Status.Digest), nil) - conditions.MarkTrue(obj, meta.ReadyCondition, meta.SucceededReason, "Reconciliation success") + status.MarkReady(r.EventRecorder, obj, "Digest already reconciled") return ctrl.Result{}, nil } @@ -199,8 +195,7 @@ func (r *SyncReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctr obj.Status.PullRequestID = id } - conditions.MarkTrue(obj, meta.ReadyCondition, meta.SucceededReason, "Reconciliation success") - event.New(r.EventRecorder, obj, eventv1.EventSeverityInfo, "Reconciliation success", nil) + status.MarkReady(r.EventRecorder, obj, "Reconciliation success") return ctrl.Result{}, nil } diff --git a/controllers/mpas/repository_controller.go b/controllers/mpas/repository_controller.go index 6f706de..0a34136 100644 --- a/controllers/mpas/repository_controller.go +++ b/controllers/mpas/repository_controller.go @@ -9,9 +9,7 @@ import ( "errors" "fmt" - 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/status" @@ -24,7 +22,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/predicate" mpasv1alpha1 "github.com/open-component-model/git-controller/apis/mpas/v1alpha1" - "github.com/open-component-model/git-controller/pkg/event" "github.com/open-component-model/git-controller/pkg/providers" ) @@ -107,7 +104,7 @@ func (r *RepositoryReconciler) reconcile(ctx context.Context, obj *mpasv1alpha1. if err := r.Provider.CreateBranchProtection(ctx, *obj); err != nil { if errors.Is(err, providers.NotSupportedError) { - r.markAsDone(obj) + status.MarkReady(r.EventRecorder, obj, "Successful reconciliation") // ignore and return without branch protection rules. return ctrl.Result{}, nil @@ -119,12 +116,7 @@ func (r *RepositoryReconciler) reconcile(ctx context.Context, obj *mpasv1alpha1. return ctrl.Result{}, err } - r.markAsDone(obj) + status.MarkReady(r.EventRecorder, obj, "Successful reconciliation") return ctrl.Result{}, nil } - -func (r *RepositoryReconciler) markAsDone(obj *mpasv1alpha1.Repository) { - conditions.MarkTrue(obj, meta.ReadyCondition, meta.SucceededReason, "Reconciliation success") - event.New(r.EventRecorder, obj, eventv1.EventSeverityInfo, "Reconciliation success", nil) -} diff --git a/docs/release_notes/v0.10.1.md b/docs/release_notes/v0.10.1.md new file mode 100644 index 0000000..f4609b0 --- /dev/null +++ b/docs/release_notes/v0.10.1.md @@ -0,0 +1,3 @@ +# Release 0.10.1 + +- fix: removing reconciliation status (#83) diff --git a/go.mod b/go.mod index 622d5e4..231d6fa 100644 --- a/go.mod +++ b/go.mod @@ -36,7 +36,7 @@ require ( github.com/go-logr/logr v1.2.4 github.com/google/go-github/v52 v52.0.0 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 golang.org/x/oauth2 v0.11.0 k8s.io/api v0.28.1 diff --git a/go.sum b/go.sum index 8818676..8281ad1 100644 --- a/go.sum +++ b/go.sum @@ -1226,8 +1226,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= diff --git a/pkg/version/release.go b/pkg/version/release.go index c4dddec..ff7b8bf 100644 --- a/pkg/version/release.go +++ b/pkg/version/release.go @@ -5,7 +5,7 @@ package version // ReleaseVersion is the version number in semver format "vX.Y.Z", prefixed with "v". -var ReleaseVersion = "v0.10.0" +var ReleaseVersion = "v0.10.1" // ReleaseCandidate is the release candidate ID in format "rc.X", which will be appended to the release version. var ReleaseCandidate = "rc.1"