Skip to content

Commit d630332

Browse files
authored
Merge pull request #632 from furkatgofurov7/bump-capi-1-8
🌱 Bump CAPI to v1.8.5
2 parents 98dd799 + c7b9c24 commit d630332

40 files changed

+30911
-23235
lines changed

Makefile

+9-5
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ GO_INSTALL := ./scripts/go_install.sh
5353
export PATH := $(abspath $(TOOLS_BIN_DIR)):$(PATH)
5454

5555
# Kubebuilder
56-
export KUBEBUILDER_ENVTEST_KUBERNETES_VERSION ?= 1.26.1
56+
export KUBEBUILDER_ENVTEST_KUBERNETES_VERSION ?= 1.30.3
5757
export KUBEBUILDER_CONTROLPLANE_START_TIMEOUT ?= 60s
5858
export KUBEBUILDER_CONTROLPLANE_STOP_TIMEOUT ?= 60s
5959

@@ -66,7 +66,7 @@ IMAGE_REVIEWERS ?= $(shell ./hack/get-project-maintainers.sh)
6666

6767
# Binaries.
6868
# Need to use abspath so we can invoke these from subdirectories
69-
CONTROLLER_GEN_VER := v0.14.0
69+
CONTROLLER_GEN_VER := v0.15.0
7070
CONTROLLER_GEN_BIN := controller-gen
7171
CONTROLLER_GEN := $(TOOLS_BIN_DIR)/$(CONTROLLER_GEN_BIN)-$(CONTROLLER_GEN_VER)
7272

@@ -78,15 +78,19 @@ KUSTOMIZE_VER := v5.0.1
7878
KUSTOMIZE_BIN := kustomize
7979
KUSTOMIZE := $(TOOLS_BIN_DIR)/$(KUSTOMIZE_BIN)-$(KUSTOMIZE_VER)
8080

81-
SETUP_ENVTEST_VER := v0.0.0-20240215143116-d0396a3d6f9f
81+
# This is a commit from CR main (22.05.2024).
82+
# Intentionally using a commit from main to use a setup-envtest version
83+
# that uses binaries from controller-tools, not GCS.
84+
# CR PR: https://github.com/kubernetes-sigs/controller-runtime/pull/2811
85+
SETUP_ENVTEST_VER := v0.0.0-20240522175850-2e9781e9fc60
8286
SETUP_ENVTEST_BIN := setup-envtest
8387
SETUP_ENVTEST := $(TOOLS_BIN_DIR)/$(SETUP_ENVTEST_BIN)-$(SETUP_ENVTEST_VER)
8488

8589
GOTESTSUM_VER := v1.11.0
8690
GOTESTSUM_BIN := gotestsum
8791
GOTESTSUM := $(TOOLS_BIN_DIR)/$(GOTESTSUM_BIN)-$(GOTESTSUM_VER)
8892

89-
GINKGO_VER := v2.17.1
93+
GINKGO_VER := v2.20.1
9094
GINKGO_BIN := ginkgo
9195
GINKGO := $(TOOLS_BIN_DIR)/$(GINKGO_BIN)-$(GINKGO_VER)
9296

@@ -140,7 +144,7 @@ CONTROLLER_IMG_TAG ?= $(CONTROLLER_IMG)-$(ARCH):$(TAG)
140144
LDFLAGS := $(shell $(ROOT)/hack/version.sh)
141145

142146
# Default cert-manager version
143-
CERT_MANAGER_VERSION ?= v1.14.5
147+
CERT_MANAGER_VERSION ?= v1.15.1
144148

145149
# E2E configuration
146150
GINKGO_NOCOLOR ?= false

api/v1alpha1/provider_conversion.go

+23-24
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
apimachineryconversion "k8s.io/apimachinery/pkg/conversion"
2323
"k8s.io/utils/ptr"
2424
utilconversion "sigs.k8s.io/cluster-api/util/conversion"
25-
ctrlconfigv1 "sigs.k8s.io/controller-runtime/pkg/config/v1alpha1"
2625
"sigs.k8s.io/controller-runtime/pkg/conversion"
2726

2827
operatorv1 "sigs.k8s.io/cluster-api-operator/api/v1alpha2"
@@ -281,33 +280,33 @@ func Convert_v1alpha1_ManagerSpec_To_v1alpha2_ManagerSpec(in *ManagerSpec, out *
281280
return nil
282281
}
283282

