Skip to content

Commit c80db08

Browse files
authored
Revert "Filter subscriber reconciler events (#18660)"
This reverts commit 9470fb8.
1 parent 2ae927a commit c80db08

File tree

2 files changed

+1
-44
lines changed

2 files changed

+1
-44
lines changed

components/ws-manager-api/go/crd/v1/workspace_types.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -150,22 +150,6 @@ type PortSpec struct {
150150
Protocol PortProtocol `json:"protocol"`
151151
}
152152

153-
func (ps PortSpec) Equal(other PortSpec) bool {
154-
if ps.Port != other.Port {
155-
return false
156-
}
157-
158-
if ps.Visibility != other.Visibility {
159-
return false
160-
}
161-
162-
if ps.Protocol != other.Protocol {
163-
return false
164-
}
165-
166-
return true
167-
}
168-
169153
// WorkspaceStatus defines the observed state of Workspace
170154
type WorkspaceStatus struct {
171155
PodStarts int `json:"podStarts"`

components/ws-manager-mk2/controllers/subscriber_controller.go

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,18 @@ package controllers
77
import (
88
"context"
99
"os"
10-
"reflect"
1110

1211
"k8s.io/apimachinery/pkg/api/errors"
1312
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1413
ctrl "sigs.k8s.io/controller-runtime"
1514
"sigs.k8s.io/controller-runtime/pkg/client"
1615
"sigs.k8s.io/controller-runtime/pkg/controller"
17-
"sigs.k8s.io/controller-runtime/pkg/event"
1816
"sigs.k8s.io/controller-runtime/pkg/handler"
1917
"sigs.k8s.io/controller-runtime/pkg/log"
20-
"sigs.k8s.io/controller-runtime/pkg/predicate"
2118
"sigs.k8s.io/controller-runtime/pkg/source"
2219

2320
config "github.com/gitpod-io/gitpod/ws-manager/api/config"
2421
workspacev1 "github.com/gitpod-io/gitpod/ws-manager/api/crd/v1"
25-
"github.com/google/go-cmp/cmp"
2622
)
2723

2824
func NewSubscriberReconciler(c client.Client, cfg *config.Configuration) (*SubscriberReconciler, error) {
@@ -80,28 +76,5 @@ func (r *SubscriberReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Ma
8076
}
8177
}()
8278

83-
// we need several reconciliation loops during a workspace creation until it reaches a stable state.
84-
// this introduces the side effect of multiple notifications to the subscribers with partial information.
85-
// the filterByUpdate predicate acts as a filter to avoid this
86-
filterByUpdate := predicate.Funcs{
87-
CreateFunc: func(ce event.CreateEvent) bool {
88-
return true
89-
},
90-
UpdateFunc: func(e event.UpdateEvent) bool {
91-
old := e.ObjectOld.(*workspacev1.Workspace)
92-
new := e.ObjectNew.(*workspacev1.Workspace)
93-
94-
if !cmp.Equal(old.Spec.Ports, new.Spec.Ports) {
95-
return true
96-
}
97-
98-
// do not notify LastActivity changes
99-
old.Status.LastActivity = nil
100-
new.Status.LastActivity = nil
101-
102-
return !reflect.DeepEqual(old.Status, new.Status)
103-
},
104-
}
105-
106-
return c.Watch(source.Kind(mgr.GetCache(), &workspacev1.Workspace{}), &handler.EnqueueRequestForObject{}, filterByUpdate)
79+
return c.Watch(source.Kind(mgr.GetCache(), &workspacev1.Workspace{}), &handler.EnqueueRequestForObject{})
10780
}

0 commit comments

Comments
 (0)