File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
src/main/java/cd/go/contrib/elasticagent Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 20
20
import io .fabric8 .kubernetes .client .DefaultKubernetesClient ;
21
21
import io .fabric8 .kubernetes .client .KubernetesClient ;
22
22
23
+ import java .util .Base64 ;
24
+
23
25
import static cd .go .contrib .elasticagent .KubernetesPlugin .LOG ;
24
26
import static cd .go .contrib .elasticagent .model .AuthenticationStrategy .CLUSTER_CERTS ;
25
27
import static cd .go .contrib .elasticagent .model .AuthenticationStrategy .OAUTH_TOKEN ;
@@ -58,10 +60,14 @@ private KubernetesClient createClientFor(PluginSettings pluginSettings) {
58
60
configBuilder
59
61
.withMasterUrl (pluginSettings .getClusterUrl ())
60
62
.withCaCertData (pluginSettings .getCaCertData ())
61
- .withClientKeyData (pluginSettings .getClientKeyData ())
63
+ .withClientKeyData (encodeToBase64 ( pluginSettings .getClientKeyData () ))
62
64
.withClientCertData (pluginSettings .getClientCertData ());
63
65
}
64
66
65
67
return new DefaultKubernetesClient (configBuilder .build ());
66
68
}
69
+
70
+ private String encodeToBase64 (String stringToEncode ) {
71
+ return Base64 .getEncoder ().encodeToString (stringToEncode .getBytes ());
72
+ }
67
73
}
You can’t perform that action at this time.
0 commit comments