Java Code Examples for io.fabric8.kubernetes.client.server.mock.KubernetesMockServer#getHostName()

The following examples show how to use io.fabric8.kubernetes.client.server.mock.KubernetesMockServer#getHostName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ResolveServicesByLabelsConfigAndPortOKOfflineTest.java    From vxms with Apache License 2.0 7 votes vote down vote up
public void initKubernetes() {
  KubernetesMockServer plainServer = new KubernetesMockServer(false);
  plainServer.init();
  String host = plainServer.getHostName();
  Integer port = plainServer.getPort();
  ClassLoader classLoader = getClass().getClassLoader();
  File ca = new File(classLoader.getResource("ca.crt").getFile());
  File clientcert = new File(classLoader.getResource("client.crt").getFile());
  File clientkey = new File(classLoader.getResource("client.key").getFile());
  System.out.println("port: " + port + "  host:" + host);
  config =
      new ConfigBuilder()
          .withMasterUrl(host + ":" + port)
          .withNamespace(null)
          .withCaCertFile(ca.getAbsolutePath())
          .withClientCertFile(clientcert.getAbsolutePath())
          .withClientKeyFile(clientkey.getAbsolutePath())
          .build();
  //  client = new DefaultKubernetesClient(config);
  server = plainServer;
}
 
Example 2
Source File: ResolveServicesByNameTest.java    From vxms with Apache License 2.0 6 votes vote down vote up
public void initKubernetes() {
  KubernetesMockServer plainServer = new KubernetesMockServer(false);
  plainServer.init();
  String host = plainServer.getHostName();
  Integer port = plainServer.getPort();
  ClassLoader classLoader = getClass().getClassLoader();
  File ca = new File(classLoader.getResource("ca.crt").getFile());
  File clientcert = new File(classLoader.getResource("client.crt").getFile());
  File clientkey = new File(classLoader.getResource("client.key").getFile());
  System.out.println("port: " + port + "  host:" + host);
  TestingClientConfig.config =
      new ConfigBuilder()
          .withMasterUrl(host + ":" + port)
          .withNamespace("default")
          .withCaCertFile(ca.getAbsolutePath())
          .withClientCertFile(clientcert.getAbsolutePath())
          .withClientKeyFile(clientkey.getAbsolutePath())
          .build();
  //  client = new DefaultKubernetesClient(config);
  server = plainServer;
}
 
Example 3
Source File: KubernetesMockTest.java    From vxms with Apache License 2.0 6 votes vote down vote up
@Before
public void init() {
  KubernetesMockServer plainServer = new KubernetesMockServer(false);
  plainServer.init();
  String host = plainServer.getHostName();
  Integer port = plainServer.getPort();
  ClassLoader classLoader = getClass().getClassLoader();
  File ca = new File(classLoader.getResource("ca.crt").getFile());
  File clientcert = new File(classLoader.getResource("client.crt").getFile());
  File clientkey = new File(classLoader.getResource("client.key").getFile());
  System.out.println("port: " + port + "  host:" + host);
  config =
      new ConfigBuilder()
          .withMasterUrl(host + ":" + port)
          .withCaCertFile(ca.getAbsolutePath())
          .withClientCertFile(clientcert.getAbsolutePath())
          .withClientKeyFile(clientkey.getAbsolutePath())
          .build();
  client = new DefaultKubernetesClient(config);
  server = plainServer;
}
 
Example 4
Source File: ResolveServicesByLAbelsWithPortNameTest.java    From vxms with Apache License 2.0 6 votes vote down vote up
public void initKubernetes() {
  KubernetesMockServer plainServer = new KubernetesMockServer(false);
  plainServer.init();
  String host = plainServer.getHostName();
  Integer port = plainServer.getPort();
  ClassLoader classLoader = getClass().getClassLoader();
  File ca = new File(classLoader.getResource("ca.crt").getFile());
  File clientcert = new File(classLoader.getResource("client.crt").getFile());
  File clientkey = new File(classLoader.getResource("client.key").getFile());
  System.out.println("port: " + port + "  host:" + host);
  TestingClientConfig.config =
      new ConfigBuilder()
          .withMasterUrl(host + ":" + port)
          .withNamespace("default")
          .withCaCertFile(ca.getAbsolutePath())
          .withClientCertFile(clientcert.getAbsolutePath())
          .withClientKeyFile(clientkey.getAbsolutePath())
          .build();
  //  client = new DefaultKubernetesClient(config);
  server = plainServer;
}
 
