Java Code Examples for io.fabric8.kubernetes.client.Config

The following examples show how to use io.fabric8.kubernetes.client.Config. These examples are extracted from open source projects. 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 Project: jkube   Source File: ClusterConfigurationTest.java    License: Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void should_load_configuration_from_properties() {
  // Given
  final Properties properties = new Properties();
  properties.put("jkube.username", "user name");
  properties.put("jkube.password", "the pa$$w*rd");
  properties.put("jkube.masterUrl", "https://example.com");
  properties.put("jkube.corner-case", "corner");
  properties.put("manufactur8.jkube.corner-case", "cased");
  // When
  final Config config = ClusterConfiguration.from(properties).build().getConfig();
  // Then
  assertThat(config.getUsername()).isEqualTo("user name");
  assertThat(config.getPassword()).isEqualTo("the pa$$w*rd");
  assertThat(config.getMasterUrl()).isEqualTo("https://example.com/");
}
 
Example 2
Source Project: kubernetes-client   Source File: NewProjectExamples.java    License: Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws InterruptedException {
  String master = "https://localhost:8443/";
  if (args.length == 1) {
    master = args[0];
  }

  Config config = new ConfigBuilder().withMasterUrl(master).build();

  try (OpenShiftClient client = new DefaultOpenShiftClient(config)) {
    ProjectRequest request = null;
    try {
      request = client.projectrequests().createNew().withNewMetadata().withName("thisisatest").endMetadata().withDescription("Jimmi").withDisplayName("Jimmi").done();
    } finally {
      if (request != null) {
        client.projects().withName(request.getMetadata().getName()).delete();
      }
    }
  }
}
 
Example 3
Source Project: quarkus   Source File: KubernetesMockServerTestResource.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public Map<String, String> start() {
    final Map<String, String> systemProps = new HashMap<>();
    systemProps.put(Config.KUBERNETES_TRUST_CERT_SYSTEM_PROPERTY, "true");
    systemProps.put(Config.KUBERNETES_AUTH_TRYKUBECONFIG_SYSTEM_PROPERTY, "false");
    systemProps.put(Config.KUBERNETES_AUTH_TRYSERVICEACCOUNT_SYSTEM_PROPERTY, "false");
    systemProps.put(Config.KUBERNETES_NAMESPACE_SYSTEM_PROPERTY, "test");

    mockServer = new KubernetesMockServer(useHttps());
    mockServer.init();
    try (NamespacedKubernetesClient client = mockServer.createClient()) {
        systemProps.put(Config.KUBERNETES_MASTER_SYSTEM_PROPERTY, client.getConfiguration().getMasterUrl());
    }

    configureMockServer(mockServer);

    return systemProps;
}
 
Example 4
public NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableImpl(OkHttpClient client, Config config, String namespace, String explicitNamespace, Boolean fromServer, Boolean deletingExisting, List<Visitor> visitors, Object item, long gracePeriodSeconds, DeletionPropagation propagationPolicy, Boolean cascading, long watchRetryInitialBackoffMillis, double watchRetryBackoffMultiplier) {
  super(client, config);
  this.fallbackNamespace = namespace;
  this.explicitNamespace = explicitNamespace;
  this.fromServer = fromServer;
  this.deletingExisting = deletingExisting;
  this.visitors = visitors != null ? new ArrayList<>(visitors) : new ArrayList<Visitor>();
  this.item = item;
  this.handler = handlerOf(item);
  this.cascading = cascading;
  this.watchRetryInitialBackoffMillis = watchRetryInitialBackoffMillis;
  this.watchRetryBackoffMultiplier = watchRetryBackoffMultiplier;
  if (handler == null) {
    throw new KubernetesClientException("No handler found for object:" + item);
  }
  this.gracePeriodSeconds = gracePeriodSeconds;
  this.propagationPolicy = propagationPolicy;
  this.visitors.add(new ChangeNamespace(explicitNamespace, fallbackNamespace));
}
 
