Skip to content

Trogdor: Added commonClientConf and adminClientConf to workload specs#4757

Merged
rajinisivaram merged 10 commits into
apache:trunkfrom
apovzner:adminclient-security
Apr 6, 2018
Merged

Trogdor: Added commonClientConf and adminClientConf to workload specs#4757
rajinisivaram merged 10 commits into
apache:trunkfrom
apovzner:adminclient-security

Conversation

@apovzner

@apovzner apovzner commented Mar 22, 2018

Copy link
Copy Markdown
Contributor

Currently, WorkerUtils will be able to create topics when there is no security. To be able to work with secure kafka, WorkerUtils.createTopic() needs to be able to take security configs. This PR adds commonClientConf field to both producer bench and roundtrip workload specs so that users can specify security and other common configs once for producer/consumer and adminClient. Also added adminClientConf field to workload specs so that users can specify adminClient specific configs if they want to. For completeness, added consumerConf and producerConf to roundtrip workload spec.

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG,
SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG,
SslConfigs.SSL_PROTOCOL_CONFIG,
SslConfigs.SSL_ENDPOINT_IDENTIFICATION_ALGORITHM_CONFIG

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you not use .withClientSslSupport().withClientSaslSupport()?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not know about those methods. Let me look. Thanks!

@cmccabe

cmccabe commented Mar 22, 2018

Copy link
Copy Markdown
Contributor

Thanks, seems reasonable.

Maybe we should have a clientConfig field in the Spec which describes all the configuration keys which are common to all clients (admin, producer, consumer). That might be simpler than trying to maintain whitelists of configuration keys that can bleed from one config to another.

@apovzner

Copy link
Copy Markdown
Contributor Author

@cmccabe I think with withClientSaslSupport().withClientSslSupport() we don't really whitelist anymore and that should work with changes in client configs. So I think pulling from producer/consumer configs is much simpler than asking people to separate common vs. producer/consumer specific configs in their specs.

@cmccabe

cmccabe commented Mar 23, 2018

Copy link
Copy Markdown
Contributor

I think it's wrong to copy configuration keys meant for the producer to the admin client or to the consumer. Although it's appealing as a quick hack that gets things to work, it quickly breaks down when things get even slightly more complicated. For example, what if someone wants to set a long request timeout for the admin client, but a short one for the producer? Perhaps the user wants to test producer timeouts, but not worry about topic creation timing out. But this is impossible with the current patch-- you haven't given the user any way to configure the AC separate from the producer.

We already have other tests such as RoundTripWorkload which have both a producer and a consumer. Are we going to use "producer config" to configure both? Or make the user repeat configurations twice? Neither of these options are appealing.

I think it's sensible to just separate configuration into common client configs, producer configs, and consumer configs. That should allow people to set whatever configurations they want, and also keep things simple.

@apovzner

Copy link
Copy Markdown
Contributor Author

Wouldn't common client config have the same issue as you mentioned configuring request timeout differently say for producer and consumer? Or you mean producer or consumer configs will be able to overwrite whatever is in common client config? Plus, for your example, we will need to add admin client config to the specs.

Also, how would people know what to put to common config and what not? I think it may make things confusing for users.

Don't you think it is better in that case to add "adminClientConf' to producer and roundtrip specs? Which will mean that the user will need to specify security configs multiple times.

@cmccabe

cmccabe commented Mar 23, 2018

Copy link
Copy Markdown
Contributor

Wouldn't common client config have the same issue as you mentioned configuring request timeout differently say for producer and consumer? Or you mean producer or consumer configs will be able to overwrite whatever is in common client config?

Yes, I think the producer and consumer configs should override whatever is in the common client config.

Plus, for your example, we will need to add admin client config to the specs.

Yes, I agree. But that's easy to do. And if the user doesn't specify the admin client config, it just defaults to being empty (doing nothing)

Also, how would people know what to put to common config and what not? I think it may make things confusing for users.

