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
1 change: 1 addition & 0 deletions cmd/channel_broker/kodata/HEAD
1 change: 1 addition & 0 deletions cmd/channel_broker/kodata/LICENSE
1 change: 1 addition & 0 deletions cmd/channel_broker/kodata/VENDOR-LICENSE
1 change: 1 addition & 0 deletions cmd/channel_broker/kodata/refs
41 changes: 41 additions & 0 deletions cmd/channel_broker/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
Copyright 2020 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 main

import (
// Uncomment the following line to load the gcp plugin (only required to authenticate against GKE clusters).
// _ "k8s.io/client-go/plugin/pkg/client/auth/gcp"

"knative.dev/pkg/injection/sharedmain"

"knative.dev/eventing/pkg/reconciler/broker"
"knative.dev/eventing/pkg/reconciler/configmappropagation"
"knative.dev/eventing/pkg/reconciler/namespace"
"knative.dev/eventing/pkg/reconciler/trigger"
)

func main() {
sharedmain.Main("controller",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These controllers have accompanying webhooks that still live in the eventing-webhook deployment. Was that missed or intentional?

// Eventing
namespace.NewController,
broker.NewController,
trigger.NewController,

// Utility for sole-tenancy brokers.
configmappropagation.NewController,
)
}
8 changes: 0 additions & 8 deletions cmd/controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,36 +23,28 @@ import (
"knative.dev/pkg/injection/sharedmain"

"knative.dev/eventing/pkg/reconciler/apiserversource"
"knative.dev/eventing/pkg/reconciler/broker"
"knative.dev/eventing/pkg/reconciler/channel"
"knative.dev/eventing/pkg/reconciler/configmappropagation"
"knative.dev/eventing/pkg/reconciler/eventtype"
"knative.dev/eventing/pkg/reconciler/legacyapiserversource"
"knative.dev/eventing/pkg/reconciler/legacycontainersource"
"knative.dev/eventing/pkg/reconciler/legacycronjobsource"
"knative.dev/eventing/pkg/reconciler/namespace"
"knative.dev/eventing/pkg/reconciler/parallel"
"knative.dev/eventing/pkg/reconciler/pingsource"
"knative.dev/eventing/pkg/reconciler/sequence"
"knative.dev/eventing/pkg/reconciler/subscription"
"knative.dev/eventing/pkg/reconciler/trigger"
)

