-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Kafka kerberos authentication support for collector/ingester #1589
Kafka kerberos authentication support for collector/ingester #1589
Conversation
3610065
to
53e2731
Compare
53e2731
to
e554c19
Compare
Codecov Report
@@ Coverage Diff @@
## master #1589 +/- ##
==========================================
+ Coverage 98.72% 98.74% +0.02%
==========================================
Files 191 191
Lines 9182 9190 +8
==========================================
+ Hits 9065 9075 +10
+ Misses 91 89 -2
Partials 26 26
Continue to review full report at Codecov.
|
I just need to test this. |
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.
Just left some initial comments, as will be on PTO next week.
cmd/ingester/app/flags.go
Outdated
// KerberosPrefix for Kerberos configuration options | ||
KerberosPrefix = ".kerberos" | ||
// SuffixKerberosServiceName is the suffix for Kerberos service name | ||
SuffixKerberosServiceName = ".serviceName" |
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.
Instead of camel case, I think most flags use hyphens (e.g. service-name). Same applies to useKeyTab
and kerberosConfig
.
cmd/ingester/app/flags.go
Outdated
// SuffixKerberosPassword is Kerberos password | ||
SuffixKerberosPassword = ".password" | ||
// SuffixKerberosConfig is path to the kerberos configuration file. | ||
SuffixKerberosConfig = ".kerberosConfig" |
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 option will already have a .kerberos
prefix - so the option itself could just be named .config
pkg/kafka/consumer/config.go
Outdated
UseKeyTab bool | ||
Username string | ||
Password string | ||
KerberosConfigPath string |
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.
nit: This could be just ConfigPath
plugin/storage/kafka/options.go
Outdated
suffixAuthentication = ".authentication" | ||
// Kerberos configuration options | ||
kerberosPrefix = ".kerberos" | ||
suffixKerberosServiceName = ".serviceName" |
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 comments as for the ingester, related to the option names.
@@ -150,7 +150,7 @@ required = [ | |||
|
|||
[[constraint]] | |||
name = "github.com/Shopify/sarama" | |||
version = "1.20.1" |
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.
Is there a way to depend on a version?
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.
Hopefully a new release should be coming soon: IBM/sarama#1366 (comment)
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 just temporal, waiting for a new release of sarama.
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.
@pavolloffay if we don't get a sarama release soon, are we ok to release with the SHA?
plugin/storage/kafka/options.go
Outdated
suffixBrokers = ".brokers" | ||
suffixTopic = ".topic" | ||
suffixEncoding = ".encoding" | ||
suffixAuthentication = ".authentication" |
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.
Are there more authentication mechanisms? Is so maybe we should rather have .kerberos=true
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 .authentication=kerberos
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 now, there is only one authentication mechanism which is in this case Kerberos, but Kafka (and Sarama) support others, I would say that @objectiser suggestion is the way to go, just in case that in the future we wanted more mechanisms.
4ac2890
to
b68c652
Compare
4424d7e
to
be8726a
Compare
I've already tested this with a kafka cluster configured with Kerberos. this PR is still using a commit hash, waiting for a new release of Sarama. |
@@ -150,7 +150,7 @@ required = [ | |||
|
|||
[[constraint]] | |||
name = "github.com/Shopify/sarama" | |||
version = "1.20.1" |
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.
@pavolloffay if we don't get a sarama release soon, are we ok to release with the SHA?
cmd/ingester/app/flags.go
Outdated
flagSet.String( | ||
KafkaConsumerConfigPrefix+SuffixAuthentication, | ||
DefaultAuthentication, | ||
"Authentication type used to authenticate with kafka cluster") |
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.
Could you include the valid values (e.g. none, kerberos) and which is 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.
I changed this to indicate valid values, the default value is displayed by the library that generates the help output.
This is the printed message:
--kafka.consumer.authentication string Authentication type used to authenticate with kafka cluster. e.g. none, kerberos (default "none")
519f845
to
772e6a1
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.
It looks good. Just some massaging comments.
The flags names should be changed for consistency and the kerberos flags could be defined in one place.
cmd/ingester/app/flags.go
Outdated
// SuffixKerberosPassword is Kerberos password | ||
SuffixKerberosPassword = ".password" | ||
// SuffixKerberosConfig is path to the kerberos configuration file. | ||
SuffixKerberosConfig = ".config-path" |
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 the consistency with other flags this should be changed .config-file
.
PAN_STORAGE_TYPE=elasticsearch go run -tags ui ./cmd/all-in-one/main.go -h | grep file 11:30
2019/06/26 11:31:02 maxprocs: Leaving GOMAXPROCS=8: CPU quota undefined
--collector.grpc.tls.cert string Path to TLS certificate file
--collector.grpc.tls.key string Path to TLS key file
--config-file string Configuration file in JSON, TOML, YAML, HCL, or Java properties formats (default none). See spf13/viper for precedence.
--es-archive.tags-as-fields.all (experimental) Store all span and process tags as object fields. If true .tags-as-fields.config-file is ignored. Binary tags are always stored as nested objects.
--es-archive.tags-as-fields.config-file string (experimental) Optional path to a file containing tag keys which will be stored as object fields. Each key should be on a separate line.
--es-archive.tls.ca string Path to TLS CA file
--es-archive.tls.cert string Path to TLS certificate file
--es-archive.tls.key string Path to TLS key file
--es-archive.token-file string Path to a file containing bearer token. This flag also loads CA if it is specified.
--es.tags-as-fields.all (experimental) Store all span and process tags as object fields. If true .tags-as-fields.config-file is ignored. Binary tags are always stored as nested objects.
--es.tags-as-fields.config-file string (experimental) Optional path to a file containing tag keys which will be stored as object fields. Each key should be on a separate line.
--es.tls.ca string Path to TLS CA file
--es.tls.cert string Path to TLS certificate file
--es.tls.key string Path to TLS key file
--es.token-file string Path to a file containing bearer token. This flag also loads CA if it is specified.
--query.static-files string The directory path override for the static assets for the UI
--query.ui-config string The path to the UI configuration file in JSON format
--reporter.grpc.tls.ca string Path to a TLS CA file. (default use the systems truststore)
--sampling.strategies-file string The path for the sampling strategies file in JSON format. See sampling documentation to see format of the file
cmd/ingester/app/flags.go
Outdated
// SuffixKerberosConfig is path to the kerberos configuration file. | ||
SuffixKerberosConfig = ".config-path" | ||
// SuffixKerberosKeyTab is path keytab file used instead of password when SuffixKerberosUseKeyTab = true | ||
SuffixKerberosKeyTab = ".keytab-path" |
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.
See the previous comment - change to keytab-file
cmd/ingester/app/flags.go
Outdated
flagSet.String( | ||
KafkaConsumerConfigPrefix+KerberosPrefix+SuffixKerberosConfig, | ||
DefaultKerberosConfig, | ||
"Path to Kerberos configuration. i.e /etc/krb5.conf") |
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.
use the DefaultKerberosConfig
cmd/ingester/app/flags.go
Outdated
flagSet.String( | ||
KafkaConsumerConfigPrefix+KerberosPrefix+SuffixKerberosKeyTab, | ||
DefaultKerberosKeyTab, | ||
"Path to keytab file. i.e /etc/security/kafka.keytab") |
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.
use DefaultKerberosKeyTab
plugin/storage/kafka/options.go
Outdated
defaultTopic = "jaeger-spans" | ||
defaultEncoding = EncodingProto | ||
defaultAuthentication = "none" | ||
defaultKerberosConfig = "/etc/krb5.conf" |
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.
nit: reuse constant DefaultKerberosConfig
?
plugin/storage/kafka/options.go
Outdated
defaultKerberosRealm = "" | ||
defaultKerberosPassword = "" | ||
defaultKerberosUsername = "" | ||
defaultKerberosKeyTab = "/etc/security/kafka.keytab" |
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.
nit: reuse constant DefaultKerberosKeyTab
?
plugin/storage/kafka/options.go
Outdated
@@ -69,12 +87,57 @@ func (opt *Options) AddFlags(flagSet *flag.FlagSet) { | |||
defaultEncoding, | |||
fmt.Sprintf(`(experimental) Encoding of spans ("%s" or "%s") sent to kafka.`, EncodingJSON, EncodingProto), | |||
) | |||
flagSet.String( |
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.
Instead of repeating this over, could we define it only in one place e.g. pkg/kafka/auth
?
2f5f210
to
dc68b14
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.
LGTM just two nits
) | ||
|
||
const none = "none" | ||
const kerberos = "kerberos" |
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.
nit: I would define this as array and pass to flag description:
- to avoid duplication in constants
- this way we don't forget to update help message if new auth is added
pkg/kafka/auth/options.go
Outdated
suffixKerberosConfig = ".config-file" | ||
suffixKerberosKeyTab = ".keytab-file" | ||
|
||
defaultAuthentication = "none" |
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.
nit: related to my previous comment, remove this and just pass authTypes[0]
to flag definition
95738f8
to
6eac579
Compare
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
6eac579
to
fa0e5ad
Compare
Hi I am getting error saying Failed to init storage factory. Kafka client has run out of available brokers to talk to(Is your cluster reachable) ? |
Signed-off-by: Ruben Vargas ruben.vp8510@gmail.com
Which problem is this PR solving?
Short description of the changes