Skip to content

Commit 4efefc6

Browse files
fabian4zirain
authored andcommitted
Performanceuse UnsafeDisableDeepCopy and cache for list Unstructured Resources
Signed-off-by: fabian4 <[email protected]>
1 parent acd4675 commit 4efefc6

File tree

1 file changed

+0
-16
lines changed

1 file changed

+0
-16
lines changed

internal/provider/kubernetes/kubernetes.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ import (
1313
appsv1 "k8s.io/api/apps/v1"
1414
corev1 "k8s.io/api/core/v1"
1515
discoveryv1 "k8s.io/api/discovery/v1"
16-
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
1716
"k8s.io/apimachinery/pkg/labels"
18-
"k8s.io/apimachinery/pkg/runtime/schema"
1917
"k8s.io/client-go/rest"
2018
"k8s.io/klog/v2"
2119
"k8s.io/utils/ptr"
@@ -66,12 +64,6 @@ var (
6664
webhookTLSCertDir = "/certs"
6765
// webhookTLSPort is the port for the webhook server to listen on.
6866
webhookTLSPort = 9443
69-
// Supported Gateway API GVKs
70-
// controller-runtime cache requires concrete GVKs.
71-
// Unstructured caching is enabled per GVK using unstructured.Unstructured
72-
gatewayAPIGVKs = []schema.GroupVersionKind{
73-
{Group: "gateway.networking.k8s.io", Version: "v1beta1", Kind: "Gateway"},
74-
}
7567
)
7668

7769
func New(ctx context.Context, restCfg *rest.Config, svrCfg *ec.Server,
@@ -174,14 +166,6 @@ func newProvider(ctx context.Context, restCfg *rest.Config, svrCfg *ec.Server,
174166
},
175167
}
176168
}
177-
178-
for _, gvk := range gatewayAPIGVKs {
179-
u := &unstructured.Unstructured{}
180-
u.SetGroupVersionKind(gvk)
181-
mgrOpts.Cache.ByObject[u] = cache.ByObject{
182-
UnsafeDisableDeepCopy: ptr.To(true),
183-
}
184-
}
185169
// ProxyTopologyInjector is the only component that interacts with Pods.
186170
mgrOpts.Cache.ByObject[&corev1.Pod{}] = cache.ByObject{
187171
Label: labels.SelectorFromSet(proxy.EnvoyAppLabel()),

0 commit comments

Comments
 (0)