Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: removing reconciliation status #83

Merged
merged 2 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions controllers/delivery/sync_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
)

Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down
12 changes: 2 additions & 10 deletions controllers/mpas/repository_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
)

Expand Down Expand Up @@ -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
Expand All @@ -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)
}
3 changes: 3 additions & 0 deletions docs/release_notes/v0.10.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Release 0.10.1

- fix: removing reconciliation status (#83)
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
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.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"