func main() {
sharedmain.Main("controller",
// Messaging
namespace.NewController,
channel.NewController,

// Eventing
subscription.NewController,
trigger.NewController,
broker.NewController,
eventtype.NewController,

// Flows
parallel.NewController,
configmappropagation.NewController,
sequence.NewController,

// Sources
Expand Down
1 change: 1 addition & 0 deletions config/200-channel-broker-binding.yaml
1 change: 1 addition & 0 deletions config/200-channel-broker-clusterrole.yaml
2 changes: 1 addition & 1 deletion config/300-configmappropagation.yaml
1 change: 1 addition & 0 deletions config/500-broker-controller.yaml
28 changes: 28 additions & 0 deletions config/brokers/channel-broker/200-channel-broker-binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2020 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.

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: eventing-channel-broker-controller
labels:
eventing.knative.dev/release: devel
subjects:
- kind: ServiceAccount
name: eventing-controller
namespace: knative-eventing
roleRef:
kind: ClusterRole
name: knative-eventing-channel-broker-controller
apiGroup: rbac.authorization.k8s.io
75 changes: 75 additions & 0 deletions config/brokers/channel-broker/deployments/controller.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# 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
#
# 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.

apiVersion: apps/v1
kind: Deployment
metadata:
name: broker-controller
namespace: knative-eventing
labels:
eventing.knative.dev/release: devel
spec:
replicas: 1
selector:
matchLabels:
app: broker-controller
template:
metadata:
labels:
app: broker-controller
eventing.knative.dev/release: devel
spec:
serviceAccountName: eventing-controller
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This controller should have a different service account with the permissions it needs rather than sharing with the core eventing controller.


containers:
- name: eventing-controller
terminationMessagePolicy: FallbackToLogsOnError
image: knative.dev/eventing/cmd/channel_broker

resources:
requests:
cpu: 100m
memory: 100Mi

env:
- name: SYSTEM_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: CONFIG_LOGGING_NAME
value: config-logging
- name: CONFIG_OBSERVABILITY_NAME
value: config-observability
- name: METRICS_DOMAIN
value: knative.dev/eventing
# Broker
- name: BROKER_INGRESS_IMAGE
value: knative.dev/eventing/cmd/broker/ingress
- name: BROKER_INGRESS_SERVICE_ACCOUNT
value: eventing-broker-ingress
- name: BROKER_FILTER_IMAGE
value: knative.dev/eventing/cmd/broker/filter
- name: BROKER_FILTER_SERVICE_ACCOUNT
value: eventing-broker-filter
- name: BROKER_IMAGE_PULL_SECRET_NAME
value:

securityContext:
allowPrivilegeEscalation: false

ports:
- name: metrics
containerPort: 9090
- name: profiling
containerPort: 8008
35 changes: 35 additions & 0 deletions config/brokers/channel-broker/roles/controller-clusterroles.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright 2020 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.

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: knative-eventing-channel-broker-controller
labels:
eventing.knative.dev/release: devel
rules:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should include all permissions the broker controller needs.

# Configs resources and status we care about.
- apiGroups:
- "configs.internal.knative.dev"
resources:
- "configmappropagations"
- "configmappropagations/status"
verbs:
- "get"
- "list"
- "create"
- "update"
- "delete"
- "patch"
- "watch"
11 changes: 0 additions & 11 deletions config/core/deployments/controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,6 @@ spec:
value: config-observability
- name: METRICS_DOMAIN
value: knative.dev/eventing
# Broker
- name: BROKER_INGRESS_IMAGE
value: knative.dev/eventing/cmd/broker/ingress
- name: BROKER_INGRESS_SERVICE_ACCOUNT
value: eventing-broker-ingress
- name: BROKER_FILTER_IMAGE
value: knative.dev/eventing/cmd/broker/filter
- name: BROKER_FILTER_SERVICE_ACCOUNT
value: eventing-broker-filter
- name: BROKER_IMAGE_PULL_SECRET_NAME
value:
# Legacy CronJobSource
- name: CRONJOB_RA_IMAGE
value: knative.dev/eventing/cmd/cronjob_receive_adapter
Expand Down
8 changes: 0 additions & 8 deletions config/core/roles/controller-clusterroles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,6 @@ rules:
- "parallels/status"
verbs: *everything

# Configs resources and status we care about.
- apiGroups:
- "configs.internal.knative.dev"
resources:
- "configmappropagations"
- "configmappropagations/status"
verbs: *everything

# Messaging resources and finalizers we care about.
- apiGroups:
- "messaging.knative.dev"
Expand Down
7 changes: 4 additions & 3 deletions hack/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@ source $(dirname $0)/../vendor/knative.dev/test-infra/scripts/release.sh
# Yaml files to generate, and the source config dir for them.
declare -A COMPONENTS
COMPONENTS=(
["eventing-core.yaml"]="config"
["eventing-core.yaml"]="config/core"
["eventing-crds.yaml"]="config/core/resources"
["channel-broker.yaml"]="config/brokers/channel-broker"
["in-memory-channel.yaml"]="config/channels/in-memory-channel"
)
readonly COMPONENTS

declare -A RELEASES
RELEASES=(
["eventing.yaml"]="eventing-core.yaml in-memory-channel.yaml"
["eventing.yaml"]="eventing-core.yaml channel-broker.yaml in-memory-channel.yaml"
)
readonly RELEASES

Expand All @@ -49,7 +50,7 @@ function build_release() {
for yaml in "${!COMPONENTS[@]}"; do
local config="${COMPONENTS[${yaml}]}"
echo "Building Knative Eventing - ${config}"
ko resolve ${KO_FLAGS} -f ${config}/ | "${LABEL_YAML_CMD[@]}" > ${yaml}
ko resolve ${KO_FLAGS} -R -f ${config}/ | "${LABEL_YAML_CMD[@]}" > ${yaml}
all_yamls+=(${yaml})
done
# Assemble the release
Expand Down