Skip to content

Commit 673d054

Browse files
committed
update from master
Signed-off-by: xliuqq <xlzq1992@gmail.com>
1 parent 0563f4f commit 673d054

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

cmd/fluidapp/app/fluidapp.go

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -104,16 +104,7 @@ func handle() {
104104
LeaderElection: enableLeaderElection,
105105
LeaderElectionNamespace: leaderElectionNamespace,
106106
LeaderElectionID: "fluidapp.data.fluid.io",
107-
Cache: cache.Options{
108-
Scheme: scheme,
109-
ByObject: map[client.Object]cache.ByObject{
110-
&corev1.Pod{}: {
111-
Label: labels.SelectorFromSet(labels.Set{
112-
common.InjectSidecarDone: common.True,
113-
}),
114-
},
115-
},
116-
},
107+
Cache: newCacheOptions(),
117108
})
118109
if err != nil {
119110
setupLog.Error(err, "unable to start fluid app manager")
@@ -150,10 +141,9 @@ func handle() {
150141
}
151142
}
152143

153-
func NewCache(scheme *runtime.Scheme) cache.NewCacheFunc {
144+
func newCacheOptions() cache.Options {
154145
options := cache.Options{
155-
Scheme: scheme,
156-
SelectorsByObject: cache.SelectorsByObject{
146+
ByObject: map[client.Object]cache.ByObject{
157147
&corev1.Pod{}: {
158148
Label: labels.SelectorFromSet(labels.Set{
159149
// watch pods managed by fluid, like data operation pods, serverless app pods.
@@ -163,13 +153,13 @@ func NewCache(scheme *runtime.Scheme) cache.NewCacheFunc {
163153
},
164154
}
165155
if dataflow.Enabled(dataflow.DataflowAffinity) {
166-
options.SelectorsByObject[&batchv1.Job{}] = cache.ObjectSelector{
156+
options.ByObject[&batchv1.Job{}] = cache.ByObject{
167157
// watch data operation job
168158
Label: labels.SelectorFromSet(labels.Set{
169159
// only data operations create job resource and the jobs created by cronjob do not have this label.
170160
common.LabelAnnotationManagedBy: common.Fluid,
171161
}),
172162
}
173163
}
174-
return cache.BuilderWithOptions(options)
164+
return options
175165
}

0 commit comments

Comments
 (0)