Commit Graph

290 Commits

Author SHA1 Message Date
Dave Protasowski 4e27b2e680
bump min k8s version to 1.32 (#3184)
* bump version strings

* bump go.mod

* run ./hack/update-deps.sh

* run ./hack/update-codegen.sh

* fix build

* fix fuzzing lib change

* switch fuzzers to use randfill

* run ./hack/update-deps.sh

* gofumpt file

* fix webhook build on go1.24

* ignore endpoint deprecation

* disable a staticcheck that isn't really that bad

* fix nolint directives

* don't use deprecated List and WatchFuncs

* fix deprecation of gengo.ExtractCommentTags

* apply demorgan's law where it makes sense
2025-06-10 21:07:45 +00:00
dependabot[bot] a8e20d9db3
Bump gomodules.xyz/jsonpatch/v2 from 2.4.0 to 2.5.0 (#3154)
* Bump gomodules.xyz/jsonpatch/v2 from 2.4.0 to 2.5.0

Bumps [gomodules.xyz/jsonpatch/v2](https://github.com/gomodules/jsonpatch) from 2.4.0 to 2.5.0.
- [Release notes](https://github.com/gomodules/jsonpatch/releases)
- [Changelog](https://github.com/gomodules/jsonpatch/blob/release-2.0/CHANGELOG.md)
- [Commits](https://github.com/gomodules/jsonpatch/compare/v2.4.0...v2.5.0)

---
updated-dependencies:
- dependency-name: gomodules.xyz/jsonpatch/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Run ./hack/update-codegen.sh

* fix patch unit test

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Dave Protasowski <dprotaso@gmail.com>
2025-04-11 13:38:14 +00:00
Dave Protasowski a37a847cd3
drop use of code-generator/generate-groups.sh (#3136)
* drop use of code-generator/generate-groups.sh

* fix script

* single injection invocation
2025-01-17 17:58:04 +00:00
Dave Protasowski accfe36491
Satisfy linter (#3132)
* drop deprecated linter

* fix uint64=>int64 overflow

* fix unnecessary fmt.Sprintf

* ignore false positive fatcontext

* fix integer overflows

* update golangci-lint config - properly was moved

* fix formatting calls

* use new integer range syntax

* adjust nolint comments

* stop using deprecated k8s types
2025-01-10 15:06:18 +00:00
Dave Protasowski ee1db869c7
Update linter config and address lint warnings/failures (#3068)
* fix whitespace linter

* fix usestdlibvars

* fix staticheck

* ignore spancheck warning

* fix linter perfsprint

* fix nolintlint feedback

* fix nilerr lint checks

* fix misspell

* fix mirror lint

* fix intrange linter

* fix gofumpt linter

* fix gosec linter - ignore warning since default min tls version is 1.3

* fix gocritic linter

* fix whitespace

* fix fatcontext linter

* fix errorlint

* fix errname linter

* fix copyloopvar (go1.22) linter

* fix bodyclose linter

* update linter config

* add script to format code

* fix unit test
2024-06-25 14:49:36 +00:00
Christoph Stäbler 26bc7b4037
Register AuthenticatableType in schema (#3069) 2024-06-25 13:47:26 +00:00
Dave Protasowski 8535fcc248
gofumpt the repo (#3067)
* gofumpt the repo

* don't prefix numbers with 0 - otherwise they're octal
2024-06-25 07:27:07 +00:00
Christoph Stäbler 339c22b821
Add AuthenticatableType duck type (#3056)
* Add AuthenticatableType

* Add Resolver for AuthenticatableType

* Run gofmt and goimports

* Fix linter issues
2024-06-14 13:52:39 +00:00
Christoph Stäbler 360b72e494
Update AuthStatus to have list of ServiceAccountNames (#3032) 2024-05-07 09:21:24 +00:00
Christoph Stäbler 0736c742cf
Add SinkAudience to SourceStatus (#2844) 2023-10-02 13:16:21 +00:00
Karthik Muraliprasad 76b4202e06
Add AuthStatus type (#2829)
* Add AuthStatus type

This commit adds a new AuthStatus type which currently contains the ServiceAccountName attribute, which is used for OIDC authentication

Signed-off-by: karthikmurali60 <karthik.murali60@gmail.com>

* Update generated code

Signed-off-by: karthikmurali60 <karthik.murali60@gmail.com>

---------

Signed-off-by: karthikmurali60 <karthik.murali60@gmail.com>
2023-09-22 12:05:12 +00:00
Abhijeet Gaurav 27252a376b
Added Audience field in duckv1.Destination (#2797)
* Added Audience field in duckv1.Destination

* generated  the DeepCopy functions to include the new field

Signed-off-by: Abhijeet Gaurav <abhijeetdav24aug@gmail.com>

* removed trailing whitespaces from both lines

Signed-off-by: Abhijeet Gaurav <abhijeetdav24aug@gmail.com>

---------

Signed-off-by: Abhijeet Gaurav <abhijeetdav24aug@gmail.com>
2023-09-05 14:44:17 +00:00
Abhijeet Gaurav 66bf5af149
Added Audience field in duckv1.Addressable (#2798)
* Added Audience field in duckv1.Addressable

* generated  the DeepCopy functions to include the new field

Signed-off-by: Abhijeet Gaurav <abhijeetdav24aug@gmail.com>

* removing one empty line

Co-authored-by: Christoph Stäbler <cstabler@redhat.com>

---------

Signed-off-by: Abhijeet Gaurav <abhijeetdav24aug@gmail.com>
Co-authored-by: Christoph Stäbler <cstabler@redhat.com>
2023-09-05 14:36:17 +00:00
Kenjiro Nakayama 4f651e0928
Bump gomodules.xyz/jsonpatch/v2 from 2.2.0 to 2.3.0 (#2789)
* Bump gomodules.xyz/jsonpatch/v2 from 2.2.0 to 2.3.0

Bumps [gomodules.xyz/jsonpatch/v2](https://github.com/gomodules/jsonpatch) from 2.2.0 to 2.3.0.
- [Release notes](https://github.com/gomodules/jsonpatch/releases)
- [Changelog](https://github.com/gomodules/jsonpatch/blob/release-2.0/CHANGELOG.md)
- [Commits](https://github.com/gomodules/jsonpatch/compare/v2.2.0...v2.3.0)

---
updated-dependencies:
- dependency-name: gomodules.xyz/jsonpatch/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Run ./hack/update-codegen.sh

* Fix test case

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-08-15 13:28:40 +00:00
Kenjiro Nakayama c11003ae6d
Use go sync/atomic instead of go.uber.org/atomic (#2777)
* wip

* tiny fix

* Fix controller/controller_test.go

* fix metrics.go

* Fix profiling/server.go

* Fix reconciler/testing

* update ./test/spoof/spoof_test.go

* Fix ./test/zipkin/util.go

* update go.uber.org/atomic
2023-08-02 16:26:48 +00:00
Pierangelo Di Pilato 74c4be5e93
Generate kresource duck type codegen (#2754)
Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>
2023-06-12 15:54:45 +00:00
pradnyavmw 05bfcf66c2
bump k8s dependencies and update min version to v1.25 (#2745)
* Update defaultMinimumVersion

* Fix issues that occurred after running update-k8s-deps

* Adding changes to vendor and other folders

* Add new files after running update-codegen

* Add newLine
2023-05-23 14:06:11 +00:00
Vishal Choudhary a170a07b34
Eventing TLS: validate that Destination.CACerts is a PEM encoded cert (#2743)
* added check to cacerts

Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com>

* added test

Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com>

* added csr test

Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com>

* OR to AND

Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com>

---------

Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com>
2023-05-18 14:43:13 +00:00
Rahul kumar db8a353302
Add SinkCACerts to SourceStatus (#2733)
* Add SinkCACerts to SourceStatus

* add some changes (hack/update-codegen.sh)

* Update apis/duck/v1/source_types.go

Co-authored-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>

---------

Co-authored-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>
2023-05-02 13:46:55 +00:00
Vishal Choudhary 300df436f9
Eventing TLS: Added AddressableFromDestination method on the resolver (#2717)
* Added AddressableFromDestination method

Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com>

* requested changes

Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com>

* added requested change

Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com>

* added changes from pierDipi

Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com>

* tests

Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com>

* fixes

Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com>

* fixes in tests

Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com>

* added changes

Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com>

* added return

Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com>

* fixing errors

Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com>

* updated tests for ref

Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com>

* added null pointer fix

Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com>

---------

Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com>
2023-04-20 07:15:39 +00:00
Rahul Sawra 4835a4cb0c
Eventing TLS: update destination and Kref types (#2716)
* update destination and Kref types

* Update apis/duck/v1/destination.go

Co-authored-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>

* update Destination in v1beta1

---------

Co-authored-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>
2023-04-04 10:08:38 +00:00
Vishal Choudhary b7f2774461
Made changes to addressable and address status. (#2713)
* changed addressable and addressstatus

Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com>

* requested changes

Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com>

---------

Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com>
2023-04-03 15:12:33 +00:00
Dave Protasowski 8532ae0645
update OWNERS files to use teams with active members (#2672)
* update OWNERS files to use teams with active members

* add eventing-wg leads as approvers to /apis
2023-02-06 16:58:45 +00:00
Christoph Stäbler 408ad0773f
Make SetDefaults of Destination duck type nil safer (#2670)
Signed-off-by: Christoph Stäbler <cstabler@redhat.com>

Signed-off-by: Christoph Stäbler <cstabler@redhat.com>
2023-01-25 08:36:39 +00:00
Dave Protasowski 44d1d7d978
Go1.19 changes (#2631)
* run goimports

* ignore linter errors for now

* fix boilerplate
2022-11-03 22:34:05 +00:00
Nghia Tran 728dfd8e28
Add FieldError#WrappedErrors to allow dependent code to have access (readonly) (#2618)
* Add FieldError#GetErrors to allow downstream reads

* Rename based on PR feedback

* Rename correctly for real

* Also expose `Normalized`

* WrappedErrors = merge(normalized)
2022-10-27 14:30:07 +00:00
Jonathan Innis 20aabd56be
Bump to k8s v0.24.4 client packages (#2586) 2022-09-09 15:07:30 +00:00
Ville Aikas f1f36a2c97
Fix subresource update logic. (#2546)
* Fix subresource update logic.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* Rename IsInSubResourceUpdate => GetUpdatedSubresource

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>
2022-07-15 18:32:28 +00:00
Paul Schweigert 5569169b0c
update boilerplate date (#2539)
Signed-off-by: Paul S. Schweigert <paulschw@us.ibm.com>
2022-06-30 22:25:31 +00:00
Matt Moore 245166458e
Switch to iota/fmt.Stringer-based diagnostic levels. (#2511)
See discussion in: https://github.com/knative/pkg/pull/2498
2022-05-03 22:38:58 +00:00
Matt Moore 16b36b7fca
Add support for admission webhook warnings. (#2498)
* Add support for admission webhook warnings.

This extends `apis.FieldError` to support designating certain FieldErrors as "warnings" (or explicitly as "errors", however, this is the default for back-compat).

You can turn an `apis.FieldError` into a warning using: `fe.At(apis.WarningLevel)` or force it into an error using: `fe.At(apis.ErrorLevel)`.

You can get the errors at a particular diagnostic level using: `fe.Filter(apis.WarningLevel)`.

This change also hooks this into the admission webhook infrastructure to support surfacing the "warning" level `apis.FieldError`s via the `Warnings` section of the `AdmissionResponse`.

Fixes: #2497

* Add a comment about the use of defer.
2022-05-02 21:56:57 +00:00
Chunyi Lyu 5e98acda85
Make URL compatible with controller-gen (#2431)
- add kubebuilder marker so CRDs using URL could be
generated with controller-gen
- same change but on VolatileTime: https://github.com/knative/pkg/pull/2104
2022-02-17 06:50:12 -08:00
Pierangelo Di Pilato 2b23ad111b
Simplify URI creation in source validation tests (#2389)
Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>
2022-01-12 10:19:51 -08:00
Pierangelo Di Pilato bba447088f
Validate Sink in SourceSpec (#2384)
* Validate Sink in SourceSpec

The `Sink` in `SourceSpec` is required.

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>

* Update apis/duck/v1/source_types.go

Co-authored-by: Pablo Mercado <pablo@triggermesh.com>

Co-authored-by: Pablo Mercado <pablo@triggermesh.com>
2022-01-11 08:24:14 -08:00
Pierangelo Di Pilato 552319d4f5
Add nil checks for Source types validation to be pointer receiver based (#2378)
It's better to have nil checks inside the Validate method of the
type itself instead of the type that holds a field of that type
because this allows using the types in other contexts without
the types that hold a field.

Signed-off-by: Pierangelo Di Pilato <pdipilat@redhat.com>
2021-12-14 22:57:29 -08:00
Dave Protasowski a99300deff
kmap (#2354)
* move some functional map operations to it's own package

* include a new accessor helper for migrating key names

* use kmap methods

* add deprecation notices

* fix boilerplate

* Rename Accessor to OrderedLookup
2021-11-19 09:07:23 -08:00
knative-automation e61a20dd64
Update actions (#2313)
Signed-off-by: Knative Automation <automation@knative.team>
2021-10-15 12:26:13 -07:00
Dave Protasowski fa2f8f1955
drop fake dynamic client workaround (#2310)
the upstream changes have merged
2021-10-13 08:28:48 -07:00
Matt Moore 11a3414ec3
Provide the webhook infrastructure with the raw request context. (#2305)
Today, we can use `Path()` of `/foo/` (trailing slash) to support prefix-matched webhooks, but unfortunately the request context is lost when `Admit()` or `Convert()` is called.

This ensures that information flows through associated with context for anyone who would like this metadata for additional processing.
2021-10-05 13:22:44 -07:00
Ville Aikas 221312a6a0
duck cronjob (#2299) 2021-09-27 16:50:13 -07:00
Gabriel Freites 52b0e2938e
Source validation fixes (#2285)
* added error case when ceOverrides is null

* added test for empty source spec ceOverrides validation case

* added test for empty spec
2021-09-15 11:31:08 -07:00
Gabriel Freites d4505c6605
Source validation fixes (#2251)
* added basic structure for source validation

* added validation to the sources.spec.ceOverrides.extensions field

* added multi function validation acording to the spec field thats been validated

* added tests to source types validation

* added full coverage to validation cases

* updated codegen and dependencies

* fixed deepcopy not been generated + added link and explanation for the maxExtensionNameLength in cloud events

* removed extension name length because is a SHOULD not a MUST

* removed extension name length because is a SHOULD not a MUST

* fixed copyright dates on edited files

* fixed error message and header copyright year in pr comments

* fixed unnecesary method ValidateSource

* fixed pr comments

* fixed deprecated method used on apis/duck/ABOUT.md

* updated tests names to match the spec

* fixed error message

* added key keyword to test to description

* fixed extension keys validation error message
2021-09-09 09:52:59 -07:00
Senthilnathan M 9a4b612820
Added invalid value field error with details (#2246)
* Added invalid value field with details

* gofmt

* Addressed review comments
2021-09-08 13:28:58 -07:00
Matt Moore 71508fc69a
Introduce `duckv1.Pod`. (#2280)
This is mostly for symmetry since many folks that validate PodSpecable types often also want to validate `Pod`, so while `Pod` isn't as often a duck-type, the main value of this is exposing similar mechanisms to #2279 for `corev1.Pod` without folks needing to define their own `corev1.Pod` clone.
2021-09-07 19:59:33 -07:00
Matt Moore 26db1ba732
Enable using `duckv1.WithPod` with our webhook infra. (#2279)
Today you can't use `duckv1.WithPod` to author webhooks because it doesn't implement the `Validate` or `SetDefaults` methods, and that makes sense since they are (by definition) a generic encapsulation of a number of types.

However, if we could infuse `ctx` with appropriate callbacks for `Validate` and `SetDefaults` then folks can use our types, but infuse `ctx` with callbacks that perform the appropriate validation.

What I have in mind is something along these lines:

```go
return defaulting.NewAdmissionController(ctx,
	// Name of the resource webhook.
	"foo.bar.dev",

	// The path on which to serve the webhook.
	"/defaulting",

	// The resources to default.
	map[schema.GroupVersionKind]resourcesemantics.GenericCRD{
		appsv1.SchemeGroupVersion.WithKind("Deployment"):  &duckv1.WithPod{},
		appsv1.SchemeGroupVersion.WithKind("ReplicaSet"):  &duckv1.WithPod{},
		appsv1.SchemeGroupVersion.WithKind("StatefulSet"): &duckv1.WithPod{},
		appsv1.SchemeGroupVersion.WithKind("DaemonSet"):   &duckv1.WithPod{},
		batchv1.SchemeGroupVersion.WithKind("Job"):        &duckv1.WithPod{},
	},

	// A function that infuses the context passed to Validate/SetDefaults with custom metadata.
	func(ctx context.Context) context.Context{
		return duckv1.WithPodSpecDefaulter(ctx, myFancyLogic)
	},

	// Whether to disallow unknown fields.
	false,
)
```

It is roughly equivalent for validation.
2021-09-07 16:24:33 -07:00
Julian Friedman 50410e0b83
Use consistent case for "Deprecated" comments (#2216)
* Use consistent case for "Deprecated" comments

Not the most important thing ever, but the canonical string to use for
Deprecated warnings is case sensitive, and also it's nice to be
consistent.

* Add nolint comment
2021-08-17 09:15:16 -07:00
Francesco Guardiani 192b0c9d6e
Add KReference.Group field and ResolveGroup function (#2127)
* Add Group field and ResolveGroup function

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Remove core special case

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Copyright

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Added validation code

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Fix comment

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Add omitempty

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Moved ResolveGroup code to kref
Made ResolveGroup a util method, more than an instance method

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* New type KReferenceResolver

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Added +optional as suggested

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
2021-06-15 02:27:20 -07:00
Dave Protasowski eaa823c765
bump k8s to v1.20.7 (#2145)
* bump k8s deps to v1.20.7

* fix migrator test pkg

* dynamicclient now expects List types to be declare either via a scheme or manually

* fix error message comparison

* drop excess vendor licenses

* Using the injection fake dynamic client will preserve pre-1.20 behaviour

This is accomplished by preprocessing the scheme/fixtures and declaring
a custom scheme were we map our types & lists to unstructured.* types

* revert webhook factory changes

* ensure objects to the dynamic client are unstructured

* seed the default dynamic client with k8s scheme

* include duckv1 types in default fake dynamic client scheme

* use default k8s scheme
looks like eventing adds to this scheme but we should import the correct one vs the one from the  fake package

* drop duckv1 from default scheme

* set APIVersion/Kind if empty

* refactor ToUnstructured helper to a new package
2021-06-10 06:56:43 -07:00
Markus Thömmes 0e61d6763d
Bump assorted dependencies (#2140) 2021-06-02 02:50:30 -07:00
Dave Protasowski 6484377731
update boilerplate date (#2134) 2021-05-28 13:21:29 -07:00