Skip to content

Commit

Permalink
Remove deprecated code in v1.6
Browse files Browse the repository at this point in the history
Signed-off-by: Furkat Gofurov <[email protected]>
furkatgofurov7 committed Aug 8, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent bda002f commit 229e7ae
Showing 5 changed files with 0 additions and 374 deletions.
130 changes: 0 additions & 130 deletions controllers/noderefutil/providerid.go

This file was deleted.

170 changes: 0 additions & 170 deletions controllers/noderefutil/providerid_test.go

This file was deleted.

6 changes: 0 additions & 6 deletions controllers/remote/index.go
Original file line number Diff line number Diff line change
@@ -36,9 +36,3 @@ var NodeProviderIDIndex = Index{
Field: index.NodeProviderIDField,
ExtractValue: index.NodeByProviderID,
}

// DefaultIndexes is the default list of indexes on a ClusterCacheTracker.
//
// Deprecated: This variable is deprecated and will be removed in a future release of Cluster API.
// Instead please use `[]Index{NodeProviderIDIndex}`.
var DefaultIndexes = []Index{NodeProviderIDIndex}
18 changes: 0 additions & 18 deletions util/retry.go
Original file line number Diff line number Diff line change
@@ -46,21 +46,3 @@ func Retry(fn wait.ConditionFunc, initialBackoffSec int) error {
}
return nil
}

// Poll tries a condition func until it returns true, an error, or the timeout
// is reached.
//
// Deprecated: This function has been deprecated and will be removed in a future release.
// Please use utils from "k8s.io/apimachinery/pkg/util/wait" instead.
func Poll(interval, timeout time.Duration, condition wait.ConditionFunc) error {
return wait.Poll(interval, timeout, condition)
}

// PollImmediate tries a condition func until it returns true, an error, or the timeout
// is reached.
//
// Deprecated: This function has been deprecated and will be removed in a future release.
// Please use utils from "k8s.io/apimachinery/pkg/util/wait" instead.
func PollImmediate(interval, timeout time.Duration, condition wait.ConditionFunc) error {
return wait.PollImmediate(interval, timeout, condition)
}
50 changes: 0 additions & 50 deletions util/util.go
Original file line number Diff line number Diff line change
@@ -467,56 +467,6 @@ func (k KubeAwareAPIVersions) Less(i, j int) bool {
return k8sversion.CompareKubeAwareVersionStrings(k[i], k[j]) < 0
}

// ClusterToObjectsMapper returns a mapper function that gets a cluster and lists all objects for the object passed in
// and returns a list of requests.
// NB: The objects are required to have `clusterv1.ClusterNameLabel` applied.
//
// Deprecated: This function is deprecated and will be removed in a future release, use ClusterToTypedObjectsMapper instead.
// The problem with this function is that it uses UnstructuredList to retrieve objects, with the default client configuration
// this will lead to uncached List calls, which is a major performance issue.
func ClusterToObjectsMapper(c client.Client, ro client.ObjectList, scheme *runtime.Scheme) (handler.MapFunc, error) {
gvk, err := apiutil.GVKForObject(ro, scheme)
if err != nil {
return nil, err
}

isNamespaced, err := isAPINamespaced(gvk, c.RESTMapper())
if err != nil {
return nil, err
}

return func(ctx context.Context, o client.Object) []ctrl.Request {
cluster, ok := o.(*clusterv1.Cluster)
if !ok {
return nil
}

listOpts := []client.ListOption{
client.MatchingLabels{
clusterv1.ClusterNameLabel: cluster.Name,
},
}

if isNamespaced {
listOpts = append(listOpts, client.InNamespace(cluster.Namespace))
}

list := &unstructured.UnstructuredList{}
list.SetGroupVersionKind(gvk)
if err := c.List(ctx, list, listOpts...); err != nil {
return nil
}

results := []ctrl.Request{}
for _, obj := range list.Items {
results = append(results, ctrl.Request{
NamespacedName: client.ObjectKey{Namespace: obj.GetNamespace(), Name: obj.GetName()},
})
}
return results
}, nil
}

// ClusterToTypedObjectsMapper returns a mapper function that gets a cluster and lists all objects for the object passed in
// and returns a list of requests.
// Note: This function uses the passed in typed ObjectList and thus with the default client configuration all list calls

0 comments on commit 229e7ae

Please sign in to comment.