Skip to content
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

Julie doesn't like Placement contraints #241

Closed
Fobhep opened this issue Mar 29, 2021 · 19 comments
Closed

Julie doesn't like Placement contraints #241

Fobhep opened this issue Mar 29, 2021 · 19 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@Fobhep
Copy link
Contributor

Fobhep commented Mar 29, 2021

Describe the bug
I am trying to use Julie together with replica placement contraints and that seems to raise some errors.

To Reproduce

My brokers have the following config:

confluent.log.placement.constraints={"version": 1,"replicas":[{"count": 1,"constraints":{"rack": "rack-1"}},{"count": 1,"constraints":{"rack": "rack-2"}},{"count": 1,"constraints":{"rack": "rack-3"}}]}

So if I create a topic test1 manually - the constraints will be respected:

$ kafka-topics --bootstrap-server broker1:9092 --create --topic testcontstraints
Created topic testcontstraints.

$ kafka-topics --bootstrap-server broker1:9092 --describe --topic testcontstraints
Topic: testcontstraints	PartitionCount: 1	ReplicationFactor: 3	Configs: compression.type=snappy,min.insync.replicas=2,segment.bytes=1073741824,confluent.placement.constraints={"version":1,"replicas":[{"count":1,"constraints":{"rack":"rack-1"}},{"count":1,"constraints":{"rack":"rack-2"}},{"count":1,"constraints":{"rack":"rack-3"}}],"observers":[]}
	Topic: testcontstraints	Partition: 0	Leader: 1	Replicas: 1,2,3	Isr: 1,2,3	Offline: 

However if I create now a topic via julie using the following descriptor:

descriptor.yaml

---
context: "julie"
source: "test"
projects:
  - name: "schulung"
    topics:
      - name: "constraints"

Sadly the constraints seem not to be respected:

$ kafka-topics --bootstrap-server broker1:9092 --describe --topic julie.test.schulung.constraints

Topic: julie.test.schulung.constraints	PartitionCount: 3	ReplicationFactor: 2	Configs: compression.type=snappy,min.insync.replicas=2,segment.bytes=1073741824
	Topic: julie.test.schulung.constraints	Partition: 0	Leader: 2	Replicas: 2,3	Isr: 2,3	Offline: 
	Topic: julie.test.schulung.constraints	Partition: 1	Leader: 3	Replicas: 3,1	Isr: 3,1	Offline: 
	Topic: julie.test.schulung.constraints	Partition: 2	Leader: 1	Replicas: 1,2	Isr: 1,2	Offline: 

If I go further and try to force a constraint on the topic descriptor like this:

---
context: "julie"
source: "test"
projects:
  - name: "schulung"
    topics:
      - name: "constraints2"
        config:
          confluent.placement.constraints: '{"version": 1,"replicas":[{"count": 1,"constraints":{"rack": "rack-1"}},{"count": 1,"constraints":{"rack": "rack-2"}},{"count": 1,"constraints":{"rack": "rack-3"}}]}'

I get this error

julie-ops --brokers broker1:9092 --clientConfig prod.properties --topology descriptor4.yaml
[INFO ] 2021-03-29 23:31:56.867 [main] TopologyBuilderAdminClientBuilder - Connecting AdminClient to broker:9092
[INFO ] 2021-03-29 23:31:56.867 [main] TopologyBuilderAdminClientBuilder - Connecting AdminClient to broker1:9092
log4j:WARN No appenders could be found for logger (org.apache.kafka.clients.admin.AdminClientConfig).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
[ERROR] 2021-03-29 23:31:59.632 [main] TopologyBuilderAdminClient - java.util.concurrent.ExecutionException: org.apache.kafka.common.errors.InvalidRequestException: Both replicationFactor and confluent.placement.constraints are set. Both cannot be used at the same time.
[ERROR] 2021-03-29 23:31:59.632 [main] TopologyBuilderAdminClient - java.util.concurrent.ExecutionException: org.apache.kafka.common.errors.InvalidRequestException: Both replicationFactor and confluent.placement.constraints are set. Both cannot be used at the same time.
[ERROR] 2021-03-29 23:31:59.634 [main] ExecutionPlan - Something happen running action {
  "Action" : "create",
  "Operation" : "com.purbon.kafka.topology.actions.topics.SyncTopicAction",
  "Topic" : "julie.test.schulung.constraints2"
}
java.io.IOException: java.util.concurrent.ExecutionException: org.apache.kafka.common.errors.InvalidRequestException: Both replicationFactor and confluent.placement.constraints are set. Both cannot be used at the same time.
	at com.purbon.kafka.topology.api.adminclient.TopologyBuilderAdminClient.createTopic(TopologyBuilderAdminClient.java:196) ~[julie-ops.jar:?]
	at com.purbon.kafka.topology.actions.topics.SyncTopicAction.syncTopic(SyncTopicAction.java:60) ~[julie-ops.jar:?]
	at com.purbon.kafka.topology.actions.topics.SyncTopicAction.run(SyncTopicAction.java:46) ~[julie-ops.jar:?]
	at com.purbon.kafka.topology.ExecutionPlan.execute(ExecutionPlan.java:88) ~[julie-ops.jar:?]
	at com.purbon.kafka.topology.ExecutionPlan.run(ExecutionPlan.java:69) [julie-ops.jar:?]
	at com.purbon.kafka.topology.JulieOps.run(JulieOps.java:189) [julie-ops.jar:?]
	at com.purbon.kafka.topology.JulieOps.run(JulieOps.java:201) [julie-ops.jar:?]
	at com.purbon.kafka.topology.CommandLineInterface.processTopology(CommandLineInterface.java:196) [julie-ops.jar:?]
	at com.purbon.kafka.topology.CommandLineInterface.run(CommandLineInterface.java:144) [julie-ops.jar:?]
	at com.purbon.kafka.topology.CommandLineInterface.main(CommandLineInterface.java:134) [julie-ops.jar:?]
