@@ -7,22 +7,18 @@ package controllers
7
7
import (
8
8
"context"
9
9
"os"
10
- "reflect"
11
10
12
11
"k8s.io/apimachinery/pkg/api/errors"
13
12
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
14
13
ctrl "sigs.k8s.io/controller-runtime"
15
14
"sigs.k8s.io/controller-runtime/pkg/client"
16
15
"sigs.k8s.io/controller-runtime/pkg/controller"
17
- "sigs.k8s.io/controller-runtime/pkg/event"
18
16
"sigs.k8s.io/controller-runtime/pkg/handler"
19
17
"sigs.k8s.io/controller-runtime/pkg/log"
20
- "sigs.k8s.io/controller-runtime/pkg/predicate"
21
18
"sigs.k8s.io/controller-runtime/pkg/source"
22
19
23
20
config "github.com/gitpod-io/gitpod/ws-manager/api/config"
24
21
workspacev1 "github.com/gitpod-io/gitpod/ws-manager/api/crd/v1"
25
- "github.com/google/go-cmp/cmp"
26
22
)
27
23
28
24
func NewSubscriberReconciler (c client.Client , cfg * config.Configuration ) (* SubscriberReconciler , error ) {
@@ -80,28 +76,5 @@ func (r *SubscriberReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Ma
80
76
}
81
77
}()
82
78
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 {})
107
80
}
0 commit comments