Skip to content

Commit

Permalink
upgrade to latest dependencies (#852)
Browse files Browse the repository at this point in the history
bumping knative.dev/pkg 1ca1f09...5fe2303:
  > 5fe2303 drop vendor licenses (# 3001)
  > f69f148 Optionally generate an init func for an informer (# 2989)
  > b8b7ca1 upgrade to latest dependencies (# 3000)

Signed-off-by: Knative Automation <[email protected]>
  • Loading branch information
knative-automation authored Mar 29, 2024
1 parent 7bc8b27 commit 84717c0
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
k8s.io/code-generator v0.29.2
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00
knative.dev/hack v0.0.0-20240327150553-47368d631660
knative.dev/pkg v0.0.0-20240327140624-1ca1f09c329e
knative.dev/pkg v0.0.0-20240328165227-5fe230325f5a
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -674,8 +674,8 @@ 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/pkg v0.0.0-20240327140624-1ca1f09c329e h1:Cg28hbL35g5Qd3tC0PKSX2FMMD8IZnTYxRr4VLIUgd8=
knative.dev/pkg v0.0.0-20240327140624-1ca1f09c329e/go.mod h1:uYSh5G3A/pFmzgowpvKeyphLbXVkY4x7zEhReKwsVeU=
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=
Expand Down
3 changes: 3 additions & 0 deletions vendor/knative.dev/pkg/codegen/cmd/injection-gen/args/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type CustomArgs struct {
ListersPackage string
ForceKinds string
ListerHasPointerElem bool
DisableInformerInit bool
}

// NewDefaults returns default arguments for the generator.
Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type injectionGenerator struct {
imports namer.ImportTracker
typedInformerPackage string
groupInformerFactoryPackage string
disableInformerInit bool
}

var _ generator.Generator = (*injectionGenerator)(nil)
Expand Down Expand Up @@ -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)
Expand All @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ func versionInformerPackages(basePackage string, groupPkgName string, gv clientg
imports: generator.NewImportTracker(),
typedInformerPackage: typedInformerPackage,
groupInformerFactoryPackage: factoryPackagePath,
disableInformerInit: customArgs.DisableInformerInit,
})
return generators
},
Expand Down
2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ k8s.io/utils/trace
# knative.dev/hack v0.0.0-20240327150553-47368d631660
## explicit; go 1.18
knative.dev/hack
# 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
Expand Down

0 comments on commit 84717c0

Please sign in to comment.