Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions cmd/webhook/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ import (
baseeventingv1alpha1 "knative.dev/eventing/pkg/apis/eventing/v1alpha1"
eventingv1alpha1 "knative.dev/eventing/pkg/apis/eventing/v1alpha1"
baseeventingv1beta1 "knative.dev/eventing/pkg/apis/eventing/v1beta1"
"knative.dev/eventing/pkg/apis/flows"
flowsv1alpha1 "knative.dev/eventing/pkg/apis/flows/v1alpha1"
flowsv1beta1 "knative.dev/eventing/pkg/apis/flows/v1beta1"
legacysourcesv1alpha1 "knative.dev/eventing/pkg/apis/legacysources/v1alpha1"
"knative.dev/eventing/pkg/apis/messaging"
basemessagingv1alpha1 "knative.dev/eventing/pkg/apis/messaging/v1alpha1"
Expand Down Expand Up @@ -208,6 +210,8 @@ func NewConversionController(ctx context.Context, cmw configmap.Watcher) *contro
eventingv1beta1_ = baseeventingv1beta1.SchemeGroupVersion.Version
messagingv1alpha1_ = basemessagingv1alpha1.SchemeGroupVersion.Version
messagingv1beta1_ = basemessagingv1beta1.SchemeGroupVersion.Version
flowsv1alpha1_ = flowsv1alpha1.SchemeGroupVersion.Version
flowsv1beta1_ = flowsv1beta1.SchemeGroupVersion.Version
)

return conversion.NewConversionController(ctx,
Expand Down Expand Up @@ -258,6 +262,23 @@ func NewConversionController(ctx context.Context, cmw configmap.Watcher) *contro
messagingv1beta1_: &basemessagingv1beta1.InMemoryChannel{},
},
},
// flows
flowsv1beta1.Kind("Sequence"): {
DefinitionName: flows.SequenceResource.String(),
HubVersion: flowsv1alpha1_,
Zygotes: map[string]conversion.ConvertibleObject{
flowsv1alpha1_: &flowsv1alpha1.Sequence{},
flowsv1beta1_: &flowsv1beta1.Sequence{},
},
},
flowsv1beta1.Kind("Parallel"): {
DefinitionName: flows.ParallelResource.String(),
HubVersion: flowsv1alpha1_,
Zygotes: map[string]conversion.ConvertibleObject{
flowsv1alpha1_: &flowsv1alpha1.Parallel{},
flowsv1beta1_: &flowsv1beta1.Parallel{},
},
},
},

// A function that infuses the context passed to ConvertUp/ConvertDown/SetDefaults with custom metadata.
Expand Down
164 changes: 17 additions & 147 deletions config/core/resources/parallel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ metadata:
duck.knative.dev/addressable: "true"
spec:
group: flows.knative.dev
preserveUnknownFields: false
validation:
openAPIV3Schema:
type: object
# this is a work around so we don't need to flush out the
# schema for each version at this time
#
# see issue: https://github.com/knative/serving/issues/912
x-kubernetes-preserve-unknown-fields: true
names:
kind: Parallel
plural: parallels
Expand All @@ -33,6 +42,12 @@ spec:
scope: Namespaced
subresources:
status: {}
conversion:
strategy: Webhook
webhookClientConfig:
service:
name: eventing-webhook
namespace: knative-eventing
additionalPrinterColumns:
- name: Ready
type: string
Expand All @@ -50,152 +65,7 @@ spec:
- name: v1alpha1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
properties:
spec:
required:
- branches
- channelTemplate
type: object
properties:
branches:
type: array
description: "the list of filter/subscribers pairs."
items:
type: object
required:
- subscriber
properties:
filter:
type: object
description: "the destination of the filter expression that is guarding the branch."
properties:
ref:
type: object
description: "a reference to a Kubernetes object from which to retrieve the target URI."
required:
- apiVersion
- kind
- name
properties:
apiVersion:
type: string
minLength: 1
kind:
type: string
minLength: 1
name:
type: string
minLength: 1
uri:
type: string
description: "the target URI or, if ref is provided, a relative URI reference that will be combined with ref to produce a target URI."
subscriber:
type: object
description: "the destination of the events if the filter passes."
properties:
ref:
type: object
description: "a reference to a Kubernetes object from which to retrieve the target URI."
required:
- apiVersion
- kind
- name
properties:
apiVersion:
type: string
minLength: 1
kind:
type: string
minLength: 1
name:
type: string
minLength: 1
uri:
type: string
description: "the target URI or, if ref is provided, a relative URI reference that will be combined with ref to produce a target URI."
reply:
description: "a reference to where the result of the subscriber of this branch gets sent to. If not specified, the result is sent to the Parallel reply."
type: object
properties:
ref:
type: object
description: "a reference to a Kubernetes object from which to retrieve the target URI."
required:
- apiVersion
- kind
- name
properties:
apiVersion:
type: string
minLength: 1
kind:
type: string
minLength: 1
name:
type: string
minLength: 1
uri:
type: string
description: "the target URI. If ref is provided, this must be relative URI reference."
apiVersion:
type: string
description: "DEPRECATED: use ref.apiVersion"
kind:
type: string
description: "DEPRECATED: use ref.kind"
name:
type: string
description: "DEPRECATED: use ref.name"
channelTemplate:
type: object
description: "specifies which Channel to use. If left unspecified, it is set to the default Channel for the namespace (or cluster, in case there are no defaults for the namespace)."
required:
- apiVersion
- kind
properties:
apiVersion:
type: string
minLength: 1
kind:
type: string
minLength: 1
spec:
type: object
reply:
type: object
properties:
ref:
type: object
description: "a reference to a Kubernetes object from which to retrieve the target URI."
required:
- apiVersion
- kind
- name
properties:
apiVersion:
type: string
minLength: 1
kind:
type: string
minLength: 1
name:
type: string
minLength: 1
uri:
type: string
description: "the target URI. If ref is provided, this must be relative URI reference."
apiVersion:
type: string
description: "DEPRECATED: use ref.apiVersion"
kind:
type: string
description: "DEPRECATED: use ref.kind"
name:
type: string
description: "DEPRECATED: use ref.name"
- name: v1beta1
served: false
served: true
storage: false

