Source:
public void apply( WorkspaceConfigImpl workspaceConfig, Tool dockerimageTool, FileContentProvider contentProvider) throws DevfileException { checkArgument(workspaceConfig != null, "Workspace config must not be null"); checkArgument(dockerimageTool != null, "Tool must not be null"); checkArgument( DOCKERIMAGE_TOOL_TYPE.equals(dockerimageTool.getType()), format("Plugin must have `%s` type", DOCKERIMAGE_TOOL_TYPE)); if (workspaceConfig.getDefaultEnv() != null) { throw new DevfileException("Workspace already contains environment"); } String machineName = dockerimageTool.getName(); MachineConfigImpl machineConfig = new MachineConfigImpl(); dockerimageTool .getEndpoints() .forEach(e -> machineConfig.getServers().put(e.getName(), toServerConfig(e))); dockerimageTool .getVolumes() .forEach( v -> machineConfig .getVolumes() .put(v.getName(), new VolumeImpl().withPath(v.getContainerPath()))); if (dockerimageTool.getMountSources()) { machineConfig .getVolumes() .put(PROJECTS_VOLUME_NAME, new VolumeImpl().withPath(projectFolderPath)); } machineConfig .getAttributes() .put( MEMORY_LIMIT_ATTRIBUTE, Long.toString(KubernetesSize.toBytes(dockerimageTool.getMemoryLimit()))); setEntryPointAttribute( machineConfig, CONTAINER_COMMAND_ATTRIBUTE, dockerimageTool.getCommand()); setEntryPointAttribute(machineConfig, CONTAINER_ARGS_ATTRIBUTE, dockerimageTool.getArgs()); RecipeImpl recipe = new RecipeImpl(DockerImageEnvironment.TYPE, null, dockerimageTool.getImage(), null); EnvironmentImpl environment = new EnvironmentImpl(recipe, ImmutableMap.of(machineName, machineConfig)); workspaceConfig.getEnvironments().put(dockerimageTool.getName(), environment); workspaceConfig.setDefaultEnv(dockerimageTool.getName()); workspaceConfig .getCommands() .stream() .filter( c -> dockerimageTool .getName() .equals(c.getAttributes().get(Constants.TOOL_NAME_COMMAND_ATTRIBUTE))) .forEach(c -> c.getAttributes().put(MACHINE_NAME_ATTRIBUTE, machineName)); }

Target:
public void apply( WorkspaceConfigImpl workspaceConfig, Tool dockerimageTool, FileContentProvider contentProvider) throws DevfileException { checkArgument(workspaceConfig != null, "Workspace config must not be null"); checkArgument(dockerimageTool != null, "Tool must not be null"); checkArgument( DOCKERIMAGE_TOOL_TYPE.equals(dockerimageTool.getType()), format("Plugin must have `%s` type", DOCKERIMAGE_TOOL_TYPE)); String machineName = dockerimageTool.getName(); MachineConfigImpl machineConfig = new MachineConfigImpl(); dockerimageTool .getEndpoints() .forEach(e -> machineConfig.getServers().put(e.getName(), toServerConfig(e))); dockerimageTool .getVolumes() .forEach( v -> machineConfig .getVolumes() .put(v.getName(), new VolumeImpl().withPath(v.getContainerPath()))); if (dockerimageTool.getMountSources()) { machineConfig .getVolumes() .put(PROJECTS_VOLUME_NAME, new VolumeImpl().withPath(projectFolderPath)); } List<HasMetadata> componentObjects = new ArrayList<>(); Deployment deployment = buildDeployment( machineName, dockerimageTool.getImage(), dockerimageTool.getMemoryLimit(), dockerimageTool .getEnv() .stream() .map(e -> new EnvVar(e.getName(), e.getValue(), null)) .collect(Collectors.toCollection(ArrayList::new)), dockerimageTool.getCommand(), dockerimageTool.getArgs()); componentObjects.add(deployment); dockerimageTool .getEndpoints() .stream() .filter(e -> "true".equals(e.getAttributes().get(DISCOVERABLE_ENDPOINT_ATTRIBUTE))) .forEach(e -> componentObjects.add(createService(deployment, e))); k8sEnvProvisioner.provision( workspaceConfig, KubernetesEnvironment.TYPE, componentObjects, ImmutableMap.of(machineName, machineConfig)); workspaceConfig .getCommands() .stream() .filter( c -> dockerimageTool .getName() .equals(c.getAttributes().get(Constants.TOOL_NAME_COMMAND_ATTRIBUTE))) .forEach(c -> c.getAttributes().put(MACHINE_NAME_ATTRIBUTE, machineName)); }