-
Notifications
You must be signed in to change notification settings - Fork 31
/
kafka.go
28 lines (23 loc) · 1003 Bytes
/
kafka.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package v1alpha1
import (
"fmt"
)
type KafkaNET struct {
TLS *TLS `json:"tls,omitempty" protobuf:"bytes,1,opt,name=tls"`
SASL *SASL `json:"sasl,omitempty" protobuf:"bytes,2,opt,name=sasl"`
}
type KafkaConfig struct {
Brokers []string `json:"brokers,omitempty" protobuf:"bytes,1,rep,name=brokers"`
Version string `json:"version,omitempty" protobuf:"bytes,2,opt,name=version"`
NET *KafkaNET `json:"net,omitempty" protobuf:"bytes,3,opt,name=net"`
MaxMessageBytes int32 `json:"maxMessageBytes,omitempty" protobuf:"varint,4,opt,name=maxMessageBytes"`
}
type Kafka struct {
// +kubebuilder:default=default
Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"`
KafkaConfig `json:",inline" protobuf:"bytes,4,opt,name=kafkaConfig"`
Topic string `json:"topic" protobuf:"bytes,3,opt,name=topic"`
}
func (in Kafka) GenURN(cluster, namespace string) string {
return fmt.Sprintf("urn:dataflow:kafka:%s:%s", in.Brokers[0], in.Topic)
}