Skip to content

Commit

Permalink
update from master
Browse files Browse the repository at this point in the history
Signed-off-by: xliuqq <xlzq1992@gmail.com>
  • Loading branch information
xliuqq committed Jun 25, 2024
1 parent 0563f4f commit 673d054
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions cmd/fluidapp/app/fluidapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,7 @@ func handle() {
LeaderElection: enableLeaderElection,
LeaderElectionNamespace: leaderElectionNamespace,
LeaderElectionID: "fluidapp.data.fluid.io",
Cache: cache.Options{
Scheme: scheme,
ByObject: map[client.Object]cache.ByObject{
&corev1.Pod{}: {
Label: labels.SelectorFromSet(labels.Set{
common.InjectSidecarDone: common.True,
}),
},
},
},
Cache: newCacheOptions(),
})
if err != nil {
setupLog.Error(err, "unable to start fluid app manager")
Expand Down Expand Up @@ -150,10 +141,9 @@ func handle() {
}
}

func NewCache(scheme *runtime.Scheme) cache.NewCacheFunc {
func newCacheOptions() cache.Options {
options := cache.Options{
Scheme: scheme,
SelectorsByObject: cache.SelectorsByObject{
ByObject: map[client.Object]cache.ByObject{
&corev1.Pod{}: {
Label: labels.SelectorFromSet(labels.Set{
// watch pods managed by fluid, like data operation pods, serverless app pods.
Expand All @@ -163,13 +153,13 @@ func NewCache(scheme *runtime.Scheme) cache.NewCacheFunc {
},
}
if dataflow.Enabled(dataflow.DataflowAffinity) {
options.SelectorsByObject[&batchv1.Job{}] = cache.ObjectSelector{
options.ByObject[&batchv1.Job{}] = cache.ByObject{
// watch data operation job
Label: labels.SelectorFromSet(labels.Set{
// only data operations create job resource and the jobs created by cronjob do not have this label.
common.LabelAnnotationManagedBy: common.Fluid,
}),
}
}
return cache.BuilderWithOptions(options)
return options
}

0 comments on commit 673d054

Please sign in to comment.