Example 5
Source File: ResolveServicesByLabelsTooManyNOKTest.java    From vxms with Apache License 2.0 6 votes vote down vote up
public void initKubernetes() {
  KubernetesMockServer plainServer = new KubernetesMockServer(false);
  plainServer.init();
  String host = plainServer.getHostName();
  Integer port = plainServer.getPort();
  ClassLoader classLoader = getClass().getClassLoader();
  File ca = new File(classLoader.getResource("ca.crt").getFile());
  File clientcert = new File(classLoader.getResource("client.crt").getFile());
  File clientkey = new File(classLoader.getResource("client.key").getFile());
  System.out.println("port: " + port + "  host:" + host);
  TestingClientConfig.config =
      new ConfigBuilder()
          .withMasterUrl(host + ":" + port)
          .withNamespace("default")
          .withCaCertFile(ca.getAbsolutePath())
          .withClientCertFile(clientcert.getAbsolutePath())
          .withClientKeyFile(clientkey.getAbsolutePath())
          .build();
  //  client = new DefaultKubernetesClient(config);
  server = plainServer;
}
 
Example 6
Source File: ResolveServicesByLabelsConfigOKTest.java    From vxms with Apache License 2.0 6 votes vote down vote up
public void initKubernetes() {
  KubernetesMockServer plainServer = new KubernetesMockServer(false);
  plainServer.init();
  String host = plainServer.getHostName();
  Integer port = plainServer.getPort();
  ClassLoader classLoader = getClass().getClassLoader();
  File ca = new File(classLoader.getResource("ca.crt").getFile());
  File clientcert = new File(classLoader.getResource("client.crt").getFile());
  File clientkey = new File(classLoader.getResource("client.key").getFile());
  System.out.println("port: " + port + "  host:" + host);
  TestingClientConfig.config =
      new ConfigBuilder()
          .withMasterUrl(host + ":" + port)
          .withNamespace("default")
          .withCaCertFile(ca.getAbsolutePath())
          .withClientCertFile(clientcert.getAbsolutePath())
          .withClientKeyFile(clientkey.getAbsolutePath())
          .build();
  //  client = new DefaultKubernetesClient(config);
  server = plainServer;
}
 
Example 7
Source File: ResolveServicesByLabelOKTest.java    From vxms with Apache License 2.0 6 votes vote down vote up
public void initKubernetes() {
  KubernetesMockServer plainServer = new KubernetesMockServer(false);
  plainServer.init();
  String host = plainServer.getHostName();
  Integer port = plainServer.getPort();
  ClassLoader classLoader = getClass().getClassLoader();
  File ca = new File(classLoader.getResource("ca.crt").getFile());
  File clientcert = new File(classLoader.getResource("client.crt").getFile());
  File clientkey = new File(classLoader.getResource("client.key").getFile());
  System.out.println("port: " + port + "  host:" + host);
  TestingClientConfig.config =
      new ConfigBuilder()
          .withMasterUrl(host + ":" + port)
          .withNamespace("default")
          .withCaCertFile(ca.getAbsolutePath())
          .withClientCertFile(clientcert.getAbsolutePath())
          .withClientKeyFile(clientkey.getAbsolutePath())
          .build();
  //  client = new DefaultKubernetesClient(config);
  server = plainServer;
}
 
Example 8
Source File: ResolveServicesByLabelsOKTest.java    From vxms with Apache License 2.0 6 votes vote down vote up
public void initKubernetes() {
  KubernetesMockServer plainServer = new KubernetesMockServer(false);
  plainServer.init();
  String host = plainServer.getHostName();
  Integer port = plainServer.getPort();
  ClassLoader classLoader = getClass().getClassLoader();
  File ca = new File(classLoader.getResource("ca.crt").getFile());
  File clientcert = new File(classLoader.getResource("client.crt").getFile());
  File clientkey = new File(classLoader.getResource("client.key").getFile());
  System.out.println("port: " + port + "  host:" + host);
  TestingClientConfig.config =
      new ConfigBuilder()
          .withMasterUrl(host + ":" + port)
          .withNamespace("default")
          .withCaCertFile(ca.getAbsolutePath())
          .withClientCertFile(clientcert.getAbsolutePath())
          .withClientKeyFile(clientkey.getAbsolutePath())
          .build();
  //  client = new DefaultKubernetesClient(config);
  server = plainServer;
}
 
Example 9
Source File: ResolveServicesByLabelWithConfigOKTest.java    From vxms with Apache License 2.0 6 votes vote down vote up
public void initKubernetes() {
  KubernetesMockServer plainServer = new KubernetesMockServer(false);
  plainServer.init();
  String host = plainServer.getHostName();
  Integer port = plainServer.getPort();
  ClassLoader classLoader = getClass().getClassLoader();
  File ca = new File(classLoader.getResource("ca.crt").getFile());
  File clientcert = new File(classLoader.getResource("client.crt").getFile());
  File clientkey = new File(classLoader.getResource("client.key").getFile());
  System.out.println("port: " + port + "  host:" + host);
  TestingClientConfig.config =
      new ConfigBuilder()
          .withMasterUrl(host + ":" + port)
          .withNamespace("default")
          .withCaCertFile(ca.getAbsolutePath())
          .withClientCertFile(clientcert.getAbsolutePath())
          .withClientKeyFile(clientkey.getAbsolutePath())
          .build();
  //  client = new DefaultKubernetesClient(config);
  server = plainServer;
}
 
Example 10
Source File: ResolveServicesByLabelWithConfigNOKTest.java    From vxms with Apache License 2.0 6 votes vote down vote up
public void initKubernetes() {
  KubernetesMockServer plainServer = new KubernetesMockServer(false);
  plainServer.init();
  String host = plainServer.getHostName();
  Integer port = plainServer.getPort();
  ClassLoader classLoader = getClass().getClassLoader();
  File ca = new File(classLoader.getResource("ca.crt").getFile());
  File clientcert = new File(classLoader.getResource("client.crt").getFile());
  File clientkey = new File(classLoader.getResource("client.key").getFile());
  System.out.println("port: " + port + "  host:" + host);
  TestingClientConfig.config =
      new ConfigBuilder()
          .withMasterUrl(host + ":" + port)
          .withNamespace("default")
          .withCaCertFile(ca.getAbsolutePath())
          .withClientCertFile(clientcert.getAbsolutePath())
          .withClientKeyFile(clientkey.getAbsolutePath())
          .build();
  //  client = new DefaultKubernetesClient(config);
  server = plainServer;
}
 
Example 11
Source File: ResolveServicesByNameWithPortNameTest.java    From vxms with Apache License 2.0 5 votes vote down vote up
public void initKubernetes(JsonObject conf) {
  KubernetesMockServer plainServer = new KubernetesMockServer(false);
  plainServer.init();
  String host = plainServer.getHostName();
  Integer port = plainServer.getPort();
  ClassLoader classLoader = getClass().getClassLoader();
  File ca = new File(classLoader.getResource("ca.crt").getFile());
  File clientcert = new File(classLoader.getResource("client.crt").getFile());
  File clientkey = new File(classLoader.getResource("client.key").getFile());
  System.out.println("port: " + port + "  host:" + host);

  conf.put("withMasterUrl", host + ":" + port);
  conf.put("withCaCertFile", ca.getAbsolutePath());
  conf.put("withClientCertFile", clientcert.getAbsolutePath());
  conf.put("withClientKeyFile", clientkey.getAbsolutePath());

  TestingClientConfig.config =
      new ConfigBuilder()
          .withMasterUrl(host + ":" + port)
          .withNamespace("default")
          .withCaCertFile(ca.getAbsolutePath())
          .withClientCertFile(clientcert.getAbsolutePath())
          .withClientKeyFile(clientkey.getAbsolutePath())
          .build();

  //  client = new DefaultKubernetesClient(config);
  server = plainServer;
}