-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for SASL and SSL #534
Add support for SASL and SSL #534
Conversation
Codecov Report
@@ Coverage Diff @@
## master #534 +/- ##
============================================
- Coverage 76.96% 71.88% -5.08%
- Complexity 269 362 +93
============================================
Files 59 71 +12
Lines 1984 2586 +602
Branches 82 121 +39
============================================
+ Hits 1527 1859 +332
- Misses 342 583 +241
- Partials 115 144 +29
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
The linter complains about the generated code. |
/kind api-change |
/retest |
Unrelated |
/test pull-knative-sandbox-eventing-kafka-broker-integration-tests |
1 similar comment
/test pull-knative-sandbox-eventing-kafka-broker-integration-tests |
/test pull-knative-sandbox-eventing-kafka-broker-integration-tests |
/assign I will do a review on Friday |
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.
This is going in the right direction. I left some style comments and a bunch of questions, but I look forward to the @matzew review, he has better knowledge about sasl/tls than me
...main/java/dev/knative/eventing/kafka/broker/dispatcher/http/HttpConsumerVerticleFactory.java
Outdated
Show resolved
Hide resolved
...ain/java/dev/knative/eventing/kafka/broker/core/reconciler/impl/ResourcesReconcilerImpl.java
Show resolved
Hide resolved
data-plane/core/src/main/java/dev/knative/eventing/kafka/broker/core/security/Credentials.java
Outdated
Show resolved
Hide resolved
secretinformer.Get(ctx).Informer().AddEventHandler(controller.HandleAll(reconciler.SecretTracker.OnChanged)) | ||
|
||
sinkInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ | ||
DeleteFunc: reconciler.OnDeleteObserver, |
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.
Why that? Can't you just invoke OnDeleteObserver
in the FinalizeKind of the broker reconciler?
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 started with your proposed approach and then migrated to this one since this is the way used in other places in eventing.
ATM, they should be equivalent.
However, given this issue: knative/pkg#1956, I think it's safer to call it regardless of being the leader or not.
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.
Can you add a TODO, in order to remember in future that we need to port this code to FinalizeKind
after pkg#1956 is solved? The FinalizeKind approach is still more idiomatic
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.
For example:
time 1: p is the leader for x -> reconcile x
time 2: p is not the leader for x anymore
time 3: delete x
time 4: no FinilizeKind called on x in p (this is a leak)
Calling it outside FinalizeKind makes sure that the reconciler doesn't leak.
Example usage in serving: https://github.com/knative/serving/blob/b7a7c18bb5f6c14ae73c9dda1a817ded1ae879b0/pkg/reconciler/route/controller.go#L108-L110
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.
ATM, they should be equivalent.
This is not true.
brokerInformer.Informer().AddEventHandler(cache.FilteringResourceEventHandler{ | ||
FilterFunc: kafka.BrokerClassFilter(), | ||
Handler: cache.ResourceEventHandlerFuncs{ | ||
DeleteFunc: reconciler.OnDeleteObserver, |
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.
Why that? Can't you just invoke OnDeleteObserver
in the FinalizeKind of the broker reconciler?
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.
Same as the other comment.
Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>
Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>
Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>
Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>
Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>
Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>
Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>
Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>
Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>
Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>
Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>
Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>
Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>
Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>
Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>
Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>
Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>
Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>
Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>
Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>
Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>
Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>
The following is the coverage report on the affected files.
|
@pierDipi: The following test failed, say
Full PR test history. Your PR dashboard. 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. I understand the commands that are listed here. |
/test pull-knative-sandbox-eventing-kafka-broker-integration-tests |
/unhold /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: pierDipi, slinkydeveloper 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 |
* Add Data plane security module and Kubernetes provider Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com> * Add Auth configurations to contract Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com> * Add contol plane security module Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com> * Integrate security module in Broker and Sink reconciler Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com> * Add control plane E2E tests Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com> * Update proto schema and use PEM format Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com> * Move data plane to PEM certificates format Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com> * Extend E2E test by sending events Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com> * Run E2E test multiple times to reduce flakiness Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com> * Improve comment Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com> * Refresh third party license list Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com> * Update docs in proto definition Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com> * Rename E2E test functions Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com> * auth.secret.name -> auth.secret.ref.name Make reference explicit. Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com> * Add boilerplate to reconciler_test.go Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com> * Lint and update codegen Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com> * Change comment to Kubernetes resource reference Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com> * Remove Nullable annotations Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com> * Ensure TypeMeta when Tracker OnChanged is called Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com> * Remove unused Sarama logger adapter function Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com> * Use symlinks to testdata certs Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com> * KafkaSink supports SASL / SSL Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com> * Move bootstrap servers config in one place Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com> * Add KafkaSink E2E tests Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com> * Refresh third party file Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com> * Add Validation test for secret reference Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com> * Update codegen Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com> * Update KafkaSink CRD schema Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com> * Test security config functions Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com> * Test security config and scram modules Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com> * Rename data plane roles Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com> * Maven exclusion directly in parent pom Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com> * Refactor credentials fetching Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>
@pierDipi: Thanks a lot for all about SCRAM. Linked to: |
Fixes #368
This PR adds support for SASL and SSL.
A KafkaSink or a Broker enables SASL and SSL by adding a reference to a secret, like:
The referenced secret format is documented in our proto definition and E2E tests contain all possible formats, see
test/e2e/broker_sasl_ssl_test.go
Proposed Changes
Release Note
Docs
/kind enhancement