diff --git a/cmd/controller/main.go b/cmd/controller/main.go index 854776ca0db..54dca64b957 100644 --- a/cmd/controller/main.go +++ b/cmd/controller/main.go @@ -22,25 +22,45 @@ 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/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" - parallel "knative.dev/eventing/pkg/reconciler/parallel" - sequence "knative.dev/eventing/pkg/reconciler/sequence" + "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", - subscription.NewController, + // Messaging namespace.NewController, channel.NewController, + + // Eventing + subscription.NewController, trigger.NewController, broker.NewController, eventtype.NewController, + + // Flows parallel.NewController, sequence.NewController, + + // Sources + apiserversource.NewController, + pingsource.NewController, + + // Legacy Sources + // TODO(#2312): Remove this after v0.13. + legacyapiserversource.NewController, + legacycontainersource.NewController, + legacycronjobsource.NewController, ) } diff --git a/cmd/sources_controller/kodata/HEAD b/cmd/sources_controller/kodata/HEAD deleted file mode 120000 index 8f63681d362..00000000000 --- a/cmd/sources_controller/kodata/HEAD +++ /dev/null @@ -1 +0,0 @@ -../../../.git/HEAD \ No newline at end of file diff --git a/cmd/sources_controller/kodata/LICENSE b/cmd/sources_controller/kodata/LICENSE deleted file mode 120000 index 5853aaea53b..00000000000 --- a/cmd/sources_controller/kodata/LICENSE +++ /dev/null @@ -1 +0,0 @@ -../../../LICENSE \ No newline at end of file diff --git a/cmd/sources_controller/kodata/VENDOR-LICENSE b/cmd/sources_controller/kodata/VENDOR-LICENSE deleted file mode 120000 index 3cc89764519..00000000000 --- a/cmd/sources_controller/kodata/VENDOR-LICENSE +++ /dev/null @@ -1 +0,0 @@ -../../../third_party/VENDOR-LICENSE \ No newline at end of file diff --git a/cmd/sources_controller/kodata/refs b/cmd/sources_controller/kodata/refs deleted file mode 120000 index 739d35bf96a..00000000000 --- a/cmd/sources_controller/kodata/refs +++ /dev/null @@ -1 +0,0 @@ -../../../.git/refs \ No newline at end of file diff --git a/cmd/sources_controller/main.go b/cmd/sources_controller/main.go deleted file mode 100644 index 4b9fcf76911..00000000000 --- a/cmd/sources_controller/main.go +++ /dev/null @@ -1,40 +0,0 @@ -/* -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 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/eventing/pkg/reconciler/apiserversource" - "knative.dev/eventing/pkg/reconciler/legacyapiserversource" - "knative.dev/eventing/pkg/reconciler/legacycontainersource" - "knative.dev/eventing/pkg/reconciler/legacycronjobsource" - "knative.dev/eventing/pkg/reconciler/pingsource" - "knative.dev/pkg/injection/sharedmain" -) - -func main() { - sharedmain.Main("source_controller", - apiserversource.NewController, - pingsource.NewController, - // TODO(#2312): Remove this after v0.13. - legacyapiserversource.NewController, - legacycontainersource.NewController, - legacycronjobsource.NewController, - ) -} diff --git a/config/200-sourcecontroller-clusterrole.yaml b/config/200-sourcecontroller-clusterrole.yaml deleted file mode 120000 index a40c40bd2b3..00000000000 --- a/config/200-sourcecontroller-clusterrole.yaml +++ /dev/null @@ -1 +0,0 @@ -core/roles/sourcecontroller-clusterroles.yaml \ No newline at end of file diff --git a/config/200-sources-controller-clusterrole.yaml b/config/200-sources-controller-clusterrole.yaml new file mode 120000 index 00000000000..162465ca38b --- /dev/null +++ b/config/200-sources-controller-clusterrole.yaml @@ -0,0 +1 @@ +core/roles/sources-controller-clusterroles.yaml \ No newline at end of file diff --git a/config/200-sources-serviceaccount.yaml b/config/200-sources-serviceaccount.yaml deleted file mode 120000 index 8111f6c1e29..00000000000 --- a/config/200-sources-serviceaccount.yaml +++ /dev/null @@ -1 +0,0 @@ -core/200-sources-serviceaccount.yaml \ No newline at end of file diff --git a/config/500-sources-controller.yaml b/config/500-sources-controller.yaml deleted file mode 120000 index 6ec046d4763..00000000000 --- a/config/500-sources-controller.yaml +++ /dev/null @@ -1 +0,0 @@ -core/deployments/sources-controller.yaml \ No newline at end of file diff --git a/config/core/200-eventing-serviceaccount.yaml b/config/core/200-eventing-serviceaccount.yaml index ab0e92e0514..f30564f3b57 100644 --- a/config/core/200-eventing-serviceaccount.yaml +++ b/config/core/200-eventing-serviceaccount.yaml @@ -73,6 +73,23 @@ roleRef: --- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: eventing-controller-sources-controller + labels: + eventing.knative.dev/release: devel +subjects: + - kind: ServiceAccount + name: eventing-controller + namespace: knative-eventing +roleRef: + kind: ClusterRole + name: knative-eventing-sources-controller + apiGroup: rbac.authorization.k8s.io + +--- + apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: diff --git a/config/core/200-sources-serviceaccount.yaml b/config/core/200-sources-serviceaccount.yaml deleted file mode 100644 index a200bb6c950..00000000000 --- a/config/core/200-sources-serviceaccount.yaml +++ /dev/null @@ -1,55 +0,0 @@ -# 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: v1 -kind: ServiceAccount -metadata: - name: eventing-source-controller - namespace: knative-eventing - labels: - eventing.knative.dev/release: devel - ---- - -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: eventing-source-controller - labels: - eventing.knative.dev/release: devel -subjects: - - kind: ServiceAccount - name: eventing-source-controller - namespace: knative-eventing -roleRef: - kind: ClusterRole - name: knative-eventing-source-controller - apiGroup: rbac.authorization.k8s.io - ---- - -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: eventing-source-controller-resolver - labels: - eventing.knative.dev/release: devel -subjects: - - kind: ServiceAccount - name: eventing-source-controller - namespace: knative-eventing -roleRef: - kind: ClusterRole - name: addressable-resolver - apiGroup: rbac.authorization.k8s.io diff --git a/config/core/deployments/controller.yaml b/config/core/deployments/controller.yaml index 280be1ad0a8..ac3c0727e42 100644 --- a/config/core/deployments/controller.yaml +++ b/config/core/deployments/controller.yaml @@ -37,6 +37,11 @@ spec: terminationMessagePolicy: FallbackToLogsOnError image: knative.dev/eventing/cmd/controller + resources: + requests: + cpu: 100m + memory: 100Mi + env: - name: SYSTEM_NAMESPACE valueFrom: @@ -48,6 +53,7 @@ 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 @@ -58,6 +64,15 @@ spec: 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 + # PingSource + - name: PING_IMAGE + value: knative.dev/eventing/cmd/ping + # APIServerSource + - name: APISERVER_RA_IMAGE + value: knative.dev/eventing/cmd/apiserver_receive_adapter securityContext: allowPrivilegeEscalation: false diff --git a/config/core/deployments/sources-controller.yaml b/config/core/deployments/sources-controller.yaml deleted file mode 100644 index 123853cd580..00000000000 --- a/config/core/deployments/sources-controller.yaml +++ /dev/null @@ -1,72 +0,0 @@ -# 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. - -apiVersion: apps/v1 -kind: Deployment -metadata: - name: sources-controller - namespace: knative-eventing - labels: - eventing.knative.dev/release: devel -spec: - selector: - matchLabels: - app: sources-controller - template: - metadata: - labels: - app: sources-controller - eventing.knative.dev/release: devel - spec: - serviceAccountName: eventing-source-controller - - containers: - - name: controller - # This is the Go import path for the binary that is containerized - # and substituted here. - image: knative.dev/eventing/cmd/sources_controller - - 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/sources - - name: CRONJOB_RA_IMAGE - value: knative.dev/eventing/cmd/cronjob_receive_adapter - - name: PING_IMAGE - value: knative.dev/eventing/cmd/ping - - name: APISERVER_RA_IMAGE - # This is the Go import path for API server receive adapter binary - # that is containerized and substituted here. - value: knative.dev/eventing/cmd/apiserver_receive_adapter - - securityContext: - allowPrivilegeEscalation: false - - ports: - - name: metrics - containerPort: 9090 - - name: profiling - containerPort: 8008 diff --git a/config/core/roles/clusterrole-namespaced.yaml b/config/core/roles/clusterrole-namespaced.yaml index d07091a672c..64e9fafe668 100644 --- a/config/core/roles/clusterrole-namespaced.yaml +++ b/config/core/roles/clusterrole-namespaced.yaml @@ -35,7 +35,6 @@ rules: - apiGroups: ["messaging.knative.dev"] resources: ["*"] verbs: ["*"] - --- kind: ClusterRole apiVersion: rbac.authorization.k8s.io/v1 @@ -48,6 +47,18 @@ rules: - apiGroups: ["sources.eventing.knative.dev"] resources: ["*"] verbs: ["*"] +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: knative-sources-namespaced-admin + labels: + eventing.knative.dev/release: devel + rbac.authorization.k8s.io/aggregate-to-admin: "true" +rules: + - apiGroups: ["sources.knative.dev"] + resources: ["*"] + verbs: ["*"] --- kind: ClusterRole @@ -58,7 +69,7 @@ metadata: rbac.authorization.k8s.io/aggregate-to-edit: "true" eventing.knative.dev/release: devel rules: - - apiGroups: ["eventing.knative.dev", "messaging.knative.dev", "sources.eventing.knative.dev"] + - apiGroups: ["eventing.knative.dev", "messaging.knative.dev", "sources.eventing.knative.dev", "sources.knative.dev"] resources: ["*"] verbs: ["create", "update", "patch", "delete"] --- @@ -70,6 +81,6 @@ metadata: rbac.authorization.k8s.io/aggregate-to-view: "true" eventing.knative.dev/release: devel rules: - - apiGroups: ["eventing.knative.dev", "messaging.knative.dev", "sources.eventing.knative.dev"] + - apiGroups: ["eventing.knative.dev", "messaging.knative.dev", "sources.eventing.knative.dev", "sources.knative.dev"] resources: ["*"] verbs: ["get", "list", "watch"] diff --git a/config/core/roles/sourcecontroller-clusterroles.yaml b/config/core/roles/sources-controller-clusterroles.yaml similarity index 98% rename from config/core/roles/sourcecontroller-clusterroles.yaml rename to config/core/roles/sources-controller-clusterroles.yaml index f6e7f1696a7..a3cdcf4098d 100644 --- a/config/core/roles/sourcecontroller-clusterroles.yaml +++ b/config/core/roles/sources-controller-clusterroles.yaml @@ -15,7 +15,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: - name: knative-eventing-source-controller + name: knative-eventing-sources-controller labels: eventing.knative.dev/release: devel rules: diff --git a/config/monitoring/metrics/prometheus/100-prometheus-scrape-kn-eventing.yaml b/config/monitoring/metrics/prometheus/100-prometheus-scrape-kn-eventing.yaml index 24758c0af36..be8e7b2339d 100644 --- a/config/monitoring/metrics/prometheus/100-prometheus-scrape-kn-eventing.yaml +++ b/config/monitoring/metrics/prometheus/100-prometheus-scrape-kn-eventing.yaml @@ -52,24 +52,6 @@ target_label: pod - source_labels: [__meta_kubernetes_service_name] target_label: service -# Sources controller -- job_name: sources-controller - scrape_interval: 3s - scrape_timeout: 3s - kubernetes_sd_configs: - - role: pod - relabel_configs: - # Scrape only the the targets matching the following metadata - - source_labels: [__meta_kubernetes_namespace, __meta_kubernetes_pod_label_app, __meta_kubernetes_pod_container_port_name] - action: keep - regex: knative-eventing;sources-controller;metrics - # Rename metadata labels to be reader friendly - - source_labels: [__meta_kubernetes_namespace] - target_label: namespace - - source_labels: [__meta_kubernetes_pod_name] - target_label: pod - - source_labels: [__meta_kubernetes_service_name] - target_label: service # inmemorychannel-controller - job_name: inmemorychannel-controller