Caused by: java.util.concurrent.ExecutionException: org.apache.kafka.common.errors.InvalidRequestException: Both replicationFactor and confluent.placement.constraints are set. Both cannot be used at the same time.
	at org.apache.kafka.common.internals.KafkaFutureImpl.wrapAndThrow(KafkaFutureImpl.java:45) ~[julie-ops.jar:?]
	at org.apache.kafka.common.internals.KafkaFutureImpl.access$000(KafkaFutureImpl.java:32) ~[julie-ops.jar:?]
	at org.apache.kafka.common.internals.KafkaFutureImpl$SingleWaiter.await(KafkaFutureImpl.java:89) ~[julie-ops.jar:?]
	at org.apache.kafka.common.internals.KafkaFutureImpl.get(KafkaFutureImpl.java:260) ~[julie-ops.jar:?]
	at com.purbon.kafka.topology.api.adminclient.TopologyBuilderAdminClient.createAllTopics(TopologyBuilderAdminClient.java:202) ~[julie-ops.jar:?]
	at com.purbon.kafka.topology.api.adminclient.TopologyBuilderAdminClient.createTopic(TopologyBuilderAdminClient.java:191) ~[julie-ops.jar:?]
	... 9 more
Caused by: org.apache.kafka.common.errors.InvalidRequestException: Both replicationFactor and confluent.placement.constraints are set. Both cannot be used at the same time.
[ERROR] 2021-03-29 23:31:59.634 [main] ExecutionPlan - Something happen running action {
  "Action" : "create",
  "Operation" : "com.purbon.kafka.topology.actions.topics.SyncTopicAction",
  "Topic" : "julie.test.schulung.constraints2"
}
java.io.IOException: java.util.concurrent.ExecutionException: org.apache.kafka.common.errors.InvalidRequestException: Both replicationFactor and confluent.placement.constraints are set. Both cannot be used at the same time.
	at com.purbon.kafka.topology.api.adminclient.TopologyBuilderAdminClient.createTopic(TopologyBuilderAdminClient.java:196) ~[julie-ops.jar:?]
	at com.purbon.kafka.topology.actions.topics.SyncTopicAction.syncTopic(SyncTopicAction.java:60) ~[julie-ops.jar:?]
	at com.purbon.kafka.topology.actions.topics.SyncTopicAction.run(SyncTopicAction.java:46) ~[julie-ops.jar:?]
	at com.purbon.kafka.topology.ExecutionPlan.execute(ExecutionPlan.java:88) ~[julie-ops.jar:?]
	at com.purbon.kafka.topology.ExecutionPlan.run(ExecutionPlan.java:69) [julie-ops.jar:?]
	at com.purbon.kafka.topology.JulieOps.run(JulieOps.java:189) [julie-ops.jar:?]
	at com.purbon.kafka.topology.JulieOps.run(JulieOps.java:201) [julie-ops.jar:?]
	at com.purbon.kafka.topology.CommandLineInterface.processTopology(CommandLineInterface.java:196) [julie-ops.jar:?]
	at com.purbon.kafka.topology.CommandLineInterface.run(CommandLineInterface.java:144) [julie-ops.jar:?]
	at com.purbon.kafka.topology.CommandLineInterface.main(CommandLineInterface.java:134) [julie-ops.jar:?]
Caused by: java.util.concurrent.ExecutionException: org.apache.kafka.common.errors.InvalidRequestException: Both replicationFactor and confluent.placement.constraints are set. Both cannot be used at the same time.
	at org.apache.kafka.common.internals.KafkaFutureImpl.wrapAndThrow(KafkaFutureImpl.java:45) ~[julie-ops.jar:?]
	at org.apache.kafka.common.internals.KafkaFutureImpl.access$000(KafkaFutureImpl.java:32) ~[julie-ops.jar:?]
	at org.apache.kafka.common.internals.KafkaFutureImpl$SingleWaiter.await(KafkaFutureImpl.java:89) ~[julie-ops.jar:?]
	at org.apache.kafka.common.internals.KafkaFutureImpl.get(KafkaFutureImpl.java:260) ~[julie-ops.jar:?]
	at com.purbon.kafka.topology.api.adminclient.TopologyBuilderAdminClient.createAllTopics(TopologyBuilderAdminClient.java:202) ~[julie-ops.jar:?]
	at com.purbon.kafka.topology.api.adminclient.TopologyBuilderAdminClient.createTopic(TopologyBuilderAdminClient.java:191) ~[julie-ops.jar:?]
	... 9 more
