knative / eventing

Event-driven application platform for Kubernetes
https://knative.dev/docs/eventing
Apache License 2.0
1.41k stars 588 forks source link

unable to see Broker in the namespace once knative-eventing injection label #3775

Closed cpate3 closed 3 years ago

cpate3 commented 4 years ago

Describe the bug Not automatically create a Broker named default in the default namespace once "kubectl label namespace default knative-eventing-injection=enabled". Even manually creating broker through YAML in different namespace cause READY state blank

Expected behavior Have a usecase to integrate AWS SNS topic events into Knative eventing service in Kubernetes. The expected result of this evaluation is we should be able to see broker creation automation through controller reconciliation as soon as we enabled knative-eventing-injection sidecar. We are not going to use real time events so hopefully there is no need of channel specific broker so what is proper procedure to setup broker for normal events handling.

To Reproduce kubectl get pods -n knative-eventing NAME READY STATUS RESTARTS AGE broker-controller-84d9f797d6-fljgx 1/1 Running 0 30h eventing-controller-848cbf577c-qpjcv 1/1 Running 0 30h eventing-webhook-7c5bf56d69-s8q58 1/1 Running 2 30h imc-controller-69d667ff65-8bhnl 1/1 Running 0 30h imc-dispatcher-6db5cd994b-5btzb 1/1 Running 0 30h

✗ k describe cm config-br-defaults -n knative-eventing Name: config-br-defaults Namespace: knative-eventing Labels: eventing.knative.dev/release=v0.16.0 Annotations: kubectl.kubernetes.io/last-applied-configuration: {"apiVersion":"v1","data":{"default-br-config":"clusterDefault:\n brokerClass: MTChannelBasedBroker\n apiVersion: v1\n kind: ConfigMap...

Data

default-br-config:

clusterDefault: brokerClass: MTChannelBasedBroker apiVersion: v1 kind: ConfigMap name: config-br-default-channel namespace: knative-eventing

Events:

k get broker --all-namespaces NAMESPACE NAME READY REASON URL AGE emr-events default 30h

Knative release version export KNATIVE_VERSION="0.16.0" export ISTIO_VERSION="1.6.3"

Additional context I have tried on different Knative version and Istio versions but causing same behavior. Is this a BUG?

cpate3 commented 4 years ago

Ready and URL has no value in return for broker. The "KNATIVE-EVENTING-INJECTION" sidecar is enabled for default namespace. Today have upgraded ISTIO_VERSION to latest "1.6.7" and keep KNATIVE_VERSION "0.16.0" but it bring same behavior. pls advice..

x kubectl get namespace -L knative-eventing-injection NAME STATUS AGE KNATIVE-EVENTING-INJECTION default Active 72d enabled

✗ k get broker --all-namespaces NAMESPACE NAME READY REASON URL AGE default broker-2 19s default default 66s

grantr commented 4 years ago

Hi @cpate3, thanks for the report and sorry you're having trouble. You'll need to install the sugar-controller component for the namespace injection feature to work. Here's the yaml: https://github.com/knative/eventing/releases/download/v0.16.0/eventing-sugar-controller.yaml

Can you install that and see if it fixes the issue for you?

@n3wscott for visibility. We should make this clearer in the docs.

cpate3 commented 4 years ago

Thanks @grantr. After successfully deploying sugar-controller, now can see default broker is coming up and I can see reconciliation loop in controller pod logs. But now there is BLANK value in READY and URL as well. We should get true READY value with certain URL. I can see in document it refer to broker endpoint "http://broker-ingress.knative-eventing.svc.cluster.local/default/default'.

{"level":"info","ts":"2020-08-05T19:12:41.782Z","logger":"sugar-controller.knative.dev-eventing-pkg-reconciler-sugar-namespace.Reconciler","caller":"controller/controller.go:474","msg":"Reconcile succeeded. Time taken: 17.112µs","commit":"e018fe7","knative.dev/traceid":"e4db7ccc-a456-43e6-b78c-014492978708","knative.dev/key":"default"}

✗ kubectl get broker NAME READY REASON URL AGE default

n3wscott commented 4 years ago

it is under Optional Eventing extensions + Sugar Controller and also linked a few places, but yeah, it should be a bit more clear. Maybe @knative/tbd-google-tech-writers have some ideas?

on this page: https://knative.dev/docs/install/any-kubernetes-cluster/#installing-the-eventing-component

cc @abrennan89

cpate3 commented 4 years ago

thanks @n3wscott @grantr. yes the doc seems straight forward. As a part of deployment, i have small bash code to take care those dependencies but there is question about why do I still see READY and URL has no value in default broker. Is there anything miss in ConfigMap or there is some compatibility issue or its bug.

`#!/bin/bash export KNATIVE_VERSION="0.16.0" export ISTIO_VERSION="1.6.7"

set -v

DIR="$(dirname "$0")" . "${DIR}/config"

Install Eventing CRDs

kubectl apply -f "https://github.com/knative/eventing/releases/download/v${KNATIVE_VERSION}/eventing-crds.yaml"

Install Eventing Core

kubectl apply -f "https://github.com/knative/eventing/releases/download/v${KNATIVE_VERSION}/eventing-core.yaml"

Install default in-memory channel (not suitable for production)

kubectl apply -f "https://github.com/knative/eventing/releases/download/v${KNATIVE_VERSION}/in-memory-channel.yaml"

Install default Broker

kubectl apply -f "https://github.com/knative/eventing/releases/download/v${KNATIVE_VERSION}/deprecated-channel-broker.yaml"

Install suger controller

kubectl apply --filename https://github.com/knative/eventing/releases/download/v${KNATIVE_VERSION}/eventing-sugar-controller.yaml

echo "sleeping for 1 mins" sleep 60

Check all eventing pods have STATUS 'Running'

kubectl get pods -n knative-eventing`

grantr commented 4 years ago

@cpate3 could you paste the broker yaml here so we can see the error message? Run this command: kubectl get broker default -oyaml

chiragkumarp commented 4 years ago

✗ kubectl get broker default -oyaml apiVersion: eventing.knative.dev/v1 kind: Broker metadata: annotations: eventing.knative.dev/broker.class: MTChannelBasedBroker eventing.knative.dev/creator: system:serviceaccount:knative-eventing:eventing-controller eventing.knative.dev/lastModifier: system:serviceaccount:knative-eventing:eventing-controller creationTimestamp: "2020-08-05T19:24:58Z" generation: 1 labels: eventing.knative.dev/injected: "true" name: default namespace: default resourceVersion: "306010" selfLink: /apis/eventing.knative.dev/v1/namespaces/default/brokers/default uid: a7e4ebf7-6107-49ae-bfd5-585ecf5d0617 spec: config: apiVersion: v1 kind: ConfigMap name: config-br-default-channel namespace: knative-eventing status: address: {}

grantr commented 3 years ago

Sorry for missing your reply earlier @cpate3! It looks like your broker isn't being reconciled at all, and I think I might know why.

In the script you posted above, you are using this URL to install the broker:

kubectl apply -f "https://github.com/knative/eventing/releases/download/v${KNATIVE_VERSION}/deprecated-channel-broker.yaml"

but this is the deprecated-channel-broker.yaml. You need to apply mt-channel-broker.yaml instead, since your broker has the MTChannelBroker broker class.

Try this instead:

kubectl apply -f "https://github.com/knative/eventing/releases/download/v${KNATIVE_VERSION}/mt-channel-broker.yaml"

Your broker should become ready shortly after that.

In later releases deprecated-channel-broker.yaml has been removed which should remove some of the confusion.

cpate3 commented 3 years ago

thanks @grantr. It works. Appreciate for prompt support on this. Yes if this is covered in latest release than there will be no confusion.