Skip to content

Commit

Permalink
Update eventtype v1beta3 type to reflect spec changes (#7708)
Browse files Browse the repository at this point in the history
* feat: update eventtype CRD to have new schema

Signed-off-by: Calum Murray <[email protected]>

* feat: update eventtype v1beta3 types to reflect CRD changes

Signed-off-by: Calum Murray <[email protected]>

* fix: unit tests pass with new schema

Signed-off-by: Calum Murray <[email protected]>

* fix: eventtype attributes are an array now

Signed-off-by: Calum Murray <[email protected]>

* fix: lineage tests pass again with new eventtype spec

Signed-off-by: Calum Murray <[email protected]>

* cleanup: tests use attribute names always

Signed-off-by: Calum Murray <[email protected]>

* fix: jsonpath for the type and source attributes is correct

Signed-off-by: Calum Murray <[email protected]>

---------

Signed-off-by: Calum Murray <[email protected]>
  • Loading branch information
Cali0707 authored Mar 27, 2024
1 parent 93e0c85 commit e581d36
Show file tree
Hide file tree
Showing 8 changed files with 541 additions and 262 deletions.
126 changes: 126 additions & 0 deletions config/core/resources/eventtype.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,132 @@ metadata:
spec:
group: eventing.knative.dev
versions:
- name: v1beta3
served: false
storage: false
subresources:
status: {}
schema:
openAPIV3Schema:
type: object
description: 'EventType represents a type of event that can be consumed from a resource.'
properties:
spec:
description: 'Spec defines the desired state of the EventType.'
type: object
properties:
reference:
description: Reference a resource. For example, Broker.
type: object
properties:
apiVersion:
description: API version of the referent.
type: string
kind:
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
type: string
namespace:
description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ This is an optional field, it gets defaulted to the object holding it if left out.'
type: string
description:
description: 'Description is an optional field used to describe the
EventType, in any meaningful way.'
type: string
attributes:
description: "CloudEvent attribute and extension attributes."
type: array
items:
type: object
required:
- name
properties:
name:
type: string
description: "Name of the CloudEvent attribute."
required:
type: boolean
description: "Indicates whether the attribute is required."
value:
type: string
description: "Value of the attribute. May be a template string using curly brackets {} to represent variable sections of the string."
status:
description: 'Status represents the current state of the EventType. This data
may be out of date.'
type: object
properties:
annotations:
description: 'Annotations is additional Status fields for the Resource
to save some additional State as well as convey more information
to the user. This is roughly akin to Annotations on any k8s resource,
just the reconciler conveying richer information outwards.'
type: object
x-kubernetes-preserve-unknown-fields: true
conditions:
description: 'Conditions the latest available observations of a resource''s
current state.'
type: array
items:
type: object
required:
- type
- status
properties:
lastTransitionTime:
description: 'LastTransitionTime is the last time the condition
transitioned from one status to another. We use VolatileTime
in place of metav1.Time to exclude this from creating
equality.Semantic differences (all other things held
constant).'
type: string
message:
description: 'A human readable message indicating details
about the transition.'
type: string
reason:
description: 'The reason for the condition''s last transition.'
type: string
severity:
description: 'Severity with which to treat failures of
this type of condition. When this is not specified,
it defaults to Error.'
type: string
status:
description: 'Status of the condition, one of True, False,
Unknown.'
type: string
type:
description: 'Type of condition.'
type: string
observedGeneration:
description: 'ObservedGeneration is the ''Generation'' of the Service
that was last processed by the controller.'
type: integer
format: int64
additionalPrinterColumns:
- name: Type
type: string
jsonPath: ".spec.attributes[?(@.name='type')].value"
- name: Source
type: string
jsonPath: ".spec.attributes[?(@.name='source')].value"
- name: Reference Name
type: string
jsonPath: ".spec.reference.name"
- name: Reference Kind
type: string
jsonPath: ".spec.reference.kind"
- name: Description
type: string
jsonPath: ".spec.description"
- name: Ready
type: string
jsonPath: ".status.conditions[?(@.type==\"Ready\")].status"
- name: Reason
type: string
jsonPath: ".status.conditions[?(@.type==\"Ready\")].reason"
- name: v1beta2
served: true
storage: true
Expand Down
158 changes: 52 additions & 106 deletions docs/eventing-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -3199,96 +3199,42 @@ EventTypeSpec
<table>
<tr>
<td>
<code>type</code><br/>
<em>
string
</em>
</td>
<td>
<p>Type represents the CloudEvents type. It is authoritative.</p>
</td>
</tr>
<tr>
<td>
<code>source</code><br/>
<em>
<a href="https://pkg.go.dev/knative.dev/pkg/apis#URL">
knative.dev/pkg/apis.URL
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>Source is a URI, it represents the CloudEvents source.</p>
</td>
</tr>
<tr>
<td>
<code>schema</code><br/>
<code>reference</code><br/>
<em>
<a href="https://pkg.go.dev/knative.dev/pkg/apis#URL">
knative.dev/pkg/apis.URL
<a href="https://pkg.go.dev/knative.dev/pkg/apis/duck/v1#KReference">
knative.dev/pkg/apis/duck/v1.KReference
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>Schema is a URI, it represents the CloudEvents schemaurl extension attribute.
It may be a JSON schema, a protobuf schema, etc. It is optional.</p>
</td>
</tr>
<tr>
<td>
<code>schemaData</code><br/>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p>SchemaData allows the CloudEvents schema to be stored directly in the
EventType. Content is dependent on the encoding. Optional attribute.
The contents are not validated or manipulated by the system.</p>
<p>Reference is a KReference to the belonging addressable.
For example, this could be a pointer to a Broker.</p>
</td>
</tr>
<tr>
<td>
<code>broker</code><br/>
<code>description</code><br/>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p>Broker refers to the Broker that can provide the EventType.
Deprecated: This field is deprecated and will be removed in a future release.</p>
<p>Description is an optional field used to describe the EventType, in any meaningful way.</p>
</td>
</tr>
<tr>
<td>
<code>reference</code><br/>
<code>attributes</code><br/>
<em>
<a href="https://pkg.go.dev/knative.dev/pkg/apis/duck/v1#KReference">
knative.dev/pkg/apis/duck/v1.KReference
<a href="#eventing.knative.dev/v1beta3.EventAttributeDefinition">
[]EventAttributeDefinition
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>Reference is a KReference to the belonging addressable.
For example, this could be a pointer to a Broker.</p>
</td>
</tr>
<tr>
<td>
<code>description</code><br/>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p>Description is an optional field used to describe the EventType, in any meaningful way.</p>
<p>Attributes is an array of CloudEvent attributes and extension attributes.</p>
</td>
</tr>
</table>
Expand All @@ -3311,10 +3257,10 @@ This data may be out of date.</p>
</tr>
</tbody>
</table>
<h3 id="eventing.knative.dev/v1beta3.EventTypeSpec">EventTypeSpec
<h3 id="eventing.knative.dev/v1beta3.EventAttributeDefinition">EventAttributeDefinition
</h3>
<p>
(<em>Appears on:</em><a href="#eventing.knative.dev/v1beta3.EventType">EventType</a>)
(<em>Appears on:</em><a href="#eventing.knative.dev/v1beta3.EventTypeSpec">EventTypeSpec</a>)
</p>
<p>
</p>
Expand All @@ -3328,71 +3274,58 @@ This data may be out of date.</p>
<tbody>
<tr>
<td>
<code>type</code><br/>
<code>name</code><br/>
<em>
string
</em>
</td>
<td>
<p>Type represents the CloudEvents type. It is authoritative.</p>
<p>Name is the name of the CloudEvents attribute.</p>
</td>
</tr>
<tr>
<td>
<code>source</code><br/>
<code>required</code><br/>
<em>
<a href="https://pkg.go.dev/knative.dev/pkg/apis#URL">
knative.dev/pkg/apis.URL
</a>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>Source is a URI, it represents the CloudEvents source.</p>
<p>Required determines whether this attribute must be set on corresponding CloudEvents.</p>
</td>
</tr>
<tr>
<td>
<code>schema</code><br/>
<em>
<a href="https://pkg.go.dev/knative.dev/pkg/apis#URL">
knative.dev/pkg/apis.URL
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>Schema is a URI, it represents the CloudEvents schemaurl extension attribute.
It may be a JSON schema, a protobuf schema, etc. It is optional.</p>
</td>
</tr>
<tr>
<td>
<code>schemaData</code><br/>
<code>value</code><br/>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p>SchemaData allows the CloudEvents schema to be stored directly in the
EventType. Content is dependent on the encoding. Optional attribute.
The contents are not validated or manipulated by the system.</p>
<p>Value is a string representing the allowable values for the EventType attribute.
It may be a single value such as &ldquo;/apis/v1/namespaces/default/pingsource/ps&rdquo;, or it could be a template
for the allowed values, such as &ldquo;/apis/v1/namespaces/{namespace}/pingsource/{sourceName}.
To specify a section of the string value which may change between different CloudEvents
you can use curly brackets {} and optionally a variable name between them.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="eventing.knative.dev/v1beta3.EventTypeSpec">EventTypeSpec
</h3>
<p>
(<em>Appears on:</em><a href="#eventing.knative.dev/v1beta3.EventType">EventType</a>)
</p>
<p>
</p>
<table>
<thead>
<tr>
<td>
<code>broker</code><br/>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p>Broker refers to the Broker that can provide the EventType.
Deprecated: This field is deprecated and will be removed in a future release.</p>
</td>
<th>Field</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>reference</code><br/>
Expand Down Expand Up @@ -3420,6 +3353,19 @@ string
<p>Description is an optional field used to describe the EventType, in any meaningful way.</p>
</td>
</tr>
<tr>
<td>
<code>attributes</code><br/>
<em>
<a href="#eventing.knative.dev/v1beta3.EventAttributeDefinition">
[]EventAttributeDefinition
</a>
</em>
</td>
<td>
<p>Attributes is an array of CloudEvent attributes and extension attributes.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="eventing.knative.dev/v1beta3.EventTypeStatus">EventTypeStatus
Expand Down
Loading

0 comments on commit e581d36

Please sign in to comment.