Caused by: org.apache.kafka.common.errors.InvalidRequestException: Both replicationFactor and confluent.placement.constraints are set. Both cannot be used at the same time.
Exception in thread "main" java.io.IOException: java.util.concurrent.ExecutionException: org.apache.kafka.common.errors.InvalidRequestException: Both replicationFactor and confluent.placement.constraints are set. Both cannot be used at the same time.
	at com.purbon.kafka.topology.api.adminclient.TopologyBuilderAdminClient.createTopic(TopologyBuilderAdminClient.java:196)
	at com.purbon.kafka.topology.actions.topics.SyncTopicAction.syncTopic(SyncTopicAction.java:60)
	at com.purbon.kafka.topology.actions.topics.SyncTopicAction.run(SyncTopicAction.java:46)
	at com.purbon.kafka.topology.ExecutionPlan.execute(ExecutionPlan.java:88)
	at com.purbon.kafka.topology.ExecutionPlan.run(ExecutionPlan.java:69)
	at com.purbon.kafka.topology.JulieOps.run(JulieOps.java:189)
	at com.purbon.kafka.topology.JulieOps.run(JulieOps.java:201)
	at com.purbon.kafka.topology.CommandLineInterface.processTopology(CommandLineInterface.java:196)
	at com.purbon.kafka.topology.CommandLineInterface.run(CommandLineInterface.java:144)
	at com.purbon.kafka.topology.CommandLineInterface.main(CommandLineInterface.java:134)
Caused by: java.util.concurrent.ExecutionException: org.apache.kafka.common.errors.InvalidRequestException: Both replicationFactor and confluent.placement.constraints are set. Both cannot be used at the same time.
	at org.apache.kafka.common.internals.KafkaFutureImpl.wrapAndThrow(KafkaFutureImpl.java:45)
	at org.apache.kafka.common.internals.KafkaFutureImpl.access$000(KafkaFutureImpl.java:32)
	at org.apache.kafka.common.internals.KafkaFutureImpl$SingleWaiter.await(KafkaFutureImpl.java:89)
	at org.apache.kafka.common.internals.KafkaFutureImpl.get(KafkaFutureImpl.java:260)
	at com.purbon.kafka.topology.api.adminclient.TopologyBuilderAdminClient.createAllTopics(TopologyBuilderAdminClient.java:202)
	at com.purbon.kafka.topology.api.adminclient.TopologyBuilderAdminClient.createTopic(TopologyBuilderAdminClient.java:191)
	... 9 more
Caused by: org.apache.kafka.common.errors.InvalidRequestException: Both replicationFactor and confluent.placement.constraints are set. Both cannot be used at the same time.





@Fobhep Fobhep added the bug Something isn't working label Mar 29, 2021
@Fobhep
Copy link
Contributor Author

Fobhep commented Mar 29, 2021

Update:

I got curious and did some more digging:

We start again using a "plain" descriptor

---
context: "julie"
source: "test"
projects:
  - name: "schulung"
    topics:
      - name: "constraints3"

That won't get any constraint settings

Topic: julie.test.schulung.constraints3	PartitionCount: 3	ReplicationFactor: 2	Configs: compression.type=snappy,min.insync.replicas=2,segment.bytes=1073741824
	Topic: julie.test.schulung.constraints3	Partition: 0	Leader: 1	Replicas: 1,2	Isr: 1,2	Offline: 
	Topic: julie.test.schulung.constraints3	Partition: 1	Leader: 2	Replicas: 2,3	Isr: 2,3	Offline: 
	Topic: julie.test.schulung.constraints3	Partition: 2	Leader: 3	Replicas: 3,1	Isr: 3,1	Offline:

Now I add the following to the very same descriptor:

---
context: "julie"
source: "test"
projects:
  - name: "schulung"
    topics:
      - name: "constraints3"
        config:
          confluent.placement.constraints: '{"version": 1,"replicas":[{"count": 1,"constraints":{"rack": "rack-1"}},{"count": 1,"constraints":{"rack": "rack-2"}},{"count": 1,"constraints":{"rack": "rack-3"}}]}'

And rerun julie and voila:

Topic: julie.test.schulung.constraints3 PartitionCount: 3	ReplicationFactor: 2	Configs: compression.type=snappy,min.insync.replicas=2,segment.bytes=1073741824,confluent.placement.constraints={"version": 1,"replicas":[{"count": 1,"constraints":{"rack": "rack-1"}},{"count": 1,"constraints":{"rack": "rack-2"}},{"count": 1,"constraints":{"rack": "rack-3"}}]}
	Topic: julie.test.schulung.constraints3	Partition: 0	Leader: 1	Replicas: 1,2	Isr: 1,2	Offline: 
	Topic: julie.test.schulung.constraints3	Partition: 1	Leader: 2	Replicas: 2,3	Isr: 2,3	Offline: 
	Topic: julie.test.schulung.constraints3	Partition: 2	Leader: 3	Replicas: 3,1	Isr: 3,1	Offline: 

