Skip to content

Commit

Permalink
Merge pull request #649 from Danil-Grigorev/bump-capi-1.9
Browse files Browse the repository at this point in the history
🌱 Bump CAPI to 1.9
  • Loading branch information
k8s-ci-robot authored Dec 16, 2024
2 parents 298d7b7 + d0ec677 commit ade3062
Show file tree
Hide file tree
Showing 16 changed files with 802 additions and 1,024 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ IMAGE_REVIEWERS ?= $(shell ./hack/get-project-maintainers.sh)

# Binaries.
# Need to use abspath so we can invoke these from subdirectories
CONTROLLER_GEN_VER := v0.15.0
CONTROLLER_GEN_VER := v0.16.1
CONTROLLER_GEN_BIN := controller-gen
CONTROLLER_GEN := $(TOOLS_BIN_DIR)/$(CONTROLLER_GEN_BIN)-$(CONTROLLER_GEN_VER)

GOLANGCI_LINT_VER := v1.57.2
GOLANGCI_LINT_BIN := golangci-lint
GOLANGCI_LINT := $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_BIN)-$(GOLANGCI_LINT_VER)

KUSTOMIZE_VER := v5.0.1
KUSTOMIZE_VER := v5.3.0
KUSTOMIZE_BIN := kustomize
KUSTOMIZE := $(TOOLS_BIN_DIR)/$(KUSTOMIZE_BIN)-$(KUSTOMIZE_VER)

