File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -30,9 +30,13 @@ import (
3030 . "github.com/onsi/ginkgo/v2"
3131 . "github.com/onsi/gomega"
3232
33+ corev1 "k8s.io/api/core/v1"
34+ "k8s.io/apimachinery/pkg/api/meta"
35+ "k8s.io/apimachinery/pkg/fields"
3336 "k8s.io/client-go/kubernetes/scheme"
3437 "k8s.io/client-go/rest"
3538 ctrl "sigs.k8s.io/controller-runtime"
39+ "sigs.k8s.io/controller-runtime/pkg/cache"
3640 "sigs.k8s.io/controller-runtime/pkg/client"
3741 "sigs.k8s.io/controller-runtime/pkg/envtest"
3842 logf "sigs.k8s.io/controller-runtime/pkg/log"
@@ -91,6 +95,21 @@ var _ = BeforeSuite(func() {
9195
9296 k8sManager , err := ctrl .NewManager (cfg , ctrl.Options {
9397 Scheme : scheme .Scheme ,
98+ Cache : cache.Options {
99+ ByObject : map [client.Object ]cache.ByObject {
100+ & corev1.Pod {}: {
101+ Field : fields .OneTermEqualSelector ("status.phase" , string (corev1 .PodPending )),
102+ Transform : func (obj any ) (any , error ) {
103+ if accessor , err := meta .Accessor (obj ); err == nil {
104+ if accessor .GetManagedFields () != nil {
105+ accessor .SetManagedFields (nil )
106+ }
107+ }
108+ return obj , nil
109+ },
110+ },
111+ },
112+ },
94113 })
95114 Expect (err ).NotTo (HaveOccurred ())
96115
You can’t perform that action at this time.
0 commit comments