-
Notifications
You must be signed in to change notification settings - Fork 28
Reconciliation for default broker selection #186
Reconciliation for default broker selection #186
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aliok: 0 warnings.
In response to this:
Issue to be fixed
Fixes #175
Proposed Changes
- New
DefaultBrokerClass
in KnativeEventing CR- Make the given broker default broker
Notes:
- Overwrites the
config-br-defaults
configmap based on the value given on CRTODO:
- Manifest update (waiting until the changes from Move broker defaults into core eventing#2947 updates the file
gs://knative-nightly/eventing/latest/eventing.yaml
)- Tests
- Verification instructions
Release Note
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
Closed #184 as it didn't support custom brokers and pushed this one for early feedback. FYI, I simply have done string operations. Didn't want to parse the string content of the configmap's cc @jcrossley3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Produced via:
gofmt -s -w $(find -path './vendor' -prune -o -path './third_party' -prune -o -type f -name '*.go' -print)
/hold Still waiting for the |
/unhold The nightly manifest is pushed now. |
} | ||
|
||
defaultBrokerClass := instance.Spec.DefaultBrokerClass | ||
if defaultBrokerClass == "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest if channelBasedBrokerClass is empty, we can just do nothing by not changing the configmap, since configmap may have existing values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@houshengbo I pushed some new commits and added some notes in the PR description.
To answer this concern:
If the configmap already exists, it will still be overridden. This behavior is like that for everything, not specific to this configmap. For example, if a deployment/configmap/whatever that's defined in the manifest exists, it will be overwritten by Manifestival. I didn't do anything special for this configmap.
I was trying to get away with no YAML parsing, but there are valid points. I will make some changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Produced via:
gofmt -s -w $(find -path './vendor' -prune -o -path './third_party' -prune -o -type f -name '*.go' -print)
5afac8e
to
dec9ba9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Produced via:
gofmt -s -w $(find -path './vendor' -prune -o -path './third_party' -prune -o -type f -name '*.go' -print)
@houshengbo @jcrossley3 Pushed new commits and added some notes in the PR description. Mind having another look? |
@aliok can you rebase? looks like the recent dependency update conflicts your change, a bit |
84be676
to
df82790
Compare
The following is the coverage report on the affected files.
|
Rebased |
@@ -62,19 +62,19 @@ func TestTransformers(t *testing.T) { | |||
results, err := platform.Transformers(kubeclient.Get(ctx), ke, logger) | |||
assertEqual(t, err, nil) | |||
// By default, there are 3 functions. | |||
assertEqual(t, len(results), 3) | |||
assertEqual(t, len(results), 4) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment above should change.
|
||
platform = append(platform, fakePlatform) | ||
results, err = platform.Transformers(kubeclient.Get(ctx), ke, logger) | ||
assertEqual(t, err, nil) | ||
// There is one function in existing platform, so there will be 4 functions in total. | ||
assertEqual(t, len(results), 4) | ||
assertEqual(t, len(results), 5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment above should change.
|
||
platformErr = append(platformErr, fakePlatformErr) | ||
results, err = platformErr.Transformers(kubeclient.Get(ctx), ke, logger) | ||
assertEqual(t, err.Error(), "Test Error") | ||
// By default, there are 3 functions. | ||
assertEqual(t, len(results), 3) | ||
assertEqual(t, len(results), 4) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment above should change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
There are some minor nits, but I still want to accept it for now.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: aliok, houshengbo The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Issue to be fixed
Fixes #175
Proposed Changes
DefaultBrokerClass
in KnativeEventing CRNotes:
default-br-config
field of theconfig-br-defaults
configmap based on the value given on CR.knative/eventing
, but in the end it was super bad to duplicate the parsing logic of the configmap's data (YAML in string) and I decided to reuse some functions fromknative/eventing
. The functions used are specific to eventing only and cannot be really moved toknative/pkg
.Verification instructions:
defaultBrokerClass
defined in the spec,ChannelBasedBroker
is used inconfig-br-defaults
configmap inknative-eventing
namespace.Release Note