The things that are in the common config should be the things that are common to all clients, like connection settings and so forth. I don't think it's that hard for users. In fact, most users probably would just use the common config for everything, until they start doing something advanced.

Don't you think it is better in that case to add "adminClientConf' to producer and roundtrip specs? Which will mean that the user will need to specify security configs multiple times.

The user won't have to specify the security configuration multiple times. As you described above, the user can just put that in the common configuration.

@apovzner

Copy link
Copy Markdown
Contributor Author

@cmccabe Ok, I agree with common client config approach. I changed this PR to use "commonClientConf" in producer and roundtrip spec. Lets not add adminClientConfig yet until we actually need it? Or you think we need it now?

@cmccabe

cmccabe commented Mar 27, 2018

Copy link
Copy Markdown
Contributor

It might be easier to add adminClientConf now, just so that we can change those settings later if we want without filing a PR. I don't feel strongly about it, though, since we solved the immediate problems

@apovzner

Copy link
Copy Markdown
Contributor Author

@cmccabe I added adminClientConf to both ProducerBench and RoundTripWorkload specs, and using it in WorkerUtils.

@apovzner apovzner changed the title Trogdor: Pulling client security props to AdminClient config Trogdor: Added commonClientConf and adminClientConf to workload specs Mar 30, 2018
@cmccabe

cmccabe commented Apr 2, 2018

Copy link
Copy Markdown
Contributor

Thanks, @apovzner . LGTM

Maybe add producer config and consumer config to RoundTripWorkload, just to make it easy for people later to change those?

@apovzner

apovzner commented Apr 3, 2018

Copy link
Copy Markdown
Contributor Author

@cmccabe I added producerConf and consumerConf to roundtrip workload spec

@cmccabe

cmccabe commented Apr 4, 2018

Copy link
Copy Markdown
Contributor

It seems like RoundTripWorker is not using common client conf to set up producer and consumer configurations?

@apovzner

apovzner commented Apr 4, 2018

Copy link
Copy Markdown
Contributor Author

@cmccabe you are right, I forgot to set common client props in producer and consumer configs in roundtrip worker. Just checked in the fix.

@cmccabe

cmccabe commented Apr 5, 2018

Copy link
Copy Markdown
Contributor

Thanks, @apovzner. LGTM. We could also consider having a utility function to merge two config maps... that might be useful here

@rajinisivaram rajinisivaram left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@apovzner Thanks for the PR. Left a couple of minor comments, apart from that LGTM.

}

protected Map<String, String> configOrEmptyMap(Map<String, String> config) {
return (config == null) ? new TreeMap<String, String>() : config;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could just use Collections.emptyMap()?

props.put(ProducerConfig.CLIENT_ID_CONFIG, "producer." + id);
props.put(ProducerConfig.ACKS_CONFIG, "all");
props.put(ProducerConfig.REQUEST_TIMEOUT_MS_CONFIG, 105000);
// user may over-write the defaults with common client config and consumer config

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consumer => producer?

@rajinisivaram

Copy link
Copy Markdown
Contributor

@apovzner Thanks for the update, merging to trunk.

@rajinisivaram
rajinisivaram merged commit da32db9 into apache:trunk Apr 6, 2018
@apovzner
apovzner deleted the adminclient-security branch April 7, 2018 01:28
ying-zheng pushed a commit to ying-zheng/kafka that referenced this pull request Jul 6, 2018
…apache#4757)

Currently, WorkerUtils will be able to create topics when there is no security. To be able to work with secure kafka, WorkerUtils.createTopic() needs to be able to take security configs. This PR adds commonClientConf field to both producer bench and roundtrip workload specs so that users can specify security and other common configs once for producer/consumer and adminClient. Also added adminClientConf field to workload specs so that users can specify adminClient specific configs if they want to. For completeness, added consumerConf and producerConf to roundtrip workload spec.

Reviewers: Ismael Juma <ismael@juma.me.uk>, Colin P. Mccabe <cmccabe@confluent.io>, Rajini Sivaram <rajinisivaram@googlemail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants