* 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>
* 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>
* 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>
* 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>
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>
* 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
* 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
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.
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.
* 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>
* Split KResource into a file. Include an interface.
* Update apis/duck/v1/kresource_type.go
Co-authored-by: Matt Moore <mattmoor@vmware.com>
* type
* rename to KRShaped
Co-authored-by: Matt Moore <mattmoor@vmware.com>
* Some fixes we did in server upstream to pkg
- reduce formatting calls where they are not necessary
- remove casts where they are not necessary
- switch to consts where possible.
* nit
* 1more