diff --git a/go.mod b/go.mod index 1d0550c065..f6b71683f0 100644 --- a/go.mod +++ b/go.mod @@ -13,8 +13,8 @@ require ( k8s.io/apimachinery v0.29.2 k8s.io/client-go v0.29.2 knative.dev/hack v0.0.0-20240327150553-47368d631660 - knative.dev/networking v0.0.0-20240327140628-ae039896b125 - knative.dev/pkg v0.0.0-20240327140624-1ca1f09c329e + knative.dev/networking v0.0.0-20240328164909-e7cfc5b7276f + knative.dev/pkg v0.0.0-20240328165227-5fe230325f5a sigs.k8s.io/yaml v1.4.0 ) diff --git a/go.sum b/go.sum index 90b5702df9..0b63025e81 100644 --- a/go.sum +++ b/go.sum @@ -696,10 +696,10 @@ k8s.io/utils v0.0.0-20240102154912-e7106e64919e h1:eQ/4ljkx21sObifjzXwlPKpdGLrCf k8s.io/utils v0.0.0-20240102154912-e7106e64919e/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= knative.dev/hack v0.0.0-20240327150553-47368d631660 h1:tW6NgyjMnSXBS75+k+Xh5uNiLhJ9TFswS9hrkC3OQOc= knative.dev/hack v0.0.0-20240327150553-47368d631660/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q= -knative.dev/networking v0.0.0-20240327140628-ae039896b125 h1:w9XY50H8EmPj0C3QGeScCcCqt8Y3vjPEujf/LeH7RLY= -knative.dev/networking v0.0.0-20240327140628-ae039896b125/go.mod h1:YlLpTHRi0i/5XVD3QoqEfFhSmAfRj9sZR2NQEOF9dVc= -knative.dev/pkg v0.0.0-20240327140624-1ca1f09c329e h1:Cg28hbL35g5Qd3tC0PKSX2FMMD8IZnTYxRr4VLIUgd8= -knative.dev/pkg v0.0.0-20240327140624-1ca1f09c329e/go.mod h1:uYSh5G3A/pFmzgowpvKeyphLbXVkY4x7zEhReKwsVeU= +knative.dev/networking v0.0.0-20240328164909-e7cfc5b7276f h1:zUKDqyqgooQdd+g9JWXtbQBXdYfHnqbyMoIaTmQ43eQ= +knative.dev/networking v0.0.0-20240328164909-e7cfc5b7276f/go.mod h1:uCy8+UXsCtZyb9fmQWrZm7byeZtyGj1fpHxHVKn+prg= +knative.dev/pkg v0.0.0-20240328165227-5fe230325f5a h1:HYKynG9QjRuVxrXEYnSMWBXboyOqHBgoQZt0xe4+RMA= +knative.dev/pkg v0.0.0-20240328165227-5fe230325f5a/go.mod h1:LgcT4KPEcw24alWzzkFAN2acHq38au8NZqybU16TStI= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/args/args.go b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/args/args.go index 7cd8122d52..265b4e40ae 100644 --- a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/args/args.go +++ b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/args/args.go @@ -30,6 +30,7 @@ type CustomArgs struct { ListersPackage string ForceKinds string ListerHasPointerElem bool + DisableInformerInit bool } // NewDefaults returns default arguments for the generator. @@ -49,6 +50,8 @@ func (ca *CustomArgs) AddFlags(fs *pflag.FlagSet) { fs.BoolVar(&ca.ListerHasPointerElem, "lister-has-pointer-elem", false, "") fs.MarkDeprecated("lister-has-pointer-elem", "this flag has no effect") + + fs.BoolVar(&ca.DisableInformerInit, "disable-informer-init", false, "disable generating the init function for the informer") } // Validate checks the given arguments. diff --git a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/informer.go b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/informer.go index c4fb215f1d..c0b3bf3eaf 100644 --- a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/informer.go +++ b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/informer.go @@ -37,6 +37,7 @@ type injectionGenerator struct { imports namer.ImportTracker typedInformerPackage string groupInformerFactoryPackage string + disableInformerInit bool } var _ generator.Generator = (*injectionGenerator)(nil) @@ -98,6 +99,7 @@ func (g *injectionGenerator) GenerateType(c *generator.Context, t *types.Type, w Package: "context", Name: "WithValue", }), + "disableInformerInit": g.disableInformerInit, } sw.Do(injectionInformer, m) @@ -106,14 +108,16 @@ func (g *injectionGenerator) GenerateType(c *generator.Context, t *types.Type, w } var injectionInformer = ` +{{ if not .disableInformerInit }} func init() { {{.injectionRegisterInformer|raw}}(withInformer) } +{{ end }} // Key is used for associating the Informer inside the context.Context. type Key struct{} -func withInformer(ctx {{.contextContext|raw}}) ({{.contextContext|raw}}, {{.controllerInformer|raw}}) { +{{ if .disableInformerInit }} func WithInformer {{ else }} func withInformer {{ end }} (ctx {{.contextContext|raw}}) ({{.contextContext|raw}}, {{.controllerInformer|raw}}) { f := {{.factoryGet|raw}}(ctx) inf := f.{{.groupGoName}}().{{.versionGoName}}().{{.type|publicPlural}}() return {{ .contextWithValue|raw }}(ctx, Key{}, inf), inf.Informer() diff --git a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/packages.go b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/packages.go index 43768927a5..f0ca43f2bf 100644 --- a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/packages.go +++ b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/packages.go @@ -412,6 +412,7 @@ func versionInformerPackages(basePackage string, groupPkgName string, gv clientg imports: generator.NewImportTracker(), typedInformerPackage: typedInformerPackage, groupInformerFactoryPackage: factoryPackagePath, + disableInformerInit: customArgs.DisableInformerInit, }) return generators }, diff --git a/vendor/modules.txt b/vendor/modules.txt index 065c4ca051..50783bb422 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -918,7 +918,7 @@ k8s.io/utils/trace # knative.dev/hack v0.0.0-20240327150553-47368d631660 ## explicit; go 1.18 knative.dev/hack -# knative.dev/networking v0.0.0-20240327140628-ae039896b125 +# knative.dev/networking v0.0.0-20240328164909-e7cfc5b7276f ## explicit; go 1.21 knative.dev/networking/config knative.dev/networking/pkg @@ -969,7 +969,7 @@ knative.dev/networking/test/test_images/runtime/handlers knative.dev/networking/test/test_images/timeout knative.dev/networking/test/test_images/wsserver knative.dev/networking/test/types -# knative.dev/pkg v0.0.0-20240327140624-1ca1f09c329e +# knative.dev/pkg v0.0.0-20240328165227-5fe230325f5a ## explicit; go 1.21 knative.dev/pkg/apis knative.dev/pkg/apis/duck