use of org.eclipse.che.commons.annotation.Traced in project devspaces-images by redhat-developer.
the class EnvVarsConverter method provision.
@Override
@Traced
public void provision(KubernetesEnvironment k8sEnv, RuntimeIdentity identity) throws InfrastructureException {
TracingTags.WORKSPACE_ID.set(identity::getWorkspaceId);
for (PodData pod : k8sEnv.getPodsData().values()) {
for (Container container : pod.getSpec().getContainers()) {
String machineName = Names.machineName(pod, container);
InternalMachineConfig machineConf = k8sEnv.getMachines().get(machineName);
// we need to combine the env vars from the machine config with the variables already
// present in the container. Let's key the variables by name and use the map for merging
Map<String, EnvVar> envVars = machineConf.getEnv().entrySet().stream().map(e -> new EnvVar(e.getKey(), e.getValue(), null)).collect(toMap(EnvVar::getName, identity()));
// the env vars defined in our machine config take precedence over the ones already defined
// in the container, if any
container.getEnv().forEach(v -> envVars.putIfAbsent(v.getName(), v));
// The environment variable expansion only works if a variable that is referenced
// is already defined earlier in the list of environment variables.
// We need to produce a list where variables that reference others always appear later
// in the list.
List<EnvVar> sorted = topoSort.sort(envVars.values());
container.setEnv(sorted);
}
}
}
use of org.eclipse.che.commons.annotation.Traced in project devspaces-images by redhat-developer.
the class RestartPolicyRewriter method provision.
@Override
@Traced
public void provision(KubernetesEnvironment k8sEnv, RuntimeIdentity identity) throws InfrastructureException {
TracingTags.WORKSPACE_ID.set(identity::getWorkspaceId);
for (PodData podConfig : k8sEnv.getPodsData().values()) {
final String podName = podConfig.getMetadata().getName();
final PodSpec podSpec = podConfig.getSpec();
rewriteRestartPolicy(podSpec, podName, k8sEnv);
}
}
use of org.eclipse.che.commons.annotation.Traced in project devspaces-images by redhat-developer.
the class OpenShiftInternalRuntime method createRoutes.
@Traced
// package-private so that interception is possible
@SuppressWarnings("WeakerAccess")
List<Route> createRoutes(OpenShiftEnvironment env, String workspaceId) throws InfrastructureException {
TracingTags.WORKSPACE_ID.set(workspaceId);
Collection<Route> routesToCreate = env.getRoutes().values();
List<Route> createdRoutes = new ArrayList<>(routesToCreate.size());
for (Route route : routesToCreate) {
createdRoutes.add(project.routes().create(route));
}
return createdRoutes;
}
use of org.eclipse.che.commons.annotation.Traced in project devspaces-images by redhat-developer.
the class OpenShiftInternalRuntime method createServices.
@Traced
// package-private so that interception is possible
@SuppressWarnings("WeakerAccess")
List<Service> createServices(OpenShiftEnvironment env, String workspaceId) throws InfrastructureException {
TracingTags.WORKSPACE_ID.set(workspaceId);
Collection<Service> servicesToCreate = env.getServices().values();
List<Service> createdServices = new ArrayList<>(servicesToCreate.size());
for (Service service : servicesToCreate) {
createdServices.add(project.services().create(service));
}
return createdServices;
}
Aggregations