Example 5
Source Project: kubernetes-client   Source File: SSLUtils.java    License: Apache License 2.0 6 votes vote down vote up
public static boolean isHttpsAvailable(Config config) {
    Config sslConfig = new ConfigBuilder(config)
            .withMasterUrl(Config.HTTPS_PROTOCOL_PREFIX + config.getMasterUrl())
            .withRequestTimeout(1000)
            .withConnectionTimeout(1000)
            .build();

    OkHttpClient client = HttpClientUtils.createHttpClient(config);
    try {
        Request request = new Request.Builder().get().url(sslConfig.getMasterUrl())
                .build();
        Response response = client.newCall(request).execute();
        try (ResponseBody body = response.body()) {
          return response.isSuccessful();
        }
    } catch (Throwable t) {
        LOG.warn("SSL handshake failed. Falling back to insecure connection.");
    } finally {
        if (client != null && client.connectionPool() != null) {
            client.connectionPool().evictAll();
        }
    }
    return false;
}
 
Example 6
Source Project: vxms   Source File: KubeDiscovery.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Resolves discovery annotation in AbstractVerticles
 *
 * @param service the service where to resolve the annotations
 * @param kubeConfig the kubernetes config
 */
public static void resolveBeanAnnotations(AbstractVerticle service, Config kubeConfig) {
  final JsonObject env = service.config();
  final List<Field> serviceNameFields = findServiceFields(service);
  if (!env.getBoolean("kube.offline", false)) { // online
    final DefaultKubernetesClient client =
        new DefaultKubernetesClient(kubeConfig); // TODO be aware of OpenShiftClient
    if (!serviceNameFields.isEmpty()) {
      findServiceEntryAndSetValue(service, serviceNameFields, env, client);
    } else {
      // TODO check and handle Endpoints & Pods
    }
  } else {
    // resolve properties offline
    if (!serviceNameFields.isEmpty()) {
      resolveServicesOffline(service, serviceNameFields, env);
    } else {
      // TODO check and handle Endpoints & Pods
    }
  }
}
 
Example 7
@BeforeClass
public static void setUpBeforeClass() {
	mockClient = server.getClient();

	// Configure the kubernetes master url to point to the mock server
	System.setProperty(Config.KUBERNETES_MASTER_SYSTEM_PROPERTY,
			mockClient.getConfiguration().getMasterUrl());
	System.setProperty(Config.KUBERNETES_TRUST_CERT_SYSTEM_PROPERTY, "true");
	System.setProperty(Config.KUBERNETES_AUTH_TRYKUBECONFIG_SYSTEM_PROPERTY, "false");
	System.setProperty(Config.KUBERNETES_AUTH_TRYSERVICEACCOUNT_SYSTEM_PROPERTY,
			"false");
	System.setProperty(Config.KUBERNETES_NAMESPACE_SYSTEM_PROPERTY, "test");
	System.setProperty(Config.KUBERNETES_HTTP2_DISABLE, "true");

	HashMap<String, String> data = new HashMap<>();
	data.put("application.yml", readResourceFile("application-with-profiles.yaml"));
	server.expect().withPath("/api/v1/namespaces/test/configmaps/" + APPLICATION_NAME)
			.andReturn(200, new ConfigMapBuilder().withNewMetadata()
					.withName(APPLICATION_NAME).endMetadata().addToData(data).build())
			.always();
}
 
Example 8
@BeforeClass
public static void setUpBeforeClass() {
	mockClient = server.getClient();

	// Configure the kubernetes master url to point to the mock server
	System.setProperty(Config.KUBERNETES_MASTER_SYSTEM_PROPERTY,
			mockClient.getConfiguration().getMasterUrl());
	System.setProperty(Config.KUBERNETES_TRUST_CERT_SYSTEM_PROPERTY, "true");
	System.setProperty(Config.KUBERNETES_AUTH_TRYKUBECONFIG_SYSTEM_PROPERTY, "false");
	System.setProperty(Config.KUBERNETES_AUTH_TRYSERVICEACCOUNT_SYSTEM_PROPERTY,
			"false");
	System.setProperty(Config.KUBERNETES_NAMESPACE_SYSTEM_PROPERTY, "test");
	System.setProperty(Config.KUBERNETES_HTTP2_DISABLE, "true");

	HashMap<String, String> data = new HashMap<>();
	data.put("application.yml",
			readResourceFile("application-without-profiles.yaml"));
	server.expect().withPath("/api/v1/namespaces/test/configmaps/" + APPLICATION_NAME)
			.andReturn(200, new ConfigMapBuilder().withNewMetadata()
					.withName(APPLICATION_NAME).endMetadata().addToData(data).build())
			.always();
}
 
