Skip to content

[LIVY-1042] Add SSL/TLS support for ZooKeeper connection#523

Open
roczei wants to merge 2 commits into
apache:masterfrom
roczei:LIVY-1042
Open

[LIVY-1042] Add SSL/TLS support for ZooKeeper connection#523
roczei wants to merge 2 commits into
apache:masterfrom
roczei:LIVY-1042

Conversation

@roczei

@roczei roczei commented May 27, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Introduced an optional TLS encryption for the Curator based ZooKeeper client used during session recovery.

Changes by Asif Khatri:

  • Added five LivyConf entries (LIVY_ZK_CLIENT_SECURE, LIVY_ZK_CLIENT_SOCKET, LIVY_ZK_KEYSTORE_PASS, LIVY_ZK_TRUSTSTORE_FILE, LIVY_ZK_TRUSTSTORE_PASS) and document them in livy.conf.template.
  • Added ZooKeeperManager.createZKClientConfig that assembles a ZKClientConfig from keystore/truststore settings; applied to the CuratorFramework builder only when livy.server.zk.client.secure=true.

How was this patch tested?

Test improvements:

  • Extracted mockCurator() helper in ZooKeeperStateStoreSpec to eliminate repeated CuratorFramework mock setup boilerplate.
  • Added an "SSL config" describe block with withSslMock helper (SslTestFixture) and tests covering SSL property mapping and both the secure and non-secure construction paths.

Was this patch authored or co-authored using generative AI tooling?

Yes, this was co-authored using Cursor to help generate the new test cases.

Generated-by: Cursor 3.5.17

@roczei roczei changed the title LIVY-1042: Add SSL/TLS support for ZooKeeper connection [LIVY-1042] Add SSL/TLS support for ZooKeeper connection May 29, 2026
Introduced an optional TLS encryption for the Curator based ZooKeeper
client used during session recovery.

Changes by Asif Khatri:

- Added five LivyConf entries (LIVY_ZK_CLIENT_SECURE, LIVY_ZK_CLIENT_SOCKET,
  LIVY_ZK_KEYSTORE_PASS, LIVY_ZK_TRUSTSTORE_FILE, LIVY_ZK_TRUSTSTORE_PASS)
  and document them in livy.conf.template.
- Added ZooKeeperManager.createZKClientConfig that assembles a ZKClientConfig
  from keystore/truststore settings; applied to the CuratorFramework builder
  only when livy.server.zk.client.secure=true.

Test improvements:

- Extracted mockCurator() helper in ZooKeeperStateStoreSpec to eliminate
  repeated CuratorFramework mock setup boilerplate.
- Added an "SSL config" describe block with withSslMock
  helper (SslTestFixture) and tests covering SSL property mapping and
  both the secure and non-secure construction paths.

Was this patch authored or co-authored using generative AI tooling?

Yes, this was co-authored using Cursor to help generate the new test cases.

Generated-by: Cursor 3.5.17

Co-authored-by: Asif Khatri <123077165+askhatri@users.noreply.github.com>
@roczei

roczei commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

Hi @ArnavBalyan, @askhatri and @gyogal,

This PR is ready for code review. Could you please take a look at this when you have a moment? Any feedback you provide would be greatly appreciated! Thank you!

@ArnavBalyan

Copy link
Copy Markdown
Member

Thanks for the changes, I ran the patch and verified successful TLS connection established from Livy to ZK. The curator session forms and znode operations succeed. CI is green, LGTM (1 minor comment)

@roczei

roczei commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

@ArnavBalyan Thanks a lot for looking into this PR!

(1 minor comment)

What is this comment? Unfortunately, I can't find it.

}

private[recovery] def createZKClientConfig = {
val clientConfig = new ZKClientConfig

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.

nit: when secure is true, can we strict require() the four SSL fields (truststore location/password, ssl keystore, keystore password) since operator missing out on some configs would cause retry loop to zk connection

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.

Thanks Arnav for the review! I have implemented your suggestion and updated the code.

@ArnavBalyan

ArnavBalyan commented Jun 8, 2026

Copy link
Copy Markdown
Member

@ArnavBalyan Thanks a lot for looking into this PR!

(1 minor comment)

What is this comment? Unfortunately, I can't find it.

Oops missed submitting

When livy.server.zk.client.secure=true, the following are required: livy.keystore,
livy.server.zk.ssl.keyStore.password livy.server.zk.ssl.truststore.location, livy.server.zk.ssl.truststore.password.
@ArnavBalyan

Copy link
Copy Markdown
Member

Thank you @roczei!

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.

2 participants