Hope that helps somehow in finding the error 😅

@Fobhep Fobhep changed the title Julie doesn't like Placement contraints Julie doesn't like Placement contraints (Edit: and does not respect default replicator factor) Mar 29, 2021
@Fobhep
Copy link
Contributor Author

Fobhep commented Mar 29, 2021

another update - I do realize now also that Julie uses not the default replicator factor that is set in the broker - in contrast to the manual topic creation

default.replication.factor=3

@purbon
Copy link
Collaborator

purbon commented Mar 30, 2021

Hi @Fobhep, thanks for reporting this. FYI: we never tested this tool with Confluent replica placements, so the behaviour and thought are completely green field.

@purbon
Copy link
Collaborator

purbon commented Mar 30, 2021

another update - I do realize now also that Julie uses not the default replicator factor that is set in the broker - in contrast to the manual topic creation

yap, this is true. Do you think it would be better to rely on cluster defaults?

@purbon purbon added the enhancement New feature or request label Mar 30, 2021
@Fobhep
Copy link
Contributor Author

Fobhep commented Mar 30, 2021

ok so - I would then open another issue to discuss the defaults 😅 and we can leave this one open for the constraints

@Fobhep Fobhep changed the title Julie doesn't like Placement contraints (Edit: and does not respect default replicator factor) Julie doesn't like Placement contraints Mar 30, 2021
@purbon
Copy link
Collaborator

purbon commented Mar 30, 2021 via email

@purbon
Copy link
Collaborator

purbon commented Mar 31, 2021

Moin,
as mentioned in #243, I have merged all recent changes in. The error mentioned in this issue looks is mainly:

Caused by: org.apache.kafka.common.errors.InvalidRequestException: Both replicationFactor and confluent.placement.constraints are set. Both cannot be used at the same time.

with merge if #243, there not anymore the always on use of replicationFactor and partitionCount, this makes me thing now this would work as expected. Do you mind testing this for me? that would be very much appreciated.

You can find the latest releases (nightly build) here:

nightly build: https://github.com/kafka-ops/julie/actions/runs/704912720

As well as in docker hub https://hub.docker.com/repository/docker/purbon/kafka-topology-builder (latest tag).

Thanks again for all your help!

-- Pere

@Fobhep
Copy link
Contributor Author

Fobhep commented Apr 8, 2021

Ola - so I had now the time to do some test.
Sadly I can't get even far enough to test the fixes since I run into an error before it.

This is my properties file:

bootstrap.servers=test-broker:9092
security.protocol=SASL_SSL
ssl.truststore.location=truststore1.jks
ssl.truststore.password=confluenttruststorepass
sasl.mechanism=OAUTHBEARER
sasl.login.callback.handler.class=io.confluent.kafka.clients.plugins.auth.token.TokenUserLoginCallbackHandler
sasl.jaas.config=org.apache.kafka.common.security.oauthbearer.OAuthBearerLoginModule required \
   username="user1" password="1234" \
   metadataServerUrls="https://test-broker:8090";"


topology.builder.access.control.class = com.purbon.kafka.topology.roles.RBACProvider

schema.registry.url=https://schemareg:8081
topology.builder.mds.server="https://test-broker:8090"
topology.builder.mds.user=user1
topology.builder.mds.password=1234
topology.builder.mds.kafka.cluster.id=si_UknHhSFil86r51ewzgA
topology.builder.mds.kafka.connect.cluster.id=connect-cluster
topology.builder.mds.schema.registry.cluster.id=schema-registry

I try to deploy this topology:

---
context: "julie"
source: "test"
projects:
  - name: "schulung"
    topics:
      - name: "constraints"

And this is the error I receive:

og4j:WARN No appenders could be found for logger (org.apache.kafka.clients.admin.AdminClientConfig).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" org.apache.kafka.common.KafkaException: Failed to create new KafkaAdminClient
	at org.apache.kafka.clients.admin.KafkaAdminClient.createInternal(KafkaAdminClient.java:535)
	at org.apache.kafka.clients.admin.Admin.create(Admin.java:65)
	at org.apache.kafka.clients.admin.AdminClient.create(AdminClient.java:39)
	at com.purbon.kafka.topology.api.adminclient.TopologyBuilderAdminClientBuilder.build(TopologyBuilderAdminClientBuilder.java:28)
	at com.purbon.kafka.topology.JulieOps.build(JulieOps.java:67)
	at com.purbon.kafka.topology.CommandLineInterface.processTopology(CommandLineInterface.java:195)
	at com.purbon.kafka.topology.CommandLineInterface.run(CommandLineInterface.java:144)
	at com.purbon.kafka.topology.CommandLineInterface.main(CommandLineInterface.java:134)
