Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not apply proxy settings for JWTProxy container; #14448

Merged
merged 2 commits into from
Sep 9, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
*/
package org.eclipse.che.workspace.infrastructure.kubernetes.provision;

import static org.eclipse.che.workspace.infrastructure.kubernetes.server.secure.jwtproxy.JwtProxyProvisioner.JWT_PROXY_POD_NAME;

import io.fabric8.kubernetes.api.model.EnvVar;
import java.util.HashMap;
import java.util.Map;
Expand All @@ -21,7 +23,6 @@
import org.eclipse.che.commons.annotation.Traced;
import org.eclipse.che.commons.tracing.TracingTags;
import org.eclipse.che.workspace.infrastructure.kubernetes.environment.KubernetesEnvironment;
import org.eclipse.che.workspace.infrastructure.kubernetes.environment.KubernetesEnvironment.PodData;

/**
* Add proxy configuration to pod containers
Expand Down Expand Up @@ -60,13 +61,15 @@ public void provision(KubernetesEnvironment k8sEnv, RuntimeIdentity identity)
TracingTags.WORKSPACE_ID.set(identity::getWorkspaceId);

if (!proxyEnvVars.isEmpty()) {
for (PodData pod : k8sEnv.getPodsData().values()) {
pod.getSpec()
.getContainers()
.forEach(
container ->
proxyEnvVars.forEach((k, v) -> container.getEnv().add(new EnvVar(k, v, null))));
}
k8sEnv
.getPodsData()
.entrySet()
.stream()
.filter(entry -> !entry.getKey().equals(JWT_PROXY_POD_NAME))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Please consider adding one like comment why here we ignore JWT_PROXY pod.

  2. Please consider adding test case for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why i am always modifying classes which doesn;t have tests at all 🤣 ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cause you're a lucky man! 🤣

.flatMap(entry -> entry.getValue().getSpec().getContainers().stream())
.forEach(
container ->
proxyEnvVars.forEach((k, v) -> container.getEnv().add(new EnvVar(k, v, null))));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,12 @@ public class JwtProxyProvisioner {

static final String JWT_PROXY_CONFIG_FILE = "config.yaml";
static final String JWT_PROXY_MACHINE_NAME = "che-jwtproxy";
static final String JWT_PROXY_POD_NAME = JWT_PROXY_MACHINE_NAME;

static final String JWT_PROXY_CONFIG_FOLDER = "/config";
static final String JWT_PROXY_PUBLIC_KEY_FILE = "mykey.pub";

public static final String JWT_PROXY_POD_NAME = JWT_PROXY_MACHINE_NAME;

private final SignatureKeyManager signatureKeyManager;

private final RuntimeIdentity identity;
Expand Down