-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Upgrade controller runtime to v0.17.5 and k8s api to v0.29.5 #4160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
9d932aa
02508d6
ad33ea4
49f88b5
6e8bcfb
ce7bdbd
671838c
0734468
c121918
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ package app | |
|
||
import ( | ||
"os" | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
"time" | ||
|
||
"github.com/spf13/cobra" | ||
|
@@ -33,6 +34,7 @@ import ( | |
"sigs.k8s.io/controller-runtime/pkg/cache" | ||
"sigs.k8s.io/controller-runtime/pkg/controller" | ||
"sigs.k8s.io/controller-runtime/pkg/log/zap" | ||
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server" | ||
|
||
"github.com/fluid-cloudnative/fluid" | ||
datav1alpha1 "github.com/fluid-cloudnative/fluid/api/v1alpha1" | ||
|
@@ -121,14 +123,16 @@ func handle() { | |
|
||
utils.NewPprofServer(setupLog, pprofAddr, development) | ||
|
||
// the default webhook server port is 9443, no need to set | ||
mgr, err := ctrl.NewManager(controllers.GetConfigOrDieWithQPSAndBurst(kubeClientQPS, kubeClientBurst), ctrl.Options{ | ||
Scheme: scheme, | ||
MetricsBindAddress: metricsAddr, | ||
Scheme: scheme, | ||
Metrics: metricsserver.Options{ | ||
BindAddress: metricsAddr, | ||
}, | ||
LeaderElection: enableLeaderElection, | ||
LeaderElectionNamespace: leaderElectionNamespace, | ||
LeaderElectionID: "dataset.data.fluid.io", | ||
Port: 9443, | ||
NewCache: NewCache(scheme), | ||
Cache: NewCacheOptions(), | ||
NewClient: controllers.NewFluidControllerClient, | ||
}) | ||
if err != nil { | ||
|
@@ -232,21 +236,22 @@ func handle() { | |
} | ||
} | ||
|
||
func NewCache(scheme *runtime.Scheme) cache.NewCacheFunc { | ||
selectors := make(cache.SelectorsByObject, 1) | ||
func NewCacheOptions() cache.Options { | ||
var cronJobKey client.Object | ||
|
||
if compatibility.IsBatchV1CronJobSupported() { | ||
selectors[&batchv1.CronJob{}] = cache.ObjectSelector{Label: labels.SelectorFromSet(labels.Set{ | ||
common.JobPolicy: common.CronPolicy, | ||
})} | ||
cronJobKey = &batchv1.CronJob{} | ||
} else { | ||
selectors[&batchv1beta1.CronJob{}] = cache.ObjectSelector{Label: labels.SelectorFromSet(labels.Set{ | ||
common.JobPolicy: common.CronPolicy, | ||
})} | ||
cronJobKey = &batchv1beta1.CronJob{} | ||
} | ||
|
||
return cache.BuilderWithOptions(cache.Options{ | ||
Scheme: scheme, | ||
SelectorsByObject: selectors, | ||
}) | ||
return cache.Options{ | ||
ByObject: map[client.Object]cache.ByObject{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to add scheme? return cache.Options{
Scheme: scheme,
ByObject: map[client.Object]cache.ByObject{
cronJobKey: {
Label: labels.SelectorFromSet(labels.Set{
common.JobPolicy: common.CronPolicy,
}),
},
},
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no need to, as the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about setting scheme in cache option to keep consistency with previous version? My thought is to make it easy for maintenance. WDYT? |
||
cronJobKey: { | ||
Label: labels.SelectorFromSet(labels.Set{ | ||
common.JobPolicy: common.CronPolicy, | ||
}), | ||
}, | ||
}, | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.