Skip to content

Commit

Permalink
Remove double string from Receiver ready condition
Browse files Browse the repository at this point in the history
Signed-off-by: Hidde Beydals <hello@hidde.co>
  • Loading branch information
hiddeco committed Nov 18, 2021
1 parent 7f66d39 commit 8395bc2
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
13 changes: 7 additions & 6 deletions controllers/alert_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ import (
"fmt"
"time"

"github.com/fluxcd/pkg/apis/meta"
"github.com/fluxcd/pkg/runtime/conditions"
helper "github.com/fluxcd/pkg/runtime/controller"
"github.com/fluxcd/pkg/runtime/patch"
"github.com/fluxcd/pkg/runtime/predicates"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
Expand All @@ -39,11 +34,17 @@ import (
"sigs.k8s.io/controller-runtime/pkg/reconcile"
"sigs.k8s.io/controller-runtime/pkg/source"

"github.com/fluxcd/pkg/apis/meta"
"github.com/fluxcd/pkg/runtime/conditions"
helper "github.com/fluxcd/pkg/runtime/controller"
"github.com/fluxcd/pkg/runtime/patch"
"github.com/fluxcd/pkg/runtime/predicates"

"github.com/fluxcd/notification-controller/api/v1beta1"
)

var (
ProviderIndexKey string = ".metadata.provider"
ProviderIndexKey = ".metadata.provider"
)

// AlertReconciler reconciles a Alert object
Expand Down
6 changes: 3 additions & 3 deletions controllers/provider_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ import (
"fmt"
"time"

"github.com/fluxcd/pkg/runtime/conditions"
helper "github.com/fluxcd/pkg/runtime/controller"
"github.com/fluxcd/pkg/runtime/patch"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
Expand All @@ -36,6 +33,9 @@ import (
"sigs.k8s.io/controller-runtime/pkg/predicate"

"github.com/fluxcd/pkg/apis/meta"
"github.com/fluxcd/pkg/runtime/conditions"
helper "github.com/fluxcd/pkg/runtime/controller"
"github.com/fluxcd/pkg/runtime/patch"
"github.com/fluxcd/pkg/runtime/predicates"

"github.com/fluxcd/notification-controller/api/v1beta1"
Expand Down
13 changes: 6 additions & 7 deletions controllers/receiver_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ import (
"fmt"
"time"

"github.com/fluxcd/pkg/runtime/conditions"
helper "github.com/fluxcd/pkg/runtime/controller"
"github.com/fluxcd/pkg/runtime/patch"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
Expand All @@ -35,6 +32,9 @@ import (
"sigs.k8s.io/controller-runtime/pkg/controller"

"github.com/fluxcd/pkg/apis/meta"
"github.com/fluxcd/pkg/runtime/conditions"
helper "github.com/fluxcd/pkg/runtime/controller"
"github.com/fluxcd/pkg/runtime/patch"

"github.com/fluxcd/notification-controller/api/v1beta1"
)
Expand Down Expand Up @@ -71,9 +71,9 @@ func (r *ReceiverReconciler) Reconcile(ctx context.Context, req ctrl.Request) (r
return ctrl.Result{}, client.IgnoreNotFound(err)
}

// record suspension metrics
// Record suspension metrics
defer r.RecordSuspend(ctx, receiver, receiver.Spec.Suspend)
// return early if the object is suspended
// Return early if the object is suspended
if receiver.Spec.Suspend {
log.Info("Reconciliation is suspended for this object")
return ctrl.Result{}, nil
Expand Down Expand Up @@ -155,8 +155,7 @@ func (r *ReceiverReconciler) reconcile(ctx context.Context, obj *v1beta1.Receive
receiverURL := fmt.Sprintf("/hook/%s", sha256sum(token+obj.Name+obj.Namespace))

// Mark the resource as ready and set the URL
conditions.MarkTrue(obj, meta.ReadyCondition, v1beta1.InitializedReason, "Receiver initialised with URL: "+receiverURL,
receiverURL)
conditions.MarkTrue(obj, meta.ReadyCondition, v1beta1.InitializedReason, "Receiver initialized with URL: %s", receiverURL)
obj.Status.URL = receiverURL

ctrl.LoggerFrom(ctx).Info("Receiver initialized")
Expand Down
2 changes: 1 addition & 1 deletion controllers/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"testing"
"time"

"github.com/fluxcd/pkg/runtime/conditions"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/sethvargo/go-limiter/memorystore"
Expand All @@ -43,6 +42,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/log/zap"

"github.com/fluxcd/pkg/apis/meta"
"github.com/fluxcd/pkg/runtime/conditions"
"github.com/fluxcd/pkg/runtime/events"

notifyv1 "github.com/fluxcd/notification-controller/api/v1beta1"
Expand Down

0 comments on commit 8395bc2

Please sign in to comment.