101 changes: 16 additions & 85 deletions config/core/resources/sequence.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ metadata:
duck.knative.dev/addressable: "true"
spec:
group: flows.knative.dev
preserveUnknownFields: false
validation:
openAPIV3Schema:
type: object
# this is a work around so we don't need to flush out the
# schema for each version at this time
#
# see issue: https://github.com/knative/serving/issues/912
x-kubernetes-preserve-unknown-fields: true
names:
kind: Sequence
plural: sequences
Expand All @@ -33,6 +42,12 @@ spec:
scope: Namespaced
subresources:
status: {}
conversion:
strategy: Webhook
webhookClientConfig:
service:
name: eventing-webhook
namespace: knative-eventing
additionalPrinterColumns:
- name: Ready
type: string
Expand All @@ -50,90 +65,6 @@ spec:
- name: v1alpha1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
properties:
spec:
required:
- steps
- channelTemplate
type: object
properties:
steps:
type: array
description: "the list of Destinations (processors / functions) that will be called in the order provided."
items:
type: object
description: "a processor / function in the Sequence."
properties:
ref:
type: object
description: "a reference to a Kubernetes object from which to retrieve the target URI."
required:
- apiVersion
- kind
- name
properties:
apiVersion:
type: string
minLength: 1
kind:
type: string
minLength: 1
name:
type: string
minLength: 1
uri:
type: string
description: "the target URI or, if ref is provided, a relative URI reference that will be combined with ref to produce a target URI."
channelTemplate:
type: object
description: "specifies which Channel to use. If left unspecified, it is set to the default Channel for the namespace (or cluster, in case there are no defaults for the namespace)."
required:
- apiVersion
- kind
properties:
apiVersion:
type: string
minLength: 1
kind:
type: string
minLength: 1
spec:
type: object
reply:
type: object
properties:
ref:
type: object
description: "a reference to a Kubernetes object from which to retrieve the target URI."
required:
- apiVersion
- kind
- name
properties:
apiVersion:
type: string
minLength: 1
kind:
type: string
minLength: 1
name:
type: string
minLength: 1
uri:
type: string
description: "the target URI. If ref is provided, this must be relative URI reference."
apiVersion:
type: string
description: "DEPRECATED: use ref.apiVersion"
kind:
type: string
description: "DEPRECATED: use ref.kind"
name:
type: string
description: "DEPRECATED: use ref.name"
- name: v1beta1
served: false
served: true
storage: false
15 changes: 15 additions & 0 deletions pkg/apis/flows/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@ limitations under the License.

package flows

import "k8s.io/apimachinery/pkg/runtime/schema"

const (
GroupName = "flows.knative.dev"
)

var (
// SequenceResource represents a Knative Sequence
SequenceResource = schema.GroupResource{
Group: GroupName,
Resource: "sequences",
}
// ParallelResource represents a Knative Parallel
ParallelResource = schema.GroupResource{
Group: GroupName,
Resource: "parallels",
}
)
Loading