@@ -29,6 +29,7 @@ import (
29
29
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
30
30
"k8s.io/client-go/tools/record"
31
31
"k8s.io/klog/v2"
32
+ "k8s.io/utils/ptr"
32
33
"sigs.k8s.io/controller-runtime/pkg/client"
33
34
"sigs.k8s.io/yaml"
34
35
@@ -126,7 +127,7 @@ func (o *overrideManagerImpl) ApplyOverridePolicies(rawObj *unstructured.Unstruc
126
127
func (o * overrideManagerImpl ) applyClusterOverrides (rawObj * unstructured.Unstructured , cluster * clusterv1alpha1.Cluster ) (* AppliedOverrides , error ) {
127
128
// get all cluster-scoped override policies
128
129
policyList := & policyv1alpha1.ClusterOverridePolicyList {}
129
- if err := o .Client .List (context .TODO (), policyList , & client.ListOptions {}); err != nil {
130
+ if err := o .Client .List (context .TODO (), policyList , & client.ListOptions {UnsafeDisableDeepCopy : ptr . To ( true ) }); err != nil {
130
131
klog .Errorf ("Failed to list cluster override policies, error: %v" , err )
131
132
return nil , err
132
133
}
@@ -164,7 +165,7 @@ func (o *overrideManagerImpl) applyClusterOverrides(rawObj *unstructured.Unstruc
164
165
func (o * overrideManagerImpl ) applyNamespacedOverrides (rawObj * unstructured.Unstructured , cluster * clusterv1alpha1.Cluster ) (* AppliedOverrides , error ) {
165
166
// get all namespace-scoped override policies
166
167
policyList := & policyv1alpha1.OverridePolicyList {}
167
- if err := o .Client .List (context .TODO (), policyList , & client.ListOptions {Namespace : rawObj .GetNamespace ()}); err != nil {
168
+ if err := o .Client .List (context .TODO (), policyList , & client.ListOptions {Namespace : rawObj .GetNamespace (), UnsafeDisableDeepCopy : ptr . To ( true ) }); err != nil {
168
169
klog .Errorf ("Failed to list override policies from namespace: %s, error: %v" , rawObj .GetNamespace (), err )
169
170
return nil , err
170
171
}
0 commit comments