pan3793 commented on code in PR #48446:
URL: https://github.com/apache/spark/pull/48446#discussion_r1802357751
##########
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/SparkKubernetesClientFactory.scala:
##########
@@ -103,42 +100,43 @@ object SparkKubernetesClientFactory extends Logging {
.withRequestTimeout(clientType.requestTimeout(sparkConf))
.withConnectionTimeout(clientType.connectionTimeout(sparkConf))
.withTrustCerts(sparkConf.get(KUBERNETES_TRUST_CERTIFICATES))
- .withOption(oauthTokenValue) {
- (token, configBuilder) => configBuilder.withOauthToken(token)
- }.withOption(oauthTokenFile) {
- (file, configBuilder) =>
- configBuilder.withOauthToken(Files.asCharSource(file,
Charsets.UTF_8).read())
- }.withOption(caCertFile) {
- (file, configBuilder) => configBuilder.withCaCertFile(file)
- }.withOption(clientKeyFile) {
- (file, configBuilder) => configBuilder.withClientKeyFile(file)
- }.withOption(clientCertFile) {
- (file, configBuilder) => configBuilder.withClientCertFile(file)
- }.withOption(namespace) {
- (ns, configBuilder) => configBuilder.withNamespace(ns)
- }.build()
- val factoryWithCustomDispatcher = new OkHttpClientFactory() {
- override protected def additionalConfig(builder: OkHttpClient.Builder):
Unit = {
- builder.dispatcher(dispatcher)
+ .withOption(oauthTokenValue) { (token, configBuilder) =>
+ configBuilder.withOauthToken(token)
}
- }
- logDebug("Kubernetes client config: " +
- new
ObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(config))
+ .withOption(oauthTokenFile) { (file, configBuilder) =>
+ configBuilder.withOauthToken(Files.asCharSource(file,
Charsets.UTF_8).read())
+ }
+ .withOption(caCertFile) { (file, configBuilder) =>
+ configBuilder.withCaCertFile(file)
+ }
+ .withOption(clientKeyFile) { (file, configBuilder) =>
+ configBuilder.withClientKeyFile(file)
+ }
+ .withOption(clientCertFile) { (file, configBuilder) =>
+ configBuilder.withClientCertFile(file)
+ }
+ .withOption(namespace) { (ns, configBuilder) =>
+ configBuilder.withNamespace(ns)
+ }
+ .build()
+ logDebug(
+ "Kubernetes client config: " +
+ new
ObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(config))
new KubernetesClientBuilder()
- .withHttpClientFactory(factoryWithCustomDispatcher)
Review Comment:
I'm not against that, after making this change, how do you configure the K8s
client builder to use another HTTP client factory without touching the code?
BTW, please restore unnecessary code changes from your patch.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]