Example 9
@Override
protected String run() throws Exception {
    String namespace = null;
    try {
        FilePath workspace = getContext().get(FilePath.class);
        namespace = workspace.child(Config.KUBERNETES_NAMESPACE_PATH).readToString();
        if (Utils.isNotNullOrEmpty(namespace)) {
            return namespace;
        }
    } catch (Throwable t) {
        //it might be executed outside of a `node` block in which case, we want to ignore.
    }

    NamespaceAction namespaceAction = new NamespaceAction(getContext().get(Run.class));
    namespace = namespaceAction.getNamespace();

    if (Utils.isNotNullOrEmpty(namespace)) {
        return namespace;
    }
    return step.getFallbackNamespace();
}
 
Example 10
Source Project: kubernetes-client   Source File: SharedInformerFactory.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Constructor with thread pool specified.
 *
 * @param threadPool specified thread pool.
 * @param okHttpClient OkHttp client
 * @param configuration configuration for client
 */
public SharedInformerFactory(ExecutorService threadPool, OkHttpClient okHttpClient, Config configuration) {
  super(new OperationContext().withOkhttpClient(okHttpClient).withConfig(configuration));
  this.informerExecutor = threadPool;
  this.informers = new HashMap<>();
  this.startedInformers = new HashMap<>();
  this.baseOperation = this.newInstance(context);
  this.eventListeners = new ConcurrentLinkedQueue<>();
}
 
Example 11
Source Project: kubernetes-client   Source File: TektonMockServer.java    License: Apache License 2.0 5 votes vote down vote up
public TektonClient createTekton() {
  Config config = new ConfigBuilder()
    .withMasterUrl(url("/"))
    .withNamespace("test")
    .withTrustCerts(true)
    .withTlsVersions(TLS_1_0)
    .build();
  return new DefaultTektonClient(createHttpClientForMockServer(config), config);
}
 
Example 12
Source Project: jkube   Source File: ClusterConfigurationTest.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void should_load_configuration_from_properties_with_initial() {
  // Given
  final ClusterConfiguration original = ClusterConfiguration.builder()
      .username("won't make it").password("the pa$$w*rd").build();
  final Properties properties = new Properties();
  properties.put("jkube.username", "user name");
  // When
  final Config config = ClusterConfiguration.from(original, properties).build().getConfig();
  // Then
  assertThat(config.getUsername()).isEqualTo("user name");
  assertThat(config.getPassword()).isEqualTo("the pa$$w*rd");
}
 
Example 13
Source Project: jkube   Source File: ClusterConfigurationTest.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void should_load_configuration_from_empty_array() {
  // When
  final Config config = ClusterConfiguration.from().build().getConfig();
  // Then
  assertThat(config).isNotNull();
}
 
Example 14
public final void startES(final Settings settings, int timeOutSec, int assertNodes) throws Exception {
    // setup api server
    final String masterUrl = apiServer.getMockServer().url("/").toString();
    System.setProperty(Config.KUBERNETES_MASTER_SYSTEM_PROPERTY, masterUrl);
    System.setProperty("kubernetes.trust.certificates", "true");
    System.setProperty("kubernetes.keystore.file", keyStore);
    System.setProperty("kubernetes.keystore.passphrase", password);
    System.setProperty("kubernetes.truststore.file", keyStore);
    System.setProperty("kubernetes.truststore.passphrase", password);
    System.setProperty("sg.display_lic_none", "true");

    FileUtils.deleteDirectory(new File("data"));

    esNode1 = new PluginAwareNode(
            settings,
            OpenShiftElasticSearchPlugin.class);
    log.debug("--------- Starting ES Node ----------");
    esNode1.start();
    log.debug("--------- Waiting for the cluster to go green ----------");
    waitForCluster(ClusterHealthStatus.GREEN, TimeValue.timeValueSeconds(timeOutSec), esNode1.client(),
            assertNodes);

    seedSearchGuardAcls();
    // seed kibana index like kibana
    XContentBuilder contentBuilder = XContentFactory.jsonBuilder()
            .startObject()
                .field("defaultIndex",".all")
            .endObject();
    givenDocumentIsIndexed(".kibana", "config", ConfigurationSettings.DEFAULT_KIBANA_VERSION, contentBuilder);

    // create ops user to avoid issue:
    // https://github.com/fabric8io/openshift-elasticsearch-plugin/issues/106
    givenDocumentIsIndexed(".operations.1970.01.01", "test", "0", "operation0");
}
 
