File tree Expand file tree Collapse file tree
main/java/io/kubernetes/client/util
java/io/kubernetes/client/util Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2727import io .kubernetes .client .util .credentials .AccessTokenAuthentication ;
2828import io .kubernetes .client .util .credentials .Authentication ;
2929import io .kubernetes .client .util .credentials .KubeconfigAuthentication ;
30- import java .io .*;
30+ import java .io .BufferedReader ;
31+ import java .io .ByteArrayInputStream ;
32+ import java .io .File ;
33+ import java .io .FileInputStream ;
34+ import java .io .IOException ;
35+ import java .io .InputStreamReader ;
3136import java .nio .charset .Charset ;
3237import java .nio .charset .StandardCharsets ;
3338import java .nio .file .Files ;
Original file line number Diff line number Diff line change 3636public class ClientBuilderTest {
3737 private static final String HOME_PATH = Resources .getResource ("" ).getPath ();
3838 private static final String KUBECONFIG_FILE_PATH = Resources .getResource ("kubeconfig" ).getPath ();
39+ private static final String KUBECONFIG_UTF8_FILE_PATH =
40+ Resources .getResource ("kubeconfig-utf8" ).getPath ();
3941 private static final String KUBECONFIG_HTTP_FILE_PATH =
4042 Resources .getResource ("kubeconfig-http" ).getPath ();
4143 private static final String KUBECONFIG_HTTPS_FILE_PATH =
@@ -81,6 +83,13 @@ public void testDefaultClientReadsKubeConfig() throws Exception {
8183 assertEquals ("http://kubeconfig.dir.com" , client .getBasePath ());
8284 }
8385
86+ @ Test
87+ public void testDefaultClientUTF8EncodedConfig () throws Exception {
88+ environmentVariables .set ("KUBECONFIG" , KUBECONFIG_UTF8_FILE_PATH );
89+ final ApiClient client = ClientBuilder .defaultClient ();
90+ assertEquals ("http://kubeconfig.dir.com" , client .getBasePath ());
91+ }
92+
8493 @ Test
8594 public void testDefaultClientReadsKubeConfigMultiple () throws Exception {
8695 final String kubeConfigEnv = KUBECONFIG_FILE_PATH + File .pathSeparator + "/non-existent" ;
Original file line number Diff line number Diff line change 1+ apiVersion: v1
2+ clusters:
3+ - cluster:
4+ server: http://kubeconfig.dir.com
5+ name: façade
6+ contexts:
7+ - context:
8+ cluster: façade
9+ name: foo-context
10+ current-context: foo-context
You can’t perform that action at this time.
0 commit comments