284-
out.ControllerManagerConfiguration.SyncPeriod = in.ControllerManagerConfigurationSpec.SyncPeriod
285-
out.ControllerManagerConfiguration.LeaderElection = in.ControllerManagerConfigurationSpec.LeaderElection
286-
out.ControllerManagerConfiguration.CacheNamespace = in.ControllerManagerConfigurationSpec.CacheNamespace
287-
out.ControllerManagerConfiguration.GracefulShutdownTimeout = in.ControllerManagerConfigurationSpec.GracefulShutdownTimeout
283+
out.ControllerManagerConfiguration.SyncPeriod = in.ControllerManager.SyncPeriod
284+
out.ControllerManagerConfiguration.LeaderElection = in.ControllerManager.LeaderElection
285+
out.ControllerManagerConfiguration.CacheNamespace = in.ControllerManager.CacheNamespace
286+
out.ControllerManagerConfiguration.GracefulShutdownTimeout = in.ControllerManager.GracefulShutdownTimeout
288287

289-
if in.ControllerManagerConfigurationSpec.Controller != nil {
288+
if in.ControllerManager.Controller != nil {
290289
out.ControllerManagerConfiguration.Controller = &operatorv1.ControllerConfigurationSpec{
291-
GroupKindConcurrency: in.ControllerManagerConfigurationSpec.Controller.GroupKindConcurrency,
292-
CacheSyncTimeout: in.ControllerManagerConfigurationSpec.Controller.CacheSyncTimeout,
293-
RecoverPanic: in.ControllerManagerConfigurationSpec.Controller.RecoverPanic,
290+
GroupKindConcurrency: in.ControllerManager.Controller.GroupKindConcurrency,
291+
CacheSyncTimeout: in.ControllerManager.Controller.CacheSyncTimeout,
292+
RecoverPanic: in.ControllerManager.Controller.RecoverPanic,
294293
}
295294
}
296295

297296
out.ControllerManagerConfiguration.Metrics = operatorv1.ControllerMetrics{
298-
BindAddress: in.ControllerManagerConfigurationSpec.Metrics.BindAddress,
297+
BindAddress: in.ControllerManager.Metrics.BindAddress,
299298
}
300299

301300
out.ControllerManagerConfiguration.Health = operatorv1.ControllerHealth{
302-
HealthProbeBindAddress: in.ControllerManagerConfigurationSpec.Health.HealthProbeBindAddress,
303-
ReadinessEndpointName: in.ControllerManagerConfigurationSpec.Health.ReadinessEndpointName,
304-
LivenessEndpointName: in.ControllerManagerConfigurationSpec.Health.LivenessEndpointName,
301+
HealthProbeBindAddress: in.ControllerManager.Health.HealthProbeBindAddress,
302+
ReadinessEndpointName: in.ControllerManager.Health.ReadinessEndpointName,
303+
LivenessEndpointName: in.ControllerManager.Health.LivenessEndpointName,
305304
}
306305

307306
out.ControllerManagerConfiguration.Webhook = operatorv1.ControllerWebhook{
308-
Port: in.ControllerManagerConfigurationSpec.Webhook.Port,
309-
Host: in.ControllerManagerConfigurationSpec.Webhook.Host,
310-
CertDir: in.ControllerManagerConfigurationSpec.Webhook.CertDir,
307+
Port: in.ControllerManager.Webhook.Port,
308+
Host: in.ControllerManager.Webhook.Host,
309+
CertDir: in.ControllerManager.Webhook.CertDir,
311310
}
312311

313312
out.ProfilerAddress = in.ProfilerAddress
@@ -323,30 +322,30 @@ func Convert_v1alpha2_ManagerSpec_To_v1alpha1_ManagerSpec(in *operatorv1.Manager
323322
return nil
324323
}
325324

326-
out.ControllerManagerConfigurationSpec.SyncPeriod = in.ControllerManagerConfiguration.SyncPeriod
327-
out.ControllerManagerConfigurationSpec.LeaderElection = in.ControllerManagerConfiguration.LeaderElection
328-
out.ControllerManagerConfigurationSpec.CacheNamespace = in.ControllerManagerConfiguration.CacheNamespace
329-
out.ControllerManagerConfigurationSpec.GracefulShutdownTimeout = in.ControllerManagerConfiguration.GracefulShutdownTimeout
325+
out.ControllerManager.SyncPeriod = in.ControllerManagerConfiguration.SyncPeriod
326+
out.ControllerManager.LeaderElection = in.ControllerManagerConfiguration.LeaderElection
327+
out.ControllerManager.CacheNamespace = in.ControllerManagerConfiguration.CacheNamespace
328+
out.ControllerManager.GracefulShutdownTimeout = in.ControllerManagerConfiguration.GracefulShutdownTimeout
330329

331330
if in.ControllerManagerConfiguration.Controller != nil {
332-
out.ControllerManagerConfigurationSpec.Controller = &ctrlconfigv1.ControllerConfigurationSpec{
331+
out.ControllerManager.Controller = &ControllerConfigurationSpec{
333332
GroupKindConcurrency: in.ControllerManagerConfiguration.Controller.GroupKindConcurrency,
334333
CacheSyncTimeout: in.ControllerManagerConfiguration.Controller.CacheSyncTimeout,
335334
RecoverPanic: in.ControllerManagerConfiguration.Controller.RecoverPanic,
336335
}
337336
}
338337

339-
out.ControllerManagerConfigurationSpec.Metrics = ctrlconfigv1.ControllerMetrics{
338+
out.ControllerManager.Metrics = ControllerMetrics{
340339
BindAddress: in.ControllerManagerConfiguration.Metrics.BindAddress,
341340
}
342341

343-
out.ControllerManagerConfigurationSpec.Health = ctrlconfigv1.ControllerHealth{
342+
out.ControllerManager.Health = ControllerHealth{
344343
HealthProbeBindAddress: in.ControllerManagerConfiguration.Health.HealthProbeBindAddress,
345344
ReadinessEndpointName: in.ControllerManagerConfiguration.Health.ReadinessEndpointName,
346345
LivenessEndpointName: in.ControllerManagerConfiguration.Health.LivenessEndpointName,
347346
}
348347

349-
out.ControllerManagerConfigurationSpec.Webhook = ctrlconfigv1.ControllerWebhook{
348+
out.ControllerManager.Webhook = ControllerWebhook{
350349
Port: in.ControllerManagerConfiguration.Webhook.Port,
351350
Host: in.ControllerManagerConfiguration.Webhook.Host,
352351
CertDir: in.ControllerManagerConfiguration.Webhook.CertDir,

api/v1alpha1/provider_types.go

+126-3
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ limitations under the License.
1717
package v1alpha1
1818

1919
import (
20+
"time"
21+
2022
corev1 "k8s.io/api/core/v1"
2123
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
24+
configv1alpha1 "k8s.io/component-base/config/v1alpha1"
2225
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
23-
ctrlconfigv1 "sigs.k8s.io/controller-runtime/pkg/config/v1alpha1"
2426
)
2527

2628
const (
@@ -84,8 +86,8 @@ type ConfigmapReference struct {
8486

8587
// ManagerSpec defines the properties that can be enabled on the controller manager for the provider.
8688
type ManagerSpec struct {
87-
// ControllerManagerConfigurationSpec defines the desired state of GenericControllerManagerConfiguration.
88-
ctrlconfigv1.ControllerManagerConfigurationSpec `json:",inline"`
89+
// ControllerManager returns the configurations for controllers
90+
ControllerManager `json:",inline"`
8991

9092
// ProfilerAddress defines the bind address to expose the pprof profiler (e.g. localhost:6060).
9193
// Default empty, meaning the profiler is disabled.
@@ -112,6 +114,127 @@ type ManagerSpec struct {
112114
FeatureGates map[string]bool `json:"featureGates,omitempty"`
113115
}
114116

117+
type ControllerManager struct {
118+
// Webhook contains the controllers webhook configuration
119+
// +optional
120+
Webhook ControllerWebhook `json:"webhook,omitempty"`
121+
122+
// SyncPeriod determines the minimum frequency at which watched resources are
123+
// reconciled. A lower period will correct entropy more quickly, but reduce
124+
// responsiveness to change if there are many watched resources. Change this
125+
// value only if you know what you are doing. Defaults to 10 hours if unset.
126+
// there will a 10 percent jitter between the SyncPeriod of all controllers
127+
// so that all controllers will not send list requests simultaneously.
128+
// +optional
129+
SyncPeriod *metav1.Duration `json:"syncPeriod,omitempty"`
130+
131+
// LeaderElection is the LeaderElection config to be used when configuring
132+
// the manager.Manager leader election
133+
// +optional
134+
LeaderElection *configv1alpha1.LeaderElectionConfiguration `json:"leaderElection,omitempty"`
135+
136+
// Metrics contains thw controller metrics configuration
137+
// +optional
138+
Metrics ControllerMetrics `json:"metrics,omitempty"`
139+
140+
// CacheNamespace if specified restricts the manager's cache to watch objects in
141+
// the desired namespace Defaults to all namespaces
142+
//
143+
// Note: If a namespace is specified, controllers can still Watch for a
144+
// cluster-scoped resource (e.g Node). For namespaced resources the cache
145+
// will only hold objects from the desired namespace.
146+
// +optional
147+
CacheNamespace string `json:"cacheNamespace,omitempty"`
148+
149+
// GracefulShutdownTimeout is the duration given to runnable to stop before the manager actually returns on stop.
150+
// To disable graceful shutdown, set to time.Duration(0)
151+
// To use graceful shutdown without timeout, set to a negative duration, e.G. time.Duration(-1)
152+
// The graceful shutdown is skipped for safety reasons in case the leader election lease is lost.
153+
GracefulShutdownTimeout *metav1.Duration `json:"gracefulShutDown,omitempty"`
154+
155+
// Health contains the controller health configuration
156+
// +optional
157+
Health ControllerHealth `json:"health,omitempty"`
158+
159+
// Controller contains global configuration options for controllers
160+
// registered within this manager.
161+
// +optional
162+
Controller *ControllerConfigurationSpec `json:"controller,omitempty"`
163+
}
164+
165+
// ControllerWebhook defines the webhook server for the controller.
166+
type ControllerWebhook struct {
167+
// Port is the port that the webhook server serves at.
168+
// It is used to set webhook.Server.Port.
169+
// +optional
170+
Port *int `json:"port,omitempty"`
171+
172+
// Host is the hostname that the webhook server binds to.
173+
// It is used to set webhook.Server.Host.
174+
// +optional
175+
Host string `json:"host,omitempty"`
176+
177+
// CertDir is the directory that contains the server key and certificate.
178+
// if not set, webhook server would look up the server key and certificate in
179+
// {TempDir}/k8s-webhook-server/serving-certs. The server key and certificate
180+
// must be named tls.key and tls.crt, respectively.
181+
// +optional
182+
CertDir string `json:"certDir,omitempty"`
183+
}
184+
185+
// ControllerMetrics defines the metrics configs.
186+
type ControllerMetrics struct {
187+
// BindAddress is the TCP address that the controller should bind to
188+
// for serving prometheus metrics.
189+
// It can be set to "0" to disable the metrics serving.
190+
// +optional
191+
BindAddress string `json:"bindAddress,omitempty"`
192+
}
193+
194+
// ControllerHealth defines the health configs.
195+
type ControllerHealth struct {
196+
// HealthProbeBindAddress is the TCP address that the controller should bind to
197+
// for serving health probes
198+
// It can be set to "0" or "" to disable serving the health probe.
199+
// +optional
200+
HealthProbeBindAddress string `json:"healthProbeBindAddress,omitempty"`
201+
202+
// ReadinessEndpointName, defaults to "readyz"
203+
// +optional
204+
ReadinessEndpointName string `json:"readinessEndpointName,omitempty"`
205+
206+
// LivenessEndpointName, defaults to "healthz"
207+
// +optional
208+
LivenessEndpointName string `json:"livenessEndpointName,omitempty"`
209+
}
210+
211+
// ControllerConfigurationSpec defines the global configuration for
212+
// controllers registered with the manager.
213+
type ControllerConfigurationSpec struct {
214+
// GroupKindConcurrency is a map from a Kind to the number of concurrent reconciliation
215+
// allowed for that controller.
216+
//
217+
// When a controller is registered within this manager using the builder utilities,
218+
// users have to specify the type the controller reconciles in the For(...) call.
219+
// If the object's kind passed matches one of the keys in this map, the concurrency
220+
// for that controller is set to the number specified.
221+
//
222+
// The key is expected to be consistent in form with GroupKind.String(),
223+
// e.g. ReplicaSet in apps group (regardless of version) would be `ReplicaSet.apps`.
224+
//
225+
// +optional
226+
GroupKindConcurrency map[string]int `json:"groupKindConcurrency,omitempty"`
227+
228+
// CacheSyncTimeout refers to the time limit set to wait for syncing caches.
229+
// Defaults to 2 minutes if not set.
230+
// +optional
231+
CacheSyncTimeout *time.Duration `json:"cacheSyncTimeout,omitempty"`
232+
233+
// RecoverPanic indicates if panics should be recovered.
234+
// +optional
235+
RecoverPanic *bool `json:"recoverPanic,omitempty"`
236+
}
237+
115238
// DeploymentSpec defines the properties that can be enabled on the Deployment for the provider.
116239
type DeploymentSpec struct {
117240
// Number of desired pods. This is a pointer to distinguish between explicit zero and not specified. Defaults to 1.

0 commit comments

Comments
 (0)