This document provides an overview over relevant changes between ClusterAPI v1.1 and v1.2 for maintainers of providers and consumers of our Go API.
- The Go version used by Cluster API is now Go 1.17.x
Note: Only the most relevant dependencies are listed, k8s.io/
and ginkgo
/gomega
dependencies
in ClusterAPI are kept in sync with the versions used by sigs.k8s.io/controller-runtime
.
- sigs.k8s.io/kind: v0.11.x => v0.14.x
- k8s.io/*: v0.23.x => v0.24.x (derived from controller-runtime)
- github.com/onsi/gomega: v0.17.0 => v0.18.1 (derived from controller-runtime)
- k8s.io/kubectl: v0.23.5 => 0.24.0
util.MachinesByCreationTimestamp
has been deprecated and will be removed in a future release.
- The
third_party/kubernetes-drain
package has been removed, as we're now usingk8s.io/kubectl/pkg/drain
instead (PR). util/version.CompareWithBuildIdentifiers
has been removed, please useutil/version.Compare(a, b, WithBuildTags())
instead.- The functions
annotations.HasPausedAnnotation
andannotations.HasSkipRemediationAnnotation
have been removed, please useannotations.HasPaused
andannotations.HasSkipRemediation
respectively instead. ClusterName
has been removed.
util.ClusterToInfrastructureMapFuncWithExternallyManagedCheck
was removed and the externally managed check was added toutil.ClusterToInfrastructureMapFunc
, which required changing its signature. Users of the former simply need to start using the latter and users of the latter need to add the new arguments to their call.
-
Logging:
-
To align with the upstream Kubernetes community CAPI now configures logging via
component-base/logs
. This provides advantages like support for the JSON logging format (via--logging-format=json
) and automatic deprecation of klog flags aligned to the upstream Kubernetes deprecation period.View
main.go
diffvar ( ... + logOptions = logs.NewOptions() ) func init() { - klog.InitFlags(nil) func InitFlags(fs *pflag.FlagSet) { + logs.AddFlags(fs, logs.SkipLoggingConfigurationFlags()) + logOptions.AddFlags(fs) func main() { ... pflag.Parse() + if err := logOptions.ValidateAndApply(); err != nil { + setupLog.Error(err, "unable to start manager") + os.Exit(1) + } + + // Set the Klog format, as the Serialize format shouldn't be used anymore. + // This makes sure that the logs are formatted correctly, i.e.: + // * JSON logging format: msg isn't serialized twice + // * text logging format: values are formatted with their .String() func. + ctrl.SetLogger(klogr.NewWithOptions(klogr.WithFormat(klogr.FormatKlog))) - ctrl.SetLogger(klogr.New())
This change has been introduced in CAPI in the following PRs: #6072, #6190.
Note: This change is not mandatory for providers, but highly recommended.
-
-
Following E2E framework functions are now checking that machines are created in the expected failure domain (if defined); all E2E tests can now verify failure domains too.
ApplyClusterTemplateAndWait
WaitForControlPlaneAndMachinesReady
DiscoveryAndWaitForMachineDeployments
-
The
AssertControlPlaneFailureDomains
function in the E2E test framework has been modified to allow proper failure domain testing. -
After investigating an issue we discovered that improper implementation of a check on
cluster.status.infrastructureReady
can lead to problems during cluster deletion. As a consequence, we recommend that all providers ensure:- The check for
cluster.status.infrastructureReady=true
usually existing at the beginning of the reconcile loop for control-plane providers is implemented after setting external objects ref; - The check for
cluster.status.infrastructureReady=true
usually existing at the beginning of the reconcile loop for infrastructure provider does not prevent the object to be deleted
rif. PR #6183
- The check for