use of org.eclipse.che.workspace.infrastructure.kubernetes.provision.ProxySettingsProvisioner.HTTP_PROXY in project che-server by eclipse-che.
the class ProxySettingsProvisionerTest method shouldApplyProxySettingsToAllContainers.
@Test
public void shouldApplyProxySettingsToAllContainers() throws Exception {
Map<String, Pod> pods = new HashMap<>();
Pod pod1 = pods.put("pod1", buildPod("pod1", buildContainers(2)));
pods.put("pod2", buildPod("pod2", buildContainers(3)));
KubernetesEnvironment k8sEnv = KubernetesEnvironment.builder().setPods(pods).build();
provisioner.provision(k8sEnv, runtimeId);
assertTrue(k8sEnv.getPodsData().values().stream().flatMap(pod -> pod.getSpec().getContainers().stream()).allMatch(container -> container.getEnv().contains(new EnvVar(HTTP_PROXY, HTTP_PROXY_VALUE, null)) && container.getEnv().contains(new EnvVar(HTTPS_PROXY, HTTPS_PROXY_VALUE, null)) && container.getEnv().contains(new EnvVar(NO_PROXY, NO_PROXY_VALUE, null))));
}
use of org.eclipse.che.workspace.infrastructure.kubernetes.provision.ProxySettingsProvisioner.HTTP_PROXY in project che-server by eclipse-che.
the class ProxySettingsProvisionerTest method shouldNotApplyProxySettingsToJWTProxyContainer.
@Test
public void shouldNotApplyProxySettingsToJWTProxyContainer() throws Exception {
Map<String, Pod> pods = new HashMap<>();
pods.put(JWT_PROXY_POD_NAME, buildPod(JWT_PROXY_POD_NAME, buildContainers(2)));
KubernetesEnvironment k8sEnv = KubernetesEnvironment.builder().setPods(pods).build();
provisioner.provision(k8sEnv, runtimeId);
assertTrue(k8sEnv.getPodsData().values().stream().filter(pod -> pod.getMetadata().getName().equals(JWT_PROXY_POD_NAME)).flatMap(pod -> pod.getSpec().getContainers().stream()).noneMatch(container -> container.getEnv().contains(new EnvVar(HTTP_PROXY, HTTP_PROXY_VALUE, null)) || container.getEnv().contains(new EnvVar(HTTPS_PROXY, HTTPS_PROXY_VALUE, null)) || container.getEnv().contains(new EnvVar(NO_PROXY, NO_PROXY_VALUE, null))));
}
use of org.eclipse.che.workspace.infrastructure.kubernetes.provision.ProxySettingsProvisioner.HTTP_PROXY in project che-server by eclipse-che.
the class ProxySettingsProvisionerTest method shouldApplyProxySettingsToInitContainers.
@Test
public void shouldApplyProxySettingsToInitContainers() throws Exception {
Map<String, Pod> pods = new HashMap<>();
Pod pod1 = buildPod("pod1", buildContainers(3));
pod1.getSpec().setInitContainers(Arrays.asList(buildContainers(2)));
pods.put("pod1", pod1);
KubernetesEnvironment k8sEnv = KubernetesEnvironment.builder().setPods(pods).build();
provisioner.provision(k8sEnv, runtimeId);
assertTrue(k8sEnv.getPodsData().values().stream().flatMap(pod -> Stream.concat(pod.getSpec().getContainers().stream(), pod.getSpec().getInitContainers().stream())).allMatch(container -> container.getEnv().contains(new EnvVar(HTTP_PROXY, HTTP_PROXY_VALUE, null)) && container.getEnv().contains(new EnvVar(HTTPS_PROXY, HTTPS_PROXY_VALUE, null)) && container.getEnv().contains(new EnvVar(NO_PROXY, NO_PROXY_VALUE, null))));
}
use of org.eclipse.che.workspace.infrastructure.kubernetes.provision.ProxySettingsProvisioner.HTTP_PROXY in project devspaces-images by redhat-developer.
the class ProxySettingsProvisionerTest method shouldApplyProxySettingsToAllContainers.
@Test
public void shouldApplyProxySettingsToAllContainers() throws Exception {
Map<String, Pod> pods = new HashMap<>();
Pod pod1 = pods.put("pod1", buildPod("pod1", buildContainers(2)));
pods.put("pod2", buildPod("pod2", buildContainers(3)));
KubernetesEnvironment k8sEnv = KubernetesEnvironment.builder().setPods(pods).build();
provisioner.provision(k8sEnv, runtimeId);
assertTrue(k8sEnv.getPodsData().values().stream().flatMap(pod -> pod.getSpec().getContainers().stream()).allMatch(container -> container.getEnv().contains(new EnvVar(HTTP_PROXY, HTTP_PROXY_VALUE, null)) && container.getEnv().contains(new EnvVar(HTTPS_PROXY, HTTPS_PROXY_VALUE, null)) && container.getEnv().contains(new EnvVar(NO_PROXY, NO_PROXY_VALUE, null))));
}
use of org.eclipse.che.workspace.infrastructure.kubernetes.provision.ProxySettingsProvisioner.HTTP_PROXY in project devspaces-images by redhat-developer.
the class ProxySettingsProvisionerTest method shouldApplyProxySettingsToInitContainers.
@Test
public void shouldApplyProxySettingsToInitContainers() throws Exception {
Map<String, Pod> pods = new HashMap<>();
Pod pod1 = buildPod("pod1", buildContainers(3));
pod1.getSpec().setInitContainers(Arrays.asList(buildContainers(2)));
pods.put("pod1", pod1);
KubernetesEnvironment k8sEnv = KubernetesEnvironment.builder().setPods(pods).build();
provisioner.provision(k8sEnv, runtimeId);
assertTrue(k8sEnv.getPodsData().values().stream().flatMap(pod -> Stream.concat(pod.getSpec().getContainers().stream(), pod.getSpec().getInitContainers().stream())).allMatch(container -> container.getEnv().contains(new EnvVar(HTTP_PROXY, HTTP_PROXY_VALUE, null)) && container.getEnv().contains(new EnvVar(HTTPS_PROXY, HTTPS_PROXY_VALUE, null)) && container.getEnv().contains(new EnvVar(NO_PROXY, NO_PROXY_VALUE, null))));
}
Aggregations