Example 15
Source Project: enmasse   Source File: Environment.java    License: Apache License 2.0 5 votes vote down vote up
private Environment() {
    if (Strings.isNullOrEmpty(token) || Strings.isNullOrEmpty(url)) {
        Config config = Config.autoConfigure(System.getenv()
                .getOrDefault("TEST_CLUSTER_CONTEXT", null));
        token = config.getOauthToken();
        url = config.getMasterUrl();
    }
    String debugFormat = "{}:{}";
    LOGGER.info(debugFormat, INSTALL_TYPE, installType.name());
    if (installType == EnmasseInstallType.OLM) {
        LOGGER.info(debugFormat, OLM_INSTALL_TYPE, olmInstallType.name());
    }
    if (Strings.isNullOrEmpty(this.kubernetesDomain)) {
        if (url.equals("https://api.crc.testing:6443")) {
            this.kubernetesDomain = "apps-crc.testing";
        } else if (url.startsWith("https://api")) { //is api url for openshift4
            try {
                this.kubernetesDomain = new URL(url).getHost().replace("api", "apps");
            } catch (Exception ex) {
                throw new RuntimeException(ex);
            }
        } else {
            this.kubernetesDomain = "nip.io";
        }
    }
    LOGGER.info(debugFormat, "CONFIG", config);
    LOGGER.info(debugFormat, "SCALE_CONFIG", scaleConfig);
    values.forEach(v -> LOGGER.info(debugFormat, v.getKey(), v.getValue()));
}
 
Example 16
Source Project: kubernetes-client   Source File: KubernetesMockServer.java    License: Apache License 2.0 5 votes vote down vote up
public NamespacedKubernetesClient createClient() {
    Config config = new ConfigBuilder()
            .withMasterUrl(url("/"))
            .withTrustCerts(true)
            .withTlsVersions(TLS_1_0)
            .withNamespace("test")
            .build();
    return new DefaultKubernetesClient(createHttpClientForMockServer(config), config);
}
 
Example 17
Source Project: dekorate   Source File: ServiceMonitorHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Boolean delete(OkHttpClient client, Config config, String namespace, Boolean cascading, ServiceMonitor item) {
  if (cascading) {
    return new ServiceMonitorOperationsImpl(client, config).withItem(item).cascading(cascading).delete();
  } else {
    return new ServiceMonitorOperationsImpl(client, config).withItem(item).inNamespace(namespace).delete(item);
  }
}
 
Example 18
Source Project: kubernetes-client   Source File: DefaultTektonClient.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public NamespacedTektonClient inNamespace(String namespace) {
  Config updated = new ConfigBuilder(getConfiguration())
    .withNamespace(namespace)
    .build();

  return new DefaultTektonClient(getHttpClient(), updated);
}
 
Example 19
Source Project: che   Source File: OpenShiftClientFactory.java    License: Eclipse Public License 2.0 5 votes vote down vote up
public UnclosableOpenShiftClient(OkHttpClient httpClient, Config config) {
  super(
      httpClient,
      config instanceof OpenShiftConfig
          ? (OpenShiftConfig) config
          : new OpenShiftConfig(config));
}
 
Example 20
public ServiceCatalogClient createServiceCatalog() {
  Config config = new ConfigBuilder()
    .withMasterUrl(url("/"))
    .withNamespace("test")
    .withTrustCerts(true)
    .withTlsVersions(TLS_1_0)
    .build();
  return new DefaultServiceCatalogClient(config);
}
 