Caused by: org.apache.kafka.common.KafkaException: java.lang.NoSuchMethodError: org.apache.kafka.common.security.ssl.DefaultSslEngineFactory.castOrThrow(Lorg/apache/kafka/common/security/auth/SslEngineFactory;)Lorg/apache/kafka/common/security/ssl/DefaultSslEngineFactory;
	at org.apache.kafka.common.network.SaslChannelBuilder.configure(SaslChannelBuilder.java:172)
	at org.apache.kafka.common.network.ChannelBuilders.create(ChannelBuilders.java:157)
	at org.apache.kafka.common.network.ChannelBuilders.clientChannelBuilder(ChannelBuilders.java:73)
	at org.apache.kafka.clients.ClientUtils.createChannelBuilder(ClientUtils.java:105)
	at org.apache.kafka.clients.admin.KafkaAdminClient.createInternal(KafkaAdminClient.java:508)
	... 7 more
Caused by: java.lang.NoSuchMethodError: org.apache.kafka.common.security.ssl.DefaultSslEngineFactory.castOrThrow(Lorg/apache/kafka/common/security/auth/SslEngineFactory;)Lorg/apache/kafka/common/security/ssl/DefaultSslEngineFactory;
	at io.confluent.security.auth.client.rest.RestClient.createSslSocketFactory(RestClient.java:176)
	at io.confluent.security.auth.client.rest.RestClient.<init>(RestClient.java:126)
	at io.confluent.security.auth.client.rest.RestClient.<init>(RestClient.java:96)
	at io.confluent.kafka.clients.plugins.auth.token.TokenUserLoginCallbackHandler.configure(TokenUserLoginCallbackHandler.java:67)
	at io.confluent.kafka.clients.plugins.auth.token.AbstractTokenLoginCallbackHandler.configure(AbstractTokenLoginCallbackHandler.java:86)
	at org.apache.kafka.common.security.authenticator.LoginManager.<init>(LoginManager.java:60)
	at org.apache.kafka.common.security.authenticator.LoginManager.acquireLoginManager(LoginManager.java:105)
	at org.apache.kafka.common.network.SaslChannelBuilder.configure(SaslChannelBuilder.java:158)
	... 11 more

I can use the exact same properties file! without any problems with builtin kafka-admin-tools like kafka-console-producer et al

@Fobhep
Copy link
Contributor Author

Fobhep commented Apr 8, 2021

Update: I changed my cluster to GSSAPI and retried testing:

bootstrap.servers="test-broker:9092"

security.protocol=SASL_SSL
ssl.truststore.location=/var/ssl/private/kafka_broker.truststore.jks
ssl.truststore.password=confluenttruststorepass
sasl.mechanism=GSSAPI
sasl.kerberos.service.name=kafka
sasl.jaas.config="com.sun.security.auth.module.Krb5LoginModule required \
   useKeyTab=true storeKey=true keyTab="/etc/security/keytabs/kafka-broker1.keytab" \
   principal="kafka/test-broker:9092@REALM";"


topology.builder.access.control.class = com.purbon.kafka.topology.roles.RBACProvider
schema.registry.url=https://schemareg:8081
topology.builder.mds.server="https://test-broker:8090"
topology.builder.mds.user=user1
topology.builder.mds.password=1234
topology.builder.mds.kafka.cluster.id=si_UknHhSFil86r51ewzgA
topology.builder.mds.kafka.connect.cluster.id=connect-cluster
topology.builder.mds.schema.registry.cluster.id=schema-registry

Again builtin admin-client tools work just fine.

Julie:

log4j:WARN No appenders could be found for logger (org.apache.kafka.clients.admin.AdminClientConfig).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" org.apache.kafka.common.KafkaException: Failed to create new KafkaAdminClient
	at org.apache.kafka.clients.admin.KafkaAdminClient.createInternal(KafkaAdminClient.java:535)
	at org.apache.kafka.clients.admin.Admin.create(Admin.java:65)
	at org.apache.kafka.clients.admin.AdminClient.create(AdminClient.java:39)
	at com.purbon.kafka.topology.api.adminclient.TopologyBuilderAdminClientBuilder.build(TopologyBuilderAdminClientBuilder.java:28)
	at com.purbon.kafka.topology.JulieOps.build(JulieOps.java:66)
	at com.purbon.kafka.topology.CommandLineInterface.processTopology(CommandLineInterface.java:195)
	at com.purbon.kafka.topology.CommandLineInterface.run(CommandLineInterface.java:144)
	at com.purbon.kafka.topology.CommandLineInterface.main(CommandLineInterface.java:134)
Caused by: java.lang.IllegalArgumentException: Login module control flag not specified in JAAS config
	at org.apache.kafka.common.security.JaasConfig.parseAppConfigurationEntry(JaasConfig.java:110)
	at org.apache.kafka.common.security.JaasConfig.<init>(JaasConfig.java:63)
	at org.apache.kafka.common.security.JaasContext.load(JaasContext.java:88)
	at org.apache.kafka.common.security.JaasContext.loadClientContext(JaasContext.java:82)
	at org.apache.kafka.common.network.ChannelBuilders.create(ChannelBuilders.java:134)
	at org.apache.kafka.common.network.ChannelBuilders.clientChannelBuilder(ChannelBuilders.java:73)
	at org.apache.kafka.clients.ClientUtils.createChannelBuilder(ClientUtils.java:105)
	at org.apache.kafka.clients.admin.KafkaAdminClient.createInternal(KafkaAdminClient.java:508)
	... 7 more

