diff --git a/Makefile b/Makefile index b5f4952359..90b162c979 100644 --- a/Makefile +++ b/Makefile @@ -185,7 +185,7 @@ IMPORT_BOSS_VER := v0.28.1 IMPORT_BOSS := $(abspath $(TOOLS_BIN_DIR)/$(IMPORT_BOSS_BIN)) IMPORT_BOSS_PKG := k8s.io/code-generator/cmd/import-boss -CAPI_HACK_TOOLS_VER := 176d7705c42f7254521dc3afd6cac0a65fcc4584 # Note: this is the commit ID of CAPI v1.8.0-beta.1 +CAPI_HACK_TOOLS_VER := c05c45e8c9096e232acf60ebc31a6d9ef837c318 # Note: this is the commit ID of CAPI v1.8.0-rc.0 BOSKOSCTL_BIN := boskosctl BOSKOSCTL := $(abspath $(TOOLS_BIN_DIR)/$(BOSKOSCTL_BIN)) diff --git a/go.mod b/go.mod index a4027c4301..6dd0e6b394 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module sigs.k8s.io/cluster-api-provider-vsphere go 1.22.0 -replace sigs.k8s.io/cluster-api => sigs.k8s.io/cluster-api v1.8.0-beta.1 +replace sigs.k8s.io/cluster-api => sigs.k8s.io/cluster-api v1.8.0-rc.0 replace github.com/vmware-tanzu/vm-operator/pkg/constants/testlabels => github.com/vmware-tanzu/vm-operator/pkg/constants/testlabels v0.0.0-20240404200847-de75746a9505 diff --git a/go.sum b/go.sum index 5f55e49272..da4a7c7755 100644 --- a/go.sum +++ b/go.sum @@ -1009,8 +1009,8 @@ rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.15/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.0 h1:Tc9rS7JJoZ9sl3OpL4842oIk6lH7gWBb0JOmJ0ute7M= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.0/go.mod h1:1ewhL9l1gkPcU/IU/6rFYfikf+7Y5imWv7ARVbBOzNs= -sigs.k8s.io/cluster-api v1.8.0-beta.1 h1:VDEw9hLARr/yxmHbfMtuwpsG0ZEZeay7djl1wllY/B8= -sigs.k8s.io/cluster-api v1.8.0-beta.1/go.mod h1:TNkfly2mrCG8O6DjGFru0USq1NhWbo2njpSXxKrRgL0= +sigs.k8s.io/cluster-api v1.8.0-rc.0 h1:Q103UfK++rI160mtURBjg4ovJ9vxJTIrrdkL7NQBdFQ= +sigs.k8s.io/cluster-api v1.8.0-rc.0/go.mod h1:TNkfly2mrCG8O6DjGFru0USq1NhWbo2njpSXxKrRgL0= sigs.k8s.io/controller-runtime v0.9.0/go.mod h1:TgkfvrhhEw3PlI0BRL/5xM+89y3/yc0ZDfdbTl84si8= sigs.k8s.io/controller-runtime v0.18.4 h1:87+guW1zhvuPLh1PHybKdYFLU0YJp4FhJRmiHvm5BZw= sigs.k8s.io/controller-runtime v0.18.4/go.mod h1:TVoGrfdpbA9VRFaRnKgk9P5/atA0pMwq+f+msb9M8Sg= diff --git a/main.go b/main.go index 8631c549b9..01c1e36116 100644 --- a/main.go +++ b/main.go @@ -65,16 +65,18 @@ var ( logOptions = logs.NewOptions() controllerName = "cluster-api-vsphere-manager" - enableContentionProfiling bool - leaderElectionLeaseDuration time.Duration - leaderElectionRenewDeadline time.Duration - leaderElectionRetryPeriod time.Duration - managerOpts manager.Options - restConfigBurst int - restConfigQPS float32 - syncPeriod time.Duration - webhookOpts webhook.Options - watchNamespace string + enableContentionProfiling bool + leaderElectionLeaseDuration time.Duration + leaderElectionRenewDeadline time.Duration + leaderElectionRetryPeriod time.Duration + managerOpts manager.Options + restConfigBurst int + restConfigQPS float32 + clusterCacheTrackerClientQPS float32 + clusterCacheTrackerClientBurst int + syncPeriod time.Duration + webhookOpts webhook.Options + watchNamespace string clusterCacheTrackerConcurrency int vSphereClusterConcurrency int @@ -85,8 +87,7 @@ var ( vSphereClusterIdentityConcurrency int vSphereDeploymentZoneConcurrency int - tlsOptions = capiflags.TLSOptions{} - diagnosticsOptions = capiflags.DiagnosticsOptions{} + managerOptions = capiflags.ManagerOptions{} defaultProfilerAddr = os.Getenv("PROFILER_ADDR") defaultSyncPeriod = manager.DefaultSyncPeriod @@ -181,10 +182,16 @@ func InitFlags(fs *pflag.FlagSet) { "The minimum interval at which watched resources are reconciled (e.g. 15m)") fs.Float32Var(&restConfigQPS, "kube-api-qps", 20, - "Maximum queries per second from the controller client to the Kubernetes API server. Defaults to 20") + "Maximum queries per second from the controller client to the Kubernetes API server.") fs.IntVar(&restConfigBurst, "kube-api-burst", 30, - "Maximum number of queries that should be allowed in one burst from the controller client to the Kubernetes API server. Default 30") + "Maximum number of queries that should be allowed in one burst from the controller client to the Kubernetes API server.") + + fs.Float32Var(&clusterCacheTrackerClientQPS, "clustercachetracker-client-qps", 20, + "Maximum queries per second from the cluster cache tracker clients to the Kubernetes API server of workload clusters.") + + fs.IntVar(&clusterCacheTrackerClientBurst, "clustercachetracker-client-burst", 30, + "Maximum number of queries that should be allowed in one burst from the cluster cache tracker clients to the Kubernetes API server of workload clusters.") fs.IntVar(&webhookOpts.Port, "webhook-port", defaultWebhookPort, "Webhook Server port") @@ -196,8 +203,7 @@ func InitFlags(fs *pflag.FlagSet) { "The address the health endpoint binds to.", ) - capiflags.AddTLSOptions(fs, &tlsOptions) - capiflags.AddDiagnosticsOptions(fs, &diagnosticsOptions) + capiflags.AddManagerOptions(fs, &managerOptions) feature.MutableGates.AddFlag(fs) } @@ -298,15 +304,15 @@ func main() { return nil } - tlsOptionOverrides, err := capiflags.GetTLSOptionOverrideFuncs(tlsOptions) + tlsOptions, metricsOptions, err := capiflags.GetManagerOptions(managerOptions) if err != nil { - setupLog.Error(err, "unable to add TLS settings to the webhook server") + setupLog.Error(err, "Unable to start manager: invalid flags") os.Exit(1) } - webhookOpts.TLSOpts = tlsOptionOverrides + webhookOpts.TLSOpts = tlsOptions managerOpts.WebhookServer = webhook.NewServer(webhookOpts) managerOpts.AddToManager = addToManager - managerOpts.Metrics = capiflags.GetDiagnosticsOptions(diagnosticsOptions) + managerOpts.Metrics = *metricsOptions // Set up the context that's going to be used in controllers and for the manager. ctx := ctrl.SetupSignalHandler() @@ -446,6 +452,8 @@ func setupRemoteClusterCacheTracker(ctx context.Context, mgr ctrlmgr.Manager) (* SecretCachingClient: secretCachingClient, ControllerName: controllerName, Log: &ctrl.Log, + ClientQPS: clusterCacheTrackerClientQPS, + ClientBurst: clusterCacheTrackerClientBurst, }, ) if err != nil { diff --git a/test/e2e/config/vsphere.yaml b/test/e2e/config/vsphere.yaml index b818e492b1..ea84e9f0b7 100644 --- a/test/e2e/config/vsphere.yaml +++ b/test/e2e/config/vsphere.yaml @@ -27,7 +27,7 @@ providers: type: CoreProvider versions: - name: "v1.8.0" # supported release in the v1beta1 series - value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.8.0-beta.1/core-components.yaml" + value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.8.0-rc.0/core-components.yaml" type: "url" contract: v1beta1 files: @@ -67,7 +67,7 @@ providers: type: BootstrapProvider versions: - name: "v1.8.0" # supported release in the v1beta1 series - value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.8.0-beta.1/bootstrap-components.yaml" + value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.8.0-rc.0/bootstrap-components.yaml" type: "url" contract: v1beta1 files: @@ -107,7 +107,7 @@ providers: type: ControlPlaneProvider versions: - name: "v1.8.0" # supported release in the v1beta1 series - value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.8.0-beta.1/control-plane-components.yaml" + value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.8.0-rc.0/control-plane-components.yaml" type: "url" contract: v1beta1 files: diff --git a/test/extension/main.go b/test/extension/main.go index 172bd86471..407899a0f5 100644 --- a/test/extension/main.go +++ b/test/extension/main.go @@ -86,8 +86,7 @@ var ( webhookCertName string webhookKeyName string healthAddr string - tlsOptions = flags.TLSOptions{} - diagnosticsOptions = flags.DiagnosticsOptions{} + managerOptions = flags.ManagerOptions{} logOptions = logs.NewOptions() ) @@ -136,10 +135,10 @@ func InitFlags(fs *pflag.FlagSet) { "The minimum interval at which watched resources are reconciled (e.g. 15m)") fs.Float32Var(&restConfigQPS, "kube-api-qps", 20, - "Maximum queries per second from the controller client to the Kubernetes API server. Defaults to 20") + "Maximum queries per second from the controller client to the Kubernetes API server.") fs.IntVar(&restConfigBurst, "kube-api-burst", 30, - "Maximum number of queries that should be allowed in one burst from the controller client to the Kubernetes API server. Default 30") + "Maximum number of queries that should be allowed in one burst from the controller client to the Kubernetes API server.") fs.IntVar(&webhookPort, "webhook-port", 9443, "Webhook Server port") @@ -156,8 +155,7 @@ func InitFlags(fs *pflag.FlagSet) { fs.StringVar(&healthAddr, "health-addr", ":9440", "The address the health endpoint binds to.") - flags.AddDiagnosticsOptions(fs, &diagnosticsOptions) - flags.AddTLSOptions(fs, &tlsOptions) + flags.AddManagerOptions(fs, &managerOptions) // Add test-extension specific flags // NOTE: it is not mandatory to use the same flag names in all RuntimeExtension, but it is recommended when @@ -200,14 +198,12 @@ func main() { restConfig.Burst = restConfigBurst restConfig.UserAgent = remote.DefaultClusterAPIUserAgent(controllerName) - tlsOptionOverrides, err := flags.GetTLSOptionOverrideFuncs(tlsOptions) + tlsOptions, metricsOptions, err := flags.GetManagerOptions(managerOptions) if err != nil { - setupLog.Error(err, "Unable to add TLS settings to the webhook server") + setupLog.Error(err, "Unable to start manager: invalid flags") os.Exit(1) } - diagnosticsOpts := flags.GetDiagnosticsOptions(diagnosticsOptions) - if enableContentionProfiling { goruntime.SetBlockProfileRate(1) } @@ -218,7 +214,7 @@ func main() { CertDir: webhookCertDir, CertName: webhookCertName, KeyName: webhookKeyName, - TLSOpts: tlsOptionOverrides, + TLSOpts: tlsOptions, Catalog: catalog, }) if err != nil { @@ -236,7 +232,7 @@ func main() { LeaderElectionResourceLock: resourcelock.LeasesResourceLock, HealthProbeBindAddress: healthAddr, PprofBindAddress: profilerAddress, - Metrics: diagnosticsOpts, + Metrics: *metricsOptions, Cache: cache.Options{ SyncPeriod: &syncPeriod, }, diff --git a/test/go.mod b/test/go.mod index dc94027c79..0bd2b28981 100644 --- a/test/go.mod +++ b/test/go.mod @@ -2,9 +2,9 @@ module sigs.k8s.io/cluster-api-provider-vsphere/test go 1.22.0 -replace sigs.k8s.io/cluster-api => sigs.k8s.io/cluster-api v1.8.0-beta.1 +replace sigs.k8s.io/cluster-api => sigs.k8s.io/cluster-api v1.8.0-rc.0 -replace sigs.k8s.io/cluster-api/test => sigs.k8s.io/cluster-api/test v1.8.0-beta.1 +replace sigs.k8s.io/cluster-api/test => sigs.k8s.io/cluster-api/test v1.8.0-rc.0 replace sigs.k8s.io/cluster-api-provider-vsphere => ../ diff --git a/test/go.sum b/test/go.sum index 766e5275d8..dde3080c68 100644 --- a/test/go.sum +++ b/test/go.sum @@ -1090,10 +1090,10 @@ rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.15/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.0 h1:Tc9rS7JJoZ9sl3OpL4842oIk6lH7gWBb0JOmJ0ute7M= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.0/go.mod h1:1ewhL9l1gkPcU/IU/6rFYfikf+7Y5imWv7ARVbBOzNs= -sigs.k8s.io/cluster-api v1.8.0-beta.1 h1:VDEw9hLARr/yxmHbfMtuwpsG0ZEZeay7djl1wllY/B8= -sigs.k8s.io/cluster-api v1.8.0-beta.1/go.mod h1:TNkfly2mrCG8O6DjGFru0USq1NhWbo2njpSXxKrRgL0= -sigs.k8s.io/cluster-api/test v1.8.0-beta.1 h1:04m4hvYiEqxUcQxA6CpM7E05MOjuyb8ZD8A1evALhJw= -sigs.k8s.io/cluster-api/test v1.8.0-beta.1/go.mod h1:dwVWpEtSXNUTYb+rSQ/KNNv4lVadx26teQB9CS+yaXM= +sigs.k8s.io/cluster-api v1.8.0-rc.0 h1:Q103UfK++rI160mtURBjg4ovJ9vxJTIrrdkL7NQBdFQ= +sigs.k8s.io/cluster-api v1.8.0-rc.0/go.mod h1:TNkfly2mrCG8O6DjGFru0USq1NhWbo2njpSXxKrRgL0= +sigs.k8s.io/cluster-api/test v1.8.0-rc.0 h1:JNAxc+8QE4Vk51NFgtex6Yh4KlTJfVOjOH6ybiO3HTI= +sigs.k8s.io/cluster-api/test v1.8.0-rc.0/go.mod h1:dwVWpEtSXNUTYb+rSQ/KNNv4lVadx26teQB9CS+yaXM= sigs.k8s.io/controller-runtime v0.9.0/go.mod h1:TgkfvrhhEw3PlI0BRL/5xM+89y3/yc0ZDfdbTl84si8= sigs.k8s.io/controller-runtime v0.18.4 h1:87+guW1zhvuPLh1PHybKdYFLU0YJp4FhJRmiHvm5BZw= sigs.k8s.io/controller-runtime v0.18.4/go.mod h1:TVoGrfdpbA9VRFaRnKgk9P5/atA0pMwq+f+msb9M8Sg= diff --git a/test/infrastructure/net-operator/main.go b/test/infrastructure/net-operator/main.go index d865a0939e..2e795fab5e 100644 --- a/test/infrastructure/net-operator/main.go +++ b/test/infrastructure/net-operator/main.go @@ -71,7 +71,7 @@ var ( restConfigQPS float32 restConfigBurst int healthAddr string - diagnosticsOptions = flags.DiagnosticsOptions{} + managerOptions = flags.ManagerOptions{} logOptions = logs.NewOptions() // net operator specific flags. networkInterfaceConcurrency int @@ -118,15 +118,15 @@ func InitFlags(fs *pflag.FlagSet) { "The minimum interval at which watched resources are reconciled (e.g. 15m)") fs.Float32Var(&restConfigQPS, "kube-api-qps", 20, - "Maximum queries per second from the controller client to the Kubernetes API server. Defaults to 20") + "Maximum queries per second from the controller client to the Kubernetes API server.") fs.IntVar(&restConfigBurst, "kube-api-burst", 30, - "Maximum number of queries that should be allowed in one burst from the controller client to the Kubernetes API server. Default 30") + "Maximum number of queries that should be allowed in one burst from the controller client to the Kubernetes API server.") fs.StringVar(&healthAddr, "health-addr", ":9440", "The address the health endpoint binds to.") - flags.AddDiagnosticsOptions(fs, &diagnosticsOptions) + flags.AddManagerOptions(fs, &managerOptions) feature.MutableGates.AddFlag(fs) } @@ -159,7 +159,11 @@ func main() { restConfig.Burst = restConfigBurst restConfig.UserAgent = remote.DefaultClusterAPIUserAgent(controllerName) - diagnosticsOpts := flags.GetDiagnosticsOptions(diagnosticsOptions) + _, metricsOptions, err := flags.GetManagerOptions(managerOptions) + if err != nil { + setupLog.Error(err, "Unable to start manager: invalid flags") + os.Exit(1) + } var watchNamespaces map[string]cache.Config if watchNamespace != "" { @@ -182,7 +186,7 @@ func main() { LeaderElectionResourceLock: resourcelock.LeasesResourceLock, HealthProbeBindAddress: healthAddr, PprofBindAddress: profilerAddress, - Metrics: diagnosticsOpts, + Metrics: *metricsOptions, Cache: cache.Options{ DefaultNamespaces: watchNamespaces, SyncPeriod: &syncPeriod, diff --git a/test/infrastructure/vcsim/main.go b/test/infrastructure/vcsim/main.go index 2eded290ca..8d73f1fe16 100644 --- a/test/infrastructure/vcsim/main.go +++ b/test/infrastructure/vcsim/main.go @@ -80,7 +80,7 @@ var ( restConfigQPS float32 restConfigBurst int healthAddr string - diagnosticsOptions = flags.DiagnosticsOptions{} + managerOptions = flags.ManagerOptions{} logOptions = logs.NewOptions() // vcsim specific flags. vSphereVMConcurrency int @@ -159,15 +159,15 @@ func InitFlags(fs *pflag.FlagSet) { "The minimum interval at which watched resources are reconciled (e.g. 15m)") fs.Float32Var(&restConfigQPS, "kube-api-qps", 20, - "Maximum queries per second from the controller client to the Kubernetes API server. Defaults to 20") + "Maximum queries per second from the controller client to the Kubernetes API server.") fs.IntVar(&restConfigBurst, "kube-api-burst", 30, - "Maximum number of queries that should be allowed in one burst from the controller client to the Kubernetes API server. Default 30") + "Maximum number of queries that should be allowed in one burst from the controller client to the Kubernetes API server.") fs.StringVar(&healthAddr, "health-addr", ":9440", "The address the health endpoint binds to.") - flags.AddDiagnosticsOptions(fs, &diagnosticsOptions) + flags.AddManagerOptions(fs, &managerOptions) feature.MutableGates.AddFlag(fs) } @@ -200,8 +200,11 @@ func main() { restConfig.Burst = restConfigBurst restConfig.UserAgent = remote.DefaultClusterAPIUserAgent(controllerName) - diagnosticsOpts := flags.GetDiagnosticsOptions(diagnosticsOptions) - + _, metricsOptions, err := flags.GetManagerOptions(managerOptions) + if err != nil { + setupLog.Error(err, "Unable to start manager: invalid flags") + os.Exit(1) + } var watchNamespaces map[string]cache.Config if watchNamespace != "" { watchNamespaces = map[string]cache.Config{ @@ -223,7 +226,7 @@ func main() { LeaderElectionResourceLock: resourcelock.LeasesResourceLock, HealthProbeBindAddress: healthAddr, PprofBindAddress: profilerAddress, - Metrics: diagnosticsOpts, + Metrics: *metricsOptions, Cache: cache.Options{ DefaultNamespaces: watchNamespaces, SyncPeriod: &syncPeriod,