Example 21
Source Project: kubernetes-client   Source File: ImageStreamTagExample.java    License: Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws InterruptedException {

    String namespace = "myproject";
    String master = "CLUSTER_URL";
    Config config = new ConfigBuilder().withMasterUrl(master).build();
    OpenShiftClient client = new DefaultOpenShiftClient(config);

    try {

      ImageStreamTag istag = new ImageStreamTagBuilder().withNewMetadata().withName("bar1:1.0.12").endMetadata()
        .withNewTag().withNewFrom().withKind("DockerImage").withName("openshift/wildfly-81-centos7:latest").endFrom().endTag()
        .build();

      log("Created istag", client.imageStreamTags().inNamespace(namespace).create(istag));
      
      Thread.sleep(30000);

    }finally {

      log("ImageStreamTags are :");
      log(client.imageStreamTags().inNamespace(namespace).withName("bar1:1.0.12").get().toString());

      log("ImageStreamTags using list are :");
      log(client.imageStreamTags().list().getItems().get(0).toString());
      log("Deleted istag",client.imageStreamTags().withName("bar1:1.0.12").delete());
      client.close();
    }
  }
 
Example 22
Source Project: carbon-apimgt   Source File: K8sManager.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Sets the openshift client( This supprots both the Openshift and Kubernetes)
 */
private void setClient() {

    if (masterURL != null && saToken != null && namespace != null) {
        Config config = new ConfigBuilder().withMasterUrl(masterURL).withOauthToken(saToken).withNamespace(namespace)
                //Get keystore password to connect with local clusters
                .withClientKeyPassphrase(System.getProperty(CLIENT_KEY_PASSPHRASE)).build();

        this.openShiftClient = new DefaultOpenShiftClient(config);
    } else {
        log.error("Failed to make the connection to the cluster");
    }

}
 
Example 23
@Test
public void
    returnsConfigUsingCurrentSubjectWhenSubjectsRegistryDoesNotContainTheCorrespondingOneAndNoRuntimeState()
        throws Exception {
  when(subjectsRegistry.getSubject(OWNER_USER_ID)).thenThrow(new NotFoundException("test error"));

  Config config = factory.buildConfig(defaultConfig, WS_ID);

  assertEquals(config, expectedConfig);
  verify(environmentProvider).getWorkspacesOpenshiftConfig(eq(currentSubject));
}
 
Example 24
@Test
public void
    returnsConfigUsingGuessedSubjectWhenSubjectsRegistryDoesNotContainTheCorrespondingOneAndUsingCheSaAndRuntimeStateExists()
        throws Exception {
  when(subjectsRegistry.getSubject(OWNER_USER_ID)).thenThrow(new NotFoundException("test error"));
  when(runtimeStateCache.get(any())).thenReturn(Optional.of(runtimeState));
  when(runtimeState.getNamespace()).thenReturn(GUESSED_NAMESPACE);
  when(cheServiceAccountTokenToggle.useCheServiceAccountToken(OWNER_USER_ID)).thenReturn(true);

  Config config = factory.buildConfig(defaultConfig, WS_ID);

  assertEquals(config, expectedConfig);
  verify(environmentProvider)
      .getWorkspacesOpenshiftConfig(eq(new GuessedSubject(OWNER_USER_ID, GUESSED_NAMESPACE)));
}
 
Example 25
@BeforeClass
public static void setUpBeforeClass() {
	mockClient = server.getClient();

	// Configure the kubernetes master url to point to the mock server
	System.setProperty(Config.KUBERNETES_MASTER_SYSTEM_PROPERTY,
			mockClient.getConfiguration().getMasterUrl());
	System.setProperty(Config.KUBERNETES_TRUST_CERT_SYSTEM_PROPERTY, "true");
	System.setProperty(Config.KUBERNETES_AUTH_TRYKUBECONFIG_SYSTEM_PROPERTY, "false");
	System.setProperty(Config.KUBERNETES_AUTH_TRYSERVICEACCOUNT_SYSTEM_PROPERTY,
			"false");
	System.setProperty(Config.KUBERNETES_NAMESPACE_SYSTEM_PROPERTY, "test");
	System.setProperty(Config.KUBERNETES_HTTP2_DISABLE, "true");
}
 
Example 26
@BeforeClass
public static void setUpBeforeClass() {
	mockClient = server.getClient();

	// Configure the kubernetes master url to point to the mock server
	System.setProperty(Config.KUBERNETES_MASTER_SYSTEM_PROPERTY,
			mockClient.getConfiguration().getMasterUrl());
	System.setProperty(Config.KUBERNETES_TRUST_CERT_SYSTEM_PROPERTY, "true");
	System.setProperty(Config.KUBERNETES_AUTH_TRYKUBECONFIG_SYSTEM_PROPERTY, "false");
	System.setProperty(Config.KUBERNETES_AUTH_TRYSERVICEACCOUNT_SYSTEM_PROPERTY,
			"false");
	System.setProperty(Config.KUBERNETES_NAMESPACE_SYSTEM_PROPERTY, "test");
	System.setProperty(Config.KUBERNETES_HTTP2_DISABLE, "true");
}
 
