@@ -35,9 +35,12 @@ import (
35
35
"k8s.io/klog/v2"
36
36
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
37
37
ctrl "sigs.k8s.io/controller-runtime"
38
- "sigs.k8s.io/controller-runtime/pkg/client"
38
+ cache "sigs.k8s.io/controller-runtime/pkg/cache"
39
+ client "sigs.k8s.io/controller-runtime/pkg/client"
39
40
"sigs.k8s.io/controller-runtime/pkg/client/config"
40
41
"sigs.k8s.io/controller-runtime/pkg/controller"
42
+ metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
43
+ "sigs.k8s.io/controller-runtime/pkg/webhook"
41
44
42
45
infrav1alpha5 "sigs.k8s.io/cluster-api-provider-openstack/api/v1alpha5"
43
46
infrav1alpha6 "sigs.k8s.io/cluster-api-provider-openstack/api/v1alpha6"
@@ -184,21 +187,33 @@ func main() {
184
187
}
185
188
186
189
mgr , err := ctrl .NewManager (cfg , ctrl.Options {
187
- Scheme : scheme ,
188
- MetricsBindAddress : metricsBindAddr ,
189
- LeaderElection : enableLeaderElection ,
190
- LeaderElectionID : "controller-leader-election-capo" ,
191
- LeaseDuration : & leaderElectionLeaseDuration ,
192
- RenewDeadline : & leaderElectionRenewDeadline ,
193
- RetryPeriod : & leaderElectionRetryPeriod ,
194
- Namespace : watchNamespace ,
195
- SyncPeriod : & syncPeriod ,
196
- ClientDisableCacheFor : []client. Object {
197
- & corev1. ConfigMap { },
198
- & corev1. Secret {} ,
190
+ Scheme : scheme ,
191
+ Metrics : metricsserver. Options { BindAddress : metricsBindAddr } ,
192
+ LeaderElection : enableLeaderElection ,
193
+ LeaderElectionID : "controller-leader-election-capo" ,
194
+ LeaseDuration : & leaderElectionLeaseDuration ,
195
+ RenewDeadline : & leaderElectionRenewDeadline ,
196
+ RetryPeriod : & leaderElectionRetryPeriod ,
197
+ Cache : cache. Options {
198
+ DefaultNamespaces : map [ string ]cache. Config {
199
+ watchNamespace : {},
200
+ },
201
+ SyncPeriod : & syncPeriod ,
199
202
},
200
- Port : webhookPort ,
201
- CertDir : webhookCertDir ,
203
+ Client : client.Options {
204
+ Cache : & client.CacheOptions {
205
+ DisableFor : []client.Object {
206
+ & corev1.ConfigMap {},
207
+ & corev1.Secret {},
208
+ },
209
+ },
210
+ },
211
+ WebhookServer : webhook .NewServer (
212
+ webhook.Options {
213
+ Port : webhookPort ,
214
+ CertDir : webhookCertDir ,
215
+ },
216
+ ),
202
217
HealthProbeBindAddress : healthAddr ,
203
218
})
204
219
if err != nil {
0 commit comments