Expand Down
76 changes: 16 additions & 60 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import (
"sigs.k8s.io/cluster-api-operator/internal/webhook"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
clusterctlv1 "sigs.k8s.io/cluster-api/cmd/clusterctl/api/v1alpha3"
"sigs.k8s.io/cluster-api/controllers/remote"
"sigs.k8s.io/cluster-api/util/flags"
"sigs.k8s.io/cluster-api/version"
ctrl "sigs.k8s.io/controller-runtime"
Expand All @@ -55,23 +54,21 @@ var (
setupLog = ctrl.Log.WithName("setup")

// flags.
enableLeaderElection bool
leaderElectionLeaseDuration time.Duration
leaderElectionRenewDeadline time.Duration
leaderElectionRetryPeriod time.Duration
watchFilterValue string
watchNamespace string
profilerAddress string
enableContentionProfiling bool
concurrencyNumber int
syncPeriod time.Duration
clusterCacheTrackerClientQPS float32
clusterCacheTrackerClientBurst int
webhookPort int
webhookCertDir string
healthAddr string
watchConfigSecretChanges bool
managerOptions = flags.ManagerOptions{}
enableLeaderElection bool
leaderElectionLeaseDuration time.Duration
leaderElectionRenewDeadline time.Duration
leaderElectionRetryPeriod time.Duration
watchFilterValue string
watchNamespace string
profilerAddress string
enableContentionProfiling bool
concurrencyNumber int
syncPeriod time.Duration
webhookPort int
webhookCertDir string
healthAddr string
watchConfigSecretChanges bool
managerOptions = flags.ManagerOptions{}
)

func init() {
Expand Down Expand Up @@ -120,12 +117,6 @@ func InitFlags(fs *pflag.FlagSet) {
fs.DurationVar(&syncPeriod, "sync-period", 10*time.Minute,
"The minimum interval at which watched resources are reconciled (e.g. 15m)")

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(&webhookPort, "webhook-port", 9443, "Webhook Server port")

fs.StringVar(&webhookCertDir, "webhook-cert-dir", "/tmp/k8s-webhook-server/serving-certs/",
Expand Down Expand Up @@ -228,39 +219,11 @@ func setupChecks(mgr ctrl.Manager) {
}

func setupReconcilers(mgr ctrl.Manager, watchConfigSecretChanges bool) {
secretCachingClient, err := client.New(mgr.GetConfig(), client.Options{
HTTPClient: mgr.GetHTTPClient(),
Cache: &client.CacheOptions{
Reader: mgr.GetCache(),
},
})
if err != nil {
setupLog.Error(err, "unable to create secret caching client")
os.Exit(1)
}
// Set up a ClusterCacheTracker and ClusterCacheReconciler to provide to controllers
// requiring a connection to a remote cluster
tracker, err := remote.NewClusterCacheTracker(
mgr,
remote.ClusterCacheTrackerOptions{
SecretCachingClient: secretCachingClient,
ControllerName: "cluster-api-operator-controller",
Log: &ctrl.Log,
ClientQPS: clusterCacheTrackerClientQPS,
ClientBurst: clusterCacheTrackerClientBurst,
},
)
if err != nil {
setupLog.Error(err, "Unable to create cluster cache tracker")
os.Exit(1)
}

if err := (&providercontroller.GenericProviderReconciler{
Provider: &operatorv1.CoreProvider{},
ProviderList: &operatorv1.CoreProviderList{},
Client: mgr.GetClient(),
Config: mgr.GetConfig(),
Tracker: tracker,
WatchConfigSecretChanges: watchConfigSecretChanges,
}).SetupWithManager(mgr, concurrency(concurrencyNumber)); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "CoreProvider")
Expand All @@ -272,7 +235,6 @@ func setupReconcilers(mgr ctrl.Manager, watchConfigSecretChanges bool) {
ProviderList: &operatorv1.InfrastructureProviderList{},
Client: mgr.GetClient(),
Config: mgr.GetConfig(),
Tracker: tracker,
WatchConfigSecretChanges: watchConfigSecretChanges,
}).SetupWithManager(mgr, concurrency(concurrencyNumber)); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "InfrastructureProvider")
Expand All @@ -284,7 +246,6 @@ func setupReconcilers(mgr ctrl.Manager, watchConfigSecretChanges bool) {
ProviderList: &operatorv1.BootstrapProviderList{},
Client: mgr.GetClient(),
Config: mgr.GetConfig(),
Tracker: tracker,
WatchConfigSecretChanges: watchConfigSecretChanges,
}).SetupWithManager(mgr, concurrency(concurrencyNumber)); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "BootstrapProvider")
Expand All @@ -296,7 +257,6 @@ func setupReconcilers(mgr ctrl.Manager, watchConfigSecretChanges bool) {
ProviderList: &operatorv1.ControlPlaneProviderList{},
Client: mgr.GetClient(),
Config: mgr.GetConfig(),
Tracker: tracker,
WatchConfigSecretChanges: watchConfigSecretChanges,
}).SetupWithManager(mgr, concurrency(concurrencyNumber)); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "ControlPlaneProvider")
Expand All @@ -308,7 +268,6 @@ func setupReconcilers(mgr ctrl.Manager, watchConfigSecretChanges bool) {
ProviderList: &operatorv1.AddonProviderList{},
Client: mgr.GetClient(),
Config: mgr.GetConfig(),
Tracker: tracker,
WatchConfigSecretChanges: watchConfigSecretChanges,
}).SetupWithManager(mgr, concurrency(concurrencyNumber)); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "AddonProvider")
Expand All @@ -320,7 +279,6 @@ func setupReconcilers(mgr ctrl.Manager, watchConfigSecretChanges bool) {
ProviderList: &operatorv1.IPAMProviderList{},
Client: mgr.GetClient(),
Config: mgr.GetConfig(),
Tracker: tracker,
WatchConfigSecretChanges: watchConfigSecretChanges,
}).SetupWithManager(mgr, concurrency(concurrencyNumber)); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "IPAMProvider")
Expand All @@ -332,16 +290,14 @@ func setupReconcilers(mgr ctrl.Manager, watchConfigSecretChanges bool) {
ProviderList: &operatorv1.RuntimeExtensionProviderList{},
Client: mgr.GetClient(),
Config: mgr.GetConfig(),
Tracker: tracker,
WatchConfigSecretChanges: watchConfigSecretChanges,
}).SetupWithManager(mgr, concurrency(concurrencyNumber)); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "RuntimeExtensionProvider")
os.Exit(1)
}

if err := (&healtchcheckcontroller.ProviderHealthCheckReconciler{
Client: mgr.GetClient(),
Tracker: tracker,
Client: mgr.GetClient(),
}).SetupWithManager(mgr, concurrency(concurrencyNumber)); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "Healthcheck")
os.Exit(1)
Expand Down
Loading

0 comments on commit ade3062

Please sign in to comment.