@purbon
Copy link
Collaborator

purbon commented Apr 29, 2021

@Fobhep I tried reproducing your SSL issue in my environment, however, I can't seem to manage to do it. I setup an RBAC on TLS cluster, installed in another redhat machine the lastest julie release 2.1.0.

and all 🍏

julie-ops --brokers kafka.operator.purbon.de:9092 --clientConfig topology-builder-rbac-tls.properties --topology descriptor.yml
[INFO ] 2021-04-29 10:53:44.702 [main] TopologyBuilderAdminClientBuilder - Connecting AdminClient to kafka.operator.purbon.de:9092
[INFO ] 2021-04-29 10:53:44.702 [main] TopologyBuilderAdminClientBuilder - Connecting AdminClient to kafka.operator.purbon.de:9092
log4j:WARN No appenders could be found for logger (org.apache.kafka.clients.admin.AdminClientConfig).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
[INFO ] 2021-04-29 10:53:46.025 [main] MDSApiClientBuilder - Connecting to an MDS server at https://kafka.operator.purbon.de:443
[INFO ] 2021-04-29 10:53:46.025 [main] MDSApiClientBuilder - Connecting to an MDS server at https://kafka.operator.purbon.de:443
[INFO ] 2021-04-29 10:53:46.025 [main] MDSApiClientBuilder - Connecting to an MDS server at https://kafka.operator.purbon.de:443
[INFO ] 2021-04-29 10:53:46.184 [main] MDSApiClientBuilder - Connecting to an MDS server at https://kafka.operator.purbon.de:443
[INFO ] 2021-04-29 10:53:46.184 [main] MDSApiClientBuilder - Connecting to an MDS server at https://kafka.operator.purbon.de:443
[INFO ] 2021-04-29 10:53:46.184 [main] MDSApiClientBuilder - Connecting to an MDS server at https://kafka.operator.purbon.de:443
List of Topics:
_confluent-controlcenter-0-MetricsAggregateStore-repartition
_confluent-controlcenter-0-MonitoringMessageAggregatorWindows-THREE_HOURS-changelog
operator.connectors-configs
_confluent-controlcenter-0-aggregatedTopicPartitionTableWindows-ONE_MINUTE-changelog
_confluent-controlcenter-0-KSTREAM-OUTEROTHER-0000000106-store-repartition
_confluent-controlcenter-0-TriggerEventsStore-repartition
_confluent-license
_confluent-controlcenter-0-Group-ONE_MINUTE-changelog
_confluent-controlcenter-0-MonitoringStream-THREE_HOURS-repartition
context.foo.foo
_confluent-controlcenter-0-aggregate-topic-partition-store-changelog
_confluent-controlcenter-0-MonitoringMessageAggregatorWindows-ONE_MINUTE-repartition
_confluent-controlcenter-0-AlertHistoryStore-repartition
operator.connectors-status
_confluent-controlcenter-0-MonitoringStream-ONE_MINUTE-repartition
_confluent-controlcenter-0-monitoring-message-rekey-store
_confluent-metrics
_confluent-controlcenter-0-TriggerEventsStore-changelog
_confluent-controlcenter-0-aggregate-topic-partition-store-repartition
_confluent-controlcenter-0-MonitoringMessageAggregatorWindows-ONE_MINUTE-changelog
_confluent-controlcenter-0-aggregatedTopicPartitionTableWindows-THREE_HOURS-changelog
_confluent-controlcenter-0-MonitoringTriggerStore-changelog
_confluent-controlcenter-0-MonitoringVerifierStore-repartition
_confluent-metadata-auth
_confluent-controlcenter-0-Group-THREE_HOURS-repartition
_confluent-controlcenter-0-group-aggregate-store-ONE_MINUTE-repartition
_confluent-command
_confluent-controlcenter-0-aggregatedTopicPartitionTableWindows-ONE_MINUTE-repartition
_confluent-controlcenter-0-MonitoringTriggerStore-repartition
_confluent-controlcenter-0-Group-THREE_HOURS-changelog
_confluent-controlcenter-0-TriggerActionsStore-repartition
operator.connectors-offsets
.... redacted...
_confluent-monitoring
_confluent-telemetry-metrics
List of ACLs:
List of Principles:
Kafka Topology updated

i guess you do as well, and the error reported is certainly not related, but I pass the SSL keystores globally for the MDS server like this.

export JULIE_OPS_OPTIONS=-Djavax.net.ssl.keyStore=/tmp/keystore.jks -Djavax.net.ssl.keyStorePassword=password -Djavax.net.ssl.trustStore=/tmp/truststore.jks -Djavax.net.ssl.trustStorePassword=password

property file is very similar to yours.

topology.builder.access.control.class = com.purbon.kafka.topology.roles.RBACProvider
topology.builder.mds.server = https://kafka.operator.purbon.de:443
topology.builder.mds.user = kafka
topology.builder.mds.password = kafka-secret
topology.builder.mds.kafka.cluster.id = <cluster-id>

