Skip to content

Commit

Permalink
Merge pull request #11312 from sbueringer/pr-deprecate-cct
Browse files Browse the repository at this point in the history
🌱 Deprecate ClusterCacheTracker
  • Loading branch information
k8s-ci-robot authored Oct 22, 2024
2 parents 7ac4c86 + 4ca02ab commit c3ae478
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 3 deletions.
2 changes: 2 additions & 0 deletions controllers/remote/cluster_cache_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import (

// ClusterCacheReconciler is responsible for stopping remote cluster caches when
// the cluster for the remote cache is being deleted.
//
// Deprecated: This will be removed in Cluster API v1.10, use clustercache.ClusterCache instead.
type ClusterCacheReconciler struct {
Client client.Client
Tracker *ClusterCacheTracker
Expand Down
6 changes: 6 additions & 0 deletions controllers/remote/cluster_cache_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ const (
var ErrClusterLocked = errors.New("cluster is locked already")

// ClusterCacheTracker manages client caches for workload clusters.
//
// Deprecated: This will be removed in Cluster API v1.10, use clustercache.ClusterCache instead.
type ClusterCacheTracker struct {
log logr.Logger

Expand Down Expand Up @@ -108,6 +110,8 @@ type ClusterCacheTracker struct {

// ClusterCacheTrackerOptions defines options to configure
// a ClusterCacheTracker.
//
// Deprecated: This will be removed in Cluster API v1.10, use clustercache.ClusterCache instead.
type ClusterCacheTrackerOptions struct {
// SecretCachingClient is a client which caches secrets.
// If set it will be used to read the kubeconfig secret.
Expand Down Expand Up @@ -172,6 +176,8 @@ func setDefaultOptions(opts *ClusterCacheTrackerOptions) {
}

// NewClusterCacheTracker creates a new ClusterCacheTracker.
//
// Deprecated: This will be removed in Cluster API v1.10, use clustercache.SetupWithManager instead.
func NewClusterCacheTracker(manager ctrl.Manager, options ClusterCacheTrackerOptions) (*ClusterCacheTracker, error) {
setDefaultOptions(&options)

Expand Down
2 changes: 2 additions & 0 deletions controllers/remote/cluster_cache_tracker_fake.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import (
)

// NewTestClusterCacheTracker creates a new fake ClusterCacheTracker that can be used by unit tests with fake client.
//
// Deprecated: This will be removed in Cluster API v1.10, use clustercache.NewTestClusterCacheTracker instead.
func NewTestClusterCacheTracker(log logr.Logger, cl client.Client, remoteClient client.Client, scheme *runtime.Scheme, objKey client.ObjectKey, watchObjects ...string) *ClusterCacheTracker {
testCacheTracker := &ClusterCacheTracker{
log: log,
Expand Down
4 changes: 4 additions & 0 deletions controllers/remote/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,17 @@ import (
)

// Index is a helper to model the info passed to cache.IndexField.
//
// Deprecated: This will be removed in Cluster API v1.10, use clustercache.CacheOptionsIndex instead.
type Index struct {
Object client.Object
Field string
ExtractValue client.IndexerFunc
}

// NodeProviderIDIndex is used to index Nodes by ProviderID.
//
// Deprecated: This will be removed in Cluster API v1.10, use clustercache.NodeProviderIDIndex instead.
var NodeProviderIDIndex = Index{
Object: &corev1.Node{},
Field: index.NodeProviderIDField,
Expand Down
3 changes: 0 additions & 3 deletions controlplane/kubeadm/internal/controllers/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,6 @@ func (r *KubeadmControlPlaneReconciler) SetupWithManager(ctx context.Context, mg
r.ssaCache = ssa.NewCache()

if r.managementCluster == nil {
if r.ClusterCache == nil {
return errors.New("cluster cache tracker is nil, cannot create the internal management cluster resource")
}
r.managementCluster = &internal.Management{
Client: r.Client,
SecretCachingClient: r.SecretCachingClient,
Expand Down
6 changes: 6 additions & 0 deletions docs/book/src/developer/providers/migrations/v1.8-to-v1.9.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,9 @@ maintainers of providers and consumers of our Go API.
### Suggested changes for providers

- The Errors package was created when capi provider implementation was running as machineActuators that needed to vendor core capi to function. There is no usage recommendations today and its value is questionable since we moved to CRDs that inter-operate mostly via conditions. Instead we plan to drop the dedicated semantic for terminal failure and keep improving Machine lifecycle signal through conditions. Therefore the Errors package [has been deprecated in v1.8](https://github.com/kubernetes-sigs/cluster-api/issues/10784). It's recommended to remove any usage of the currently exported variables.
- The `ClusterCacheTracker` component has been deprecated, please use the new `ClusterCache` instead. For more context and examples for
how to use it, see [PR: Introduce new ClusterCache](https://github.com/kubernetes-sigs/cluster-api/pull/11247) and the corresponding
[issue](https://github.com/kubernetes-sigs/cluster-api/issues/11272). Some notes:
- The `DisabledFor` option (previously `ClientUncachedObjects`) is not defaulted to `&corev1.ConfigMap` & `&corev1.Secret` anymore,
thus it's now necessary to explicitly set `DisabledFor` to avoid caching ConfigMaps and Secrets.
- `SecretClient` and `UserAgent` are now mandatory options, please take a look at the corresponding godoc.

0 comments on commit c3ae478

Please sign in to comment.