Example 27
Source Project: kubernetes-client   Source File: ExecExample.java    License: Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws InterruptedException {
    if (args.length < 1) {
        System.out.println("Usage: podName [master] [namespace]");
        return;
      }

    String podName = args[0];
    String namespace = "default";
    String master = "https://localhost:8443/";

    if (args.length > 1) {
        master = args[1];
      }
      if (args.length > 2) {
        namespace = args[2];
      }

    Config config = new ConfigBuilder().withMasterUrl(master).build();
    try (final KubernetesClient client = new DefaultKubernetesClient(config);
         ExecWatch watch = client.pods().inNamespace(namespace).withName(podName)
            .readingInput(System.in)
            .writingOutput(System.out)
            .writingError(System.err)
            .withTTY()
            .usingListener(new SimpleListener())
            .exec()){

        Thread.sleep(10 * 1000);
    }
}
 
Example 28
@BeforeClass
public static void setUpBeforeClass() {
	mockClient = server.getClient();

	// Configure the kubernetes master url to point to the mock server
	System.setProperty(Config.KUBERNETES_MASTER_SYSTEM_PROPERTY,
			mockClient.getConfiguration().getMasterUrl());
	System.setProperty(Config.KUBERNETES_TRUST_CERT_SYSTEM_PROPERTY, "true");
	System.setProperty(Config.KUBERNETES_AUTH_TRYKUBECONFIG_SYSTEM_PROPERTY, "false");
	System.setProperty(Config.KUBERNETES_AUTH_TRYSERVICEACCOUNT_SYSTEM_PROPERTY,
			"false");
	System.setProperty(Config.KUBERNETES_NAMESPACE_SYSTEM_PROPERTY, "test");
	System.setProperty(Config.KUBERNETES_HTTP2_DISABLE, "true");

	createConfigmap(server, "s1", "defnamespace", new HashMap<String, String>() {
		{
			put("bean.common-message", "c1");
			put("bean.message1", "m1");
		}
	});

	createConfigmap(server, "defname", "s2", new HashMap<String, String>() {
		{
			put("bean.common-message", "c2");
			put("bean.message2", "m2");
		}
	});

	createConfigmap(server, "othername", "othernamespace",
			new HashMap<String, String>() {
				{
					put("bean.common-message", "c3");
					put("bean.message3", "m3");
				}
			});
}
 
Example 29
@BeforeClass
public static void setUpBeforeClass() {
	mockClient = server.getClient();

	// Configure the kubernetes master url to point to the mock server
	System.setProperty(Config.KUBERNETES_MASTER_SYSTEM_PROPERTY,
			mockClient.getConfiguration().getMasterUrl());
	System.setProperty(Config.KUBERNETES_TRUST_CERT_SYSTEM_PROPERTY, "true");
	System.setProperty(Config.KUBERNETES_AUTH_TRYKUBECONFIG_SYSTEM_PROPERTY, "false");
	System.setProperty(Config.KUBERNETES_AUTH_TRYSERVICEACCOUNT_SYSTEM_PROPERTY,
			"false");
	System.setProperty(Config.KUBERNETES_NAMESPACE_SYSTEM_PROPERTY, "test");
	System.setProperty(Config.KUBERNETES_HTTP2_DISABLE, "true");
}
 
Example 30
Source Project: kubernetes-client   Source File: CertUtilsTest.java    License: Apache License 2.0 5 votes vote down vote up
@Disabled
@Test
public void testLoadingDodgyKubeConfig() throws CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException, InvalidKeySpecException {
  System.setProperty("kubeconfig", "/tmp/ceposta.kubeconfig");
  KubernetesClient client = new DefaultKubernetesClient();
  Config config = client.getConfiguration();
  KeyStore ts = CertUtils.createTrustStore(config.getCaCertData(), null, null, "changeit");
  KeyStore ks =
    CertUtils.createKeyStore(config.getClientCertData(), null, config.getClientKeyData(), null, "RSA", "changeit", null,
      "changeit");
}