topology.builder.mds.schema.registry.cluster.id = schema-registry-cluster
topology.builder.mds.kafka.connect.cluster.id = connect-cluster

security.protocol=SSL
ssl.truststore.location=/tmp/truststore.jks
ssl.truststore.password=password
ssl.keystore.location=/tmp/keystore.jks
ssl.keystore.password=password

The error mentioned it really looks as a dependency is missing, but it would as well fail on my test as I did.

java.lang.NoSuchMethodError: org.apache.kafka.common.security.ssl.DefaultSslEngineFactory.castOrThrow(Lorg/apache/kafka/common/security/auth/SslEngineFactory;)Lorg/apache/kafka/common/security/ssl/DefaultSslEngineFactory;
	at io.confluent.security.auth.client.rest.RestClient.createSslSocketFactory(RestClient.java:176)

how does the call you do look like? which version are you using? java version?

@purbon
Copy link
Collaborator

purbon commented Apr 29, 2021

I guess I see where the error might come, I am testing with pure SSL, but you are using OAUTHBEARER.

sasl.mechanism=OAUTHBEARER
sasl.login.callback.handler.class=io.confluent.kafka.clients.plugins.auth.token.TokenUserLoginCallbackHandler
sasl.jaas.config=org.apache.kafka.common.security.oauthbearer.OAuthBearerLoginModule required \
   username="user1" password="1234" \
   metadataServerUrls="https://test-broker:8090";"

@purbon
Copy link
Collaborator

purbon commented Apr 29, 2021

I am able to reproduce the problem with the OAUTH config you provided.

Caused by: org.apache.kafka.common.KafkaException: java.lang.NoSuchMethodError: org.apache.kafka.common.security.ssl.DefaultSslEngineFactory.castOrThrow(Lorg/apache/kafka/common/security/auth/SslEngineFactory;)Lorg/apache/kafka/common/security/ssl/DefaultSslEngineFactory;
	at org.apache.kafka.common.network.SaslChannelBuilder.configure(SaslChannelBuilder.java:172)
	at org.apache.kafka.common.network.ChannelBuilders.create(ChannelBuilders.java:157)
	at org.apache.kafka.common.network.ChannelBuilders.clientChannelBuilder(ChannelBuilders.java:73)
	at org.apache.kafka.clients.ClientUtils.createChannelBuilder(ClientUtils.java:105)
	at org.apache.kafka.clients.admin.KafkaAdminClient.createInternal(KafkaAdminClient.java:508)
	... 7 more
Caused by: java.lang.NoSuchMethodError: org.apache.kafka.common.security.ssl.DefaultSslEngineFactory.castOrThrow(Lorg/apache/kafka/common/security/auth/SslEngineFactory;)Lorg/apache/kafka/common/security/ssl/DefaultSslEngineFactory;
	at io.confluent.security.auth.client.rest.RestClient.createSslSocketFactory(RestClient.java:176)
	at io.confluent.security.auth.client.rest.RestClient.<init>(RestClient.java:126)
	at io.confluent.security.auth.client.rest.RestClient.<init>(RestClient.java:96)
	at io.confluent.kafka.clients.plugins.auth.token.TokenUserLoginCallbackHandler.configure(TokenUserLoginCallbackHandler.java:67)
	at io.confluent.kafka.clients.plugins.auth.token.AbstractTokenLoginCallbackHandler.configure(AbstractTokenLoginCallbackHandler.java:86)

investigating

@purbon
Copy link
Collaborator

purbon commented Apr 29, 2021

problem looks to be introduced by 402553e and the shading process after it to build the final fat jar.

@purbon
Copy link
Collaborator

purbon commented Apr 30, 2021

@Fobhep I was able to sort out the problem you experienced here and I fixed them f2cd0c5 the RCA was a dependency problem, from 5.5 to 6.0 the SSL dependencies changes, so i now use all the jars coming out of confluent directly to avoid any problem with and RBAC usage.

This should be fixed with the previously commented commit, I will close this for now, feel free to reopen if necessary. NOTE: this fix will be available in the next bug fix release available in the normal channels.

@purbon purbon closed this as completed Apr 30, 2021
@Fobhep
Copy link
Contributor Author

Fobhep commented May 12, 2021

@purbon I retested this and sadly also in Julie version 2.1.2 Julie is not accepting globally set placements contraints.

kafka-topics --bootstrap-server broker:9092 --command-config client.properties --create --topic test

kafka-topics --bootstrap-server broker:9092 --command-config client.properties --describe --topic test


Topic: test	PartitionCount: 1	ReplicationFactor: 3	Configs: compression.type=snappy,min.insync.replicas=2,segment.bytes=1073741824,confluent.placement.constraints={"version":1,"replicas":[{"count":1,"constraints":{"rack":"rack-1"}},{"count":1,"constraints":{"rack":"rack-2"}},{"count":1,"constraints":{"rack":"rack-3"}}],"observers":[]}
Topic: test	Partition: 0	Leader: 1	Replicas: 1,2,3	Isr: 1,2,3	Offline: 

