Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
1802578
adding messaging.channel resource
nachocano Jul 22, 2019
755ac4a
channel messaging
nachocano Jul 22, 2019
b1f91d8
using ChannelTemplateSpec
nachocano Jul 22, 2019
7d34bcf
updating channel controller
nachocano Jul 22, 2019
71187ba
channel validation
nachocano Jul 22, 2019
109e8c6
setting to channelTemplate
nachocano Jul 23, 2019
2b54e41
to json
nachocano Jul 23, 2019
eac06fe
channel defaulter
nachocano Jul 23, 2019
a7b0c63
working
nachocano Jul 23, 2019
b419077
removing logs
nachocano Jul 23, 2019
f5d4997
Merge remote-tracking branch 'upstream/master' into default-channel
nachocano Jul 23, 2019
4727ae3
patching subscriptions... infinite loop
nachocano Jul 23, 2019
d1723c1
updates
nachocano Jul 23, 2019
970ada4
immutable
nachocano Jul 23, 2019
870a146
problems with cyclic dependencies
nachocano Jul 23, 2019
5e5b8bd
moving channel defaulter to duck to avoid cyclic dependency
nachocano Jul 23, 2019
d0ebf80
channel defaulter test
nachocano Jul 23, 2019
5cdb7e1
updating UTs
nachocano Jul 23, 2019
9043e37
channel validation test
nachocano Jul 23, 2019
db7127b
updating validation
nachocano Jul 23, 2019
eee7e1d
updating lifecycle
nachocano Jul 23, 2019
e1925ac
updates to broker
nachocano Jul 23, 2019
c0e7af4
fixing sequence
nachocano Jul 23, 2019
4916884
broker types
nachocano Jul 24, 2019
ef016c5
updating deprecated message
nachocano Jul 24, 2019
dadac47
updating broker validation
nachocano Jul 24, 2019
961b0f1
cosmetic
nachocano Jul 24, 2019
d30d7ba
injection magic
nachocano Jul 24, 2019
4761836
update to broker test
nachocano Jul 24, 2019
42de64b
updating UTs
nachocano Jul 24, 2019
2734cb2
more UTs
nachocano Jul 24, 2019
b44c8dd
eventingchannel package
nachocano Jul 24, 2019
7c57d38
cosmetic
nachocano Jul 24, 2019
376a5b5
cosmetics
nachocano Jul 24, 2019
c018c2d
compilation, my bad...
nachocano Jul 24, 2019
025462e
hopefully the last one
nachocano Jul 24, 2019
678e589
Ville's comments
nachocano Jul 25, 2019
356ca7c
Adam's comments, plus cosmetic tests to try to make coverage pass.
nachocano Jul 25, 2019
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
1 change: 1 addition & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions cmd/controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (

"github.com/knative/eventing/pkg/reconciler/broker"
"github.com/knative/eventing/pkg/reconciler/channel"
"github.com/knative/eventing/pkg/reconciler/eventingchannel"
"github.com/knative/eventing/pkg/reconciler/eventtype"
"github.com/knative/eventing/pkg/reconciler/namespace"
"github.com/knative/eventing/pkg/reconciler/sequence"
Expand All @@ -35,6 +36,7 @@ func main() {
sharedmain.Main("controller",
subscription.NewController,
namespace.NewController,
eventingchannel.NewController,
channel.NewController,
trigger.NewController,
broker.NewController,
Expand Down
9 changes: 9 additions & 0 deletions cmd/webhook/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ import (
"log"

"github.com/knative/eventing/pkg/channeldefaulter"
"github.com/knative/eventing/pkg/defaultchannel"

"go.uber.org/zap"

eventingduckv1alpha1 "github.com/knative/eventing/pkg/apis/duck/v1alpha1"
eventingv1alpha1 "github.com/knative/eventing/pkg/apis/eventing/v1alpha1"
messagingv1alpha1 "github.com/knative/eventing/pkg/apis/messaging/v1alpha1"
"github.com/knative/eventing/pkg/logconfig"
Expand Down Expand Up @@ -78,6 +80,12 @@ func main() {
eventingv1alpha1.ChannelDefaulterSingleton = channelDefaulter
configMapWatcher.Watch(channeldefaulter.ConfigMapName, channelDefaulter.UpdateConfigMap)

// Watch the default-ch-webhook ConfigMap and dynamically update the default
// Channel CRD.
chDefaulter := defaultchannel.New(logger.Desugar())
eventingduckv1alpha1.ChannelDefaulterSingleton = chDefaulter
configMapWatcher.Watch(defaultchannel.ConfigMapName, chDefaulter.UpdateConfigMap)

if err = configMapWatcher.Start(stopCh); err != nil {
logger.Fatalf("failed to start webhook configmap watcher: %v", err)
}
Expand All @@ -104,6 +112,7 @@ func main() {
// For group messaging.knative.dev.
messagingv1alpha1.SchemeGroupVersion.WithKind("InMemoryChannel"): &messagingv1alpha1.InMemoryChannel{},
messagingv1alpha1.SchemeGroupVersion.WithKind("Sequence"): &messagingv1alpha1.Sequence{},
messagingv1alpha1.SchemeGroupVersion.WithKind("Channel"): &messagingv1alpha1.Channel{},
},
Logger: logger,
}
Expand Down
2 changes: 2 additions & 0 deletions config/200-controller-clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ rules:
resources:
- "sequences"
- "sequences/status"
- "channels"
- "channels/status"
verbs: *everything

# Messaging resources and finalizers we care about.
Expand Down
116 changes: 116 additions & 0 deletions config/300-channel-eventing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# Copyright 2019 The Knative Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# TODO This is the provisioner-based Channel object, which is being deprecated in 0.8 and removed in 0.9.
# See https://github.com/knative/eventing/issues/1561

apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: channels.eventing.knative.dev
labels:
eventing.knative.dev/release: devel
knative.dev/crd-install: "true"
spec:
Comment thread
nachocano marked this conversation as resolved.
group: eventing.knative.dev
versions:
- name: v1alpha1
served: true
storage: true
names:
kind: Channel
plural: channels
singular: channel
categories:
- all
- knative
- eventing
shortNames:
- chan
scope: Namespaced
subresources:
status: {}
additionalPrinterColumns:
- name: Ready
type: string
JSONPath: ".status.conditions[?(@.type==\"Ready\")].status"
- name: Reason
type: string
JSONPath: ".status.conditions[?(@.type==\"Ready\")].reason"
- name: Age
type: date
JSONPath: .metadata.creationTimestamp
validation:
openAPIV3Schema:
properties:
spec:
properties:
provisioner:
type: object
required:
- apiVersion
- kind
- name
properties:
apiVersion:
type: string
minLength: 1
kind:
type: string
minLength: 1
name:
type: string
minLength: 1
arguments:
type: object
subscribable:
type: object
properties:
subscribers:
type: array
items:
required:
- uid
properties:
ref:
type: object
required:
- namespace
- name
- uid
properties:
apiVersion:
type: string
kind:
type: string
name:
type: string
minLength: 1
namespace:
type: string
minLength: 1
uid:
type: string
minLength: 1
generation:
type: integer
uid:
type: string
minLength: 1
subscriberURI:
type: string
minLength: 1
replyURI:
type: string
minLength: 1
44 changes: 22 additions & 22 deletions config/300-channel.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2018 The Knative Authors
# Copyright 2019 The Knative Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -11,29 +11,32 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: channels.eventing.knative.dev
name: channels.messaging.knative.dev
labels:
eventing.knative.dev/release: devel
knative.dev/crd-install: "true"
messaging.knative.dev/subscribable: "true"
spec:
group: eventing.knative.dev
group: messaging.knative.dev
versions:
- name: v1alpha1
served: true
storage: true
- name: v1alpha1
served: true
storage: true
names:
kind: Channel
plural: channels
singular: channel
categories:
- all
- knative
- eventing
- all
- knative
- messaging
- channel
shortNames:
- chan
- ch
scope: Namespaced
subresources:
status: {}
Expand All @@ -44,6 +47,9 @@ spec:
- name: Reason
type: string
JSONPath: ".status.conditions[?(@.type==\"Ready\")].reason"
- name: URL
type: string
JSONPath: .status.address.url
- name: Age
type: date
JSONPath: .metadata.creationTimestamp
Expand All @@ -52,24 +58,20 @@ spec:
properties:
spec:
properties:
provisioner:
channelTemplate:
type: object
required:
- apiVersion
- kind
- name
properties:
apiVersion:
type: string
minLength: 1
kind:
type: string
minLength: 1
name:
type: string
minLength: 1
arguments:
type: object
spec:
type: object
required:
- apiVersion
- kind
subscribable:
type: object
properties:
Expand Down Expand Up @@ -99,8 +101,6 @@ spec:
uid:
type: string
minLength: 1
generation:
type: integer
uid:
type: string
minLength: 1
Expand Down
29 changes: 29 additions & 0 deletions config/400-default-ch-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2018 The Knative Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: v1
kind: ConfigMap
metadata:
name: default-ch-webhook
namespace: knative-eventing
data:
Comment thread
nachocano marked this conversation as resolved.
# Configuration for defaulting channels that do not specify CRD implementations.
default-ch-config: |
clusterDefault:
apiVersion: messaging.knative.dev/v1alpha1
kind: InMemoryChannel
Comment thread
nachocano marked this conversation as resolved.
namespaceDefaults:
some-namespace:
apiVersion: messaging.knative.dev/v1alpha1
kind: InMemoryChannel
2 changes: 1 addition & 1 deletion contrib/gcppubsub/pkg/controller/channel/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const (
subscriptionSyncFailed = "SubscriptionSyncFailed"
subscriptionDeleteFailed = "SubscriptionDeleteFailed"

deprecatedMessage = "The `gcp-pubsub` ClusterChannelProvisioner is deprecated and will be removed in 0.8. Recommended replacement is using `Channel` CRD from https://github.com/GoogleCloudPlatform/cloud-run-events."
deprecatedMessage = "The `gcp-pubsub` ClusterChannelProvisioner is deprecated and will be removed in 0.9. Recommended replacement is using `Channel` CRD from https://github.com/GoogleCloudPlatform/cloud-run-events."
)

// reconciler reconciles GCP-PubSub Channels by creating the K8s Service (ExternalName)
Expand Down
2 changes: 1 addition & 1 deletion contrib/kafka/pkg/controller/channel/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const (
dispatcherReconcileFailed = "DispatcherReconcileFailed"
dispatcherUpdateStatusFailed = "DispatcherUpdateStatusFailed"

deprecatedMessage = "The `kafka` ClusterChannelProvisioner is deprecated and will be removed in 0.8. Recommended replacement is using `KafkaChannel` CRD."
deprecatedMessage = "The `kafka` ClusterChannelProvisioner is deprecated and will be removed in 0.9. Recommended replacement is using `KafkaChannel` CRD."
)

type channelArgs struct {
Expand Down
2 changes: 1 addition & 1 deletion contrib/natss/pkg/controller/channel/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (
)

const (
deprecatedMessage = "The `natss` ClusterChannelProvisioner is deprecated and will be removed in 0.8. Recommended replacement is using `NatssChannel` CRD."
deprecatedMessage = "The `natss` ClusterChannelProvisioner is deprecated and will be removed in 0.9. Recommended replacement is using `NatssChannel` CRD."
)

type reconciler struct {
Expand Down
37 changes: 37 additions & 0 deletions pkg/apis/duck/v1alpha1/channel_defaulter.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
Copyright 2019 The Knative Authors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1

// TODO This should be placed in channel_defaults.go within messaging once Subscription is moved to messaging.
Comment thread
nachocano marked this conversation as resolved.
// Context: there is a cyclic dependency between eventing and messaging if we place this in messaging. Broker needs to
// depend on this, which is fine. But the problem arises due to messaging depending on eventing, mainly on
// Subscription-related objects for the Sequence type. We should first move Subscription down to messaging and then we
// can move this down. See https://github.com/knative/eventing/issues/1562.
//

// ChannelDefaulter sets the default Channel CRD and Arguments on Channels that do not
// specify any implementation.
type ChannelDefaulter interface {
// GetDefault determines the default Channel CRD for the given namespace.
GetDefault(namespace string) *ChannelTemplateSpec
}

var (
// ChannelDefaulterSingleton is the global singleton used to default Channels that do not
// specify a Channel CRD.
ChannelDefaulterSingleton ChannelDefaulter
)
Loading