-
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
KafkaSink CRD, types and reconciler #134
KafkaSink CRD, types and reconciler #134
Conversation
So this PR still doesn't contain the KafkaSink controller right? Can you implement the controller in this PR (or even a separate one which depends on this one), i wonder how big the code is 😄 |
@slinkydeveloper I would like to consolidate the CRD in this one and then in a separate PR implement the reconciler. WDYT? |
It will probably be roughly 3k+ LOC (validation, types, and reconciler + tests) |
I'm ok with that, but I think you should start implementing the controller now and keep the 2 PRs separate, this should simplify the feedback on this PR too |
- numPartitions | ||
- replicationFactor | ||
- bootstrapServers | ||
properties: |
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 think we need an optional "encoding" flag here, to let the user choose between structured and binary. Also, i think the default should be structured (it's quite unnatural in kafka world to send stuff in headers, so i think kafka users would prefer the structured mode as default)
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.
CE spec calls them message mode
: https://github.com/cloudevents/spec/blob/master/spec.md#message, do you think encoding
is more descriptive?
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.
To me, on this context, mode seems too "broad"... But i would love to hear people other people opinions @matzew
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.
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.
Or contentMode
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.
@slinkydeveloper Is it ok for you if we use contentMode
?
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'm not aware of any discussions around a Sink duck type but I'm sure @n3wscott has some ideas. As you said it must be addressable, and it should includes ceOverrides
, contentMode
and possibly dataContentType
(For RedisStreamSink data can either be json-encoded or RESP-encoded). Anyway do you mind opening an issue?
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.
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.
As yesterday discussion during eventing sources wg, I think for now we should proceed forward to shape this KafkaSink
CRD as an Addressable
and nothing else, since my understanding is that this is the only need for a Sink.
If at some point, we need to abstract something more than Addressable
for a sink, we can create that sink duck type and bump this KafkaSink
CRD. This process should also help us to better understand what we need to abstract, other than Addressable itself.
WDYT @n3wscott @lionelvillard @pierDipi ?
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 would not call it a Sink. The concept is a sink, just like a source is a source in concept. Call it what it is for Kafka is my recommendation, but I have had a lot of pushback on this idea. Folks just want to add the label to everything....
A kafka source would be KafkaSubscription
A kafka sink would be a KafkaTopic
A kafka channel would make n KafkaSubscription for the controlled KafkaTopic
Sure |
Added types (and code generation): b671be1 |
d88230b
to
835de79
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 -name '*.pb.go' -prune -o -type f -name '*.go' -print)
goimports -w $(find -name '*.go' | grep -v vendor | grep -v third_party | grep -v .pb.go | grep -v wire_gen.go)
Maven... |
/lint |
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.
@pierDipi: 34 warnings.
In response to this:
/lint
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.
Rebased. |
@pierDipi I think the control plane is fine as is, let's avoid creating too much controller images |
Just to clarify, I meant to create another YAML, eg
Users choose 2 or 3 or both. Images remain 3 (but we package one per YAML). |
Ah ok so we keep the control plane all together but we split the data plane deployments, one yaml for sink and one for broker. What happens if i install the control plane but only one of the two data planes? |
As it is now you can create a Broker or a KafkaSink but there won't be a data plane for it, so it'll get ready but it isn't actually ready since there is not data plane, we can add a check to see if it exists or not and reflect that in the status. I would do this in a different PR once this is in. |
|
||
if err := envconfig.Process("", &brokerEnvConfigs); err != nil { | ||
log.Fatal("cannot process environment variables", err) | ||
brokerEnv, err := config.GetEnvConfig("BROKER") |
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.
We should prefix special knative things with K_
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 am not sure it is a good idea to call envconfig.Process on each get accessor.
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.
What do you mean by special?
I see those configurations just like SYSTEM_NAMESPACE
(which is part of them) which hasn't a K_
prefix. 😕
I am not sure it is a good idea to call envconfig.Process on each get accessor.
How do you set the same set of configurations with different prefixes without duplicating the struct? We have the same set of configurations for two reconcilers with different values, BROKER
and SINK
are prefixes to distinguish the two: https://github.com/knative-sandbox/eventing-kafka-broker/pull/134/files#diff-2e77fe22a128ec539d95f2e10c96eff6R60-R88,
|
||
var types = map[schema.GroupVersionKind]resourcesemantics.GenericCRD{ | ||
|
||
eventingv1alpha1.SchemeGroupVersion.WithKind("KafkaSink"): &eventingv1alpha1.KafkaSink{}, |
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 would not call it a Sink. The concept is a sink
, just like a source is a source in concept. Call it what it is for Kafka is my recommendation, but I have had a lot of pushback on this idea. Folks just want to add the label to everything....
A kafka source would be KafkaSubscription
A kafka sink would be a KafkaTopic
A kafka channel would make n KafkaSubscription
for the controlled KafkaTopic
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 suppose the reason why we have the KafkaSource
is to keep the naming consistent with the eventing concept event source, similarly to why we should name this KafkaSink
to align with the eventing concept of event sink
- numPartitions | ||
- replicationFactor | ||
- bootstrapServers | ||
properties: |
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 would not call it a Sink. The concept is a sink, just like a source is a source in concept. Call it what it is for Kafka is my recommendation, but I have had a lot of pushback on this idea. Folks just want to add the label to everything....
A kafka source would be KafkaSubscription
A kafka sink would be a KafkaTopic
A kafka channel would make n KafkaSubscription for the controlled KafkaTopic
I really like this. see a little doc on usage: https://gist.github.com/matzew/e2c2fcd2696a346f25b8bc9e64bfd0fa |
@matzew cool! We can use your doc as a starting point for the docs pr |
I will relent. Symmetry with the |
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.
Green flag for me!
/approve
/lgtm
/hold I'm gonna wait for another review
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
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: matzew, 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 |
I think the name does match the current "design" - and yes, naming is hard ... |
Who's gonna unhold this? 😄 |
/unhold |
Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com> Co-authored-by: Pierangelo Di Pilato <pierdipi@redhat.com>
We can reuse the same
receiver
component of the data plane to build aKafkaSink
.Proposed Changes