descriptor.yaml

---
context: "test"
source: "julie"
projects:
  - name: "project1"
    topics:
      - name: "topic1"

kafka-topics --bootstrap-server broker:9092 --command-config client.properties --describe --topic test.julie.project1.topic1

Topic: test.julie.project1.topic1	PartitionCount: 1	ReplicationFactor: 3	Configs: compression.type=snappy,min.insync.replicas=2,segment.bytes=1073741824
Topic: test.julie.project1.topic1	Partition: 0	Leader: 1	Replicas: 1,2,3	Isr: 1,2,3	Offline: 

@purbon purbon reopened this May 12, 2021
@purbon
Copy link
Collaborator

purbon commented May 12, 2021

@Fobhep do you see any particular error from julie ?

@Fobhep
Copy link
Contributor Author

Fobhep commented May 12, 2021

no errors - nope

@Fobhep
Copy link
Contributor Author

Fobhep commented May 14, 2021

@purbon let me know if you have any specific suggestions on how to turn on debug log for Julie that would provide more information

@purbon
Copy link
Collaborator

purbon commented Aug 3, 2022

I did a test with the latest version of Julie, using

---
context: "o"
projects:
  - name: "f"
    consumers:
      - principal: "User:NewApp2"
    topics:
      - name: "t"
        config:
          confluent.placement.constraints:  "{\"version\":1,\"replicas\":[{\"count\":1,\"constraints\":{\"rack\":\"rack-1\"}},{\"count\":1,\"constraints\":{\"rack\":\"rack-2\"}}],\"observers\":[]}"

and you can see the placement constraints properly set.

$ docker exec kafka kafka-topics --bootstrap-server kafka:29092 \                                                        2.7.0
                  --describe --topic o.f.t
Topic: o.f.t	TopicId: dJImanTbSd2sbUjLVDMoVA	PartitionCount: 1	ReplicationFactor: 2	Configs: confluent.placement.constraints={"version":1,"replicas":[{"count":1,"constraints":{"rack":"rack-1"}},{"count":1,"constraints":{"rack":"rack-2"}}],"observers":[]}
	Topic: o.f.t	Partition: 0	Leader: 1	Replicas: 1,2	Isr: 1,2	Offline:

I do have the feeling this was caused when Julie use to send a specific replication factor, but now when not configured, as seen in the example, all set as expected.

As you can see when using this topology:

---
context: "o"
projects:
  - name: "f"
    consumers:
      - principal: "User:NewApp2"
    topics:
      - name: "b"
        config:
          replication.factor: "1"
          confluent.placement.constraints:  "{\"version\":1,\"replicas\":[{\"count\":1,\"constraints\":{\"rack\":\"rack-1\"}},{\"count\":1,\"constraints\":{\"rack\":\"rack-2\"}}],\"observers\":[]}"

that causes this error:

re set. Both cannot be used at the same time.
java.io.IOException: java.util.concurrent.ExecutionException: org.apache.kafka.common.errors.InvalidRequestException: Both replicationFactor and confluent.placement.constraints are set. Both cannot be used at the same time.
	at com.purbon.kafka.topology.api.adminclient.TopologyBuilderAdminClient.createTopic(TopologyBuilderAdminClient.java:200)
	at com.purbon.kafka.topology.actions.topics.CreateTopicAction.createTopic(CreateTopicAction.java:41)
	at com.purbon.kafka.topology.actions.topics.CreateTopicAction.run(CreateTopicAction.java:36)
	at com.purbon.kafka.topology.ExecutionPlan.execute(ExecutionPlan.java:126)
	at com.purbon.kafka.topology.ExecutionPlan.run(ExecutionPlan.java:101)
	at com.purbon.kafka.topology.JulieOps.run(JulieOps.java:212)
	at com.purbon.kafka.topology.JulieOps.run(JulieOps.java:227)
	at com.purbon.kafka.topology.CommandLineInterface.processTopology(CommandLineInterface.java:212)
	at com.purbon.kafka.topology.CommandLineInterface.run(CommandLineInterface.java:161)
	at com.purbon.kafka.topology.CommandLineInterface.main(CommandLineInterface.java:147)
Caused by: java.util.concurrent.ExecutionException: org.apache.kafka.common.errors.InvalidRequestException: Both replicationFactor and confluent.placement.constraints are set. Both cannot be used at the same time.
	at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:395)
	at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1999)
	at org.apache.kafka.common.internals.KafkaFutureImpl.get(KafkaFutureImpl.java:165)
	at com.purbon.kafka.topology.api.adminclient.TopologyBuilderAdminClient.createAllTopics(TopologyBuilderAdminClient.java:211)
	at com.purbon.kafka.topology.api.adminclient.TopologyBuilderAdminClient.createTopic(TopologyBuilderAdminClient.java:193)
	... 9 more
Caused by: org.apache.kafka.common.errors.InvalidRequestException: Both replicationFactor and confluent.placement.constraints are set. Both cannot be used at the same time.

as seen in this issue.

closing this issue for now, feel free to reopen if necessary.

@purbon purbon closed this as completed Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants