/** Create a container description to be used for installing host agents containers. */ public static ContainerDescription buildCoreAgentContainerDescription() { ContainerDescription cd = new ContainerDescription(); cd.documentSelfLink = AGENT_CONTAINER_DESCRIPTION_LINK; cd.name = AGENT_CONTAINER_NAME; cd.image = getAgentImageNameAndVersion(); cd.publishAll = true; cd.volumes = AGENT_CONTAINER_VOLUMES; cd.restartPolicy = "always"; return cd; }
private void inspectContainerWithCallback( ContainerState containerState, BiConsumer<AbstractCallbackServiceHandler.CallbackServiceHandlerState, Boolean> consumer, ServiceTaskCallback serviceTaskCallback) { if (serviceTaskCallback == null) { String systemContainerName = isSystemContainer( SystemContainerDescriptions.getSystemContainerNames(), containerState.names); startAndCreateCallbackHandlerService(systemContainerName, consumer, (callback) -> inspectContainerWithCallback(containerState, consumer, callback)); return; } inspectContainer(containerState, serviceTaskCallback); }
public static LogConfig fromDockerLoggingToCompositeLogConfig(Logging logging) { if (logging == null) { return null; } LogConfig logConfig = new LogConfig(); logConfig.type = logging.driver; logConfig.config = logging.options; return logConfig; }
public static ContainerState createContainerState() { ContainerState cs = new ContainerState(); cs.id = "testId"; cs.address = "testAddresss"; return cs; }
private ContainerDescription createContainerDescription() { ContainerDescription containerDesc = new ContainerDescription(); containerDesc.image = "image:latest"; containerDesc.healthConfig = createHealthConfig(); return containerDesc; }
private ContainerDescription createContainerDescription() { ContainerDescription containerDesc = new ContainerDescription(); containerDesc.image = "image:latest"; containerDesc.healthConfig = createHealthConfig(); return containerDesc; }
private CompositeComponent createCompositeComponent() throws Throwable { compositeComponent = new CompositeComponent(); compositeComponent.name = "test-name"; compositeComponent = doPost(compositeComponent, CompositeComponentFactoryService.SELF_LINK); return compositeComponent; }
private ContainerDescription createContainerDescription() { ContainerDescription containerDesc = new ContainerDescription(); containerDesc.image = "image:latest"; return containerDesc; }
private HealthConfig createHealthConfig() { HealthConfig healthConfig = new HealthConfig(); healthConfig.protocol = RequestProtocol.HTTP; healthConfig.healthyThreshold = 2; healthConfig.unhealthyThreshold = 2; healthConfig.httpMethod = Action.GET; healthConfig.httpVersion = HttpVersion.HTTP_v1_1; healthConfig.urlPath = TestHealthService.SELF_LINK; healthConfig.timeoutMillis = 2000; return healthConfig; }
/** * Retrieve factory link for a Component by component's description link. */ public static String descriptionFactoryLinkByType(String type) { return getEntry(equalsType(type)).descriptionFactoryLink; }
/** * Retrieve meta data for a Component by component's description link. */ public static ComponentMeta metaByDescriptionLink(String descriptionLink) { return getEntry(descriptionFactoryPrefix(descriptionLink)).componentMeta; }
/** * Register new component meta data. */ public static void registerComponent(String resourceType, String descriptionFactoryLink, Class<? extends ResourceState> descriptionClass, String stateFactoryLink, Class<? extends ResourceState> stateClass) { registerComponent(resourceType, descriptionFactoryLink, descriptionClass, stateFactoryLink, stateClass, stateClass); }
private DeploymentPolicy createDeploymentPolicy() { DeploymentPolicy policy = new DeploymentPolicy(); policy.name = "policy"; policy.description = "test policy"; return policy; } }
private GroupResourcePlacementState createAndStoreGroupResourcePlacement(String link, Long memoryLimit, Long storageLimit, Integer priority, Integer cpuShares, String resourcePoolLink, boolean expectFailure) throws Throwable { // create test placement GroupResourcePlacementState placementState = createPlacement(link, memoryLimit, storageLimit, priority, cpuShares, resourcePoolLink, 10); // attempt saving the test placement return savePlacement(placementState, expectFailure); }
private GroupResourcePlacementState makeResourcePlacementReservationRequest( GroupResourcePlacementState placementState, int count) throws Throwable { return makeResourcePlacementReservationRequest(count, containerDescription.documentSelfLink, placementState, false); }
private TemplateSpec createTemplateFromImageResult(Result result) { TemplateSpec template = new TemplateSpec(); template.templateType = TemplateType.CONTAINER_IMAGE_DESCRIPTION; template.name = result.name; template.description = result.description; template.registry = result.registry; template.automated = result.automated; template.trusted = result.trusted; template.official = result.official; template.starCount = result.starCount; return template; }
private void addContainerToMockAdapter(String hostLink, String containerId, String containerName, String containerImage, List<String> tenantLinks) throws Throwable { addContainerToMockAdapter(hostLink, containerId, containerName, containerImage, PowerState.UNKNOWN, tenantLinks); }
private GroupResourcePlacementState createAndStoreGroupResourcePlacement() throws Throwable { return createAndStoreGroupResourcePlacement("reservation-test", 8 * CONTAINER_MEMORY + CONTAINER_MEMORY / 2, 0L, 0, 0, resourcePool.documentSelfLink, false); }
private HealthConfig createHealthConfig() { HealthConfig healthConfig = new HealthConfig(); healthConfig.protocol = RequestProtocol.HTTP; healthConfig.healthyThreshold = 2; healthConfig.unhealthyThreshold = 2; healthConfig.httpMethod = Action.GET; healthConfig.httpVersion = HttpVersion.HTTP_v1_1; healthConfig.timeoutMillis = 2000; return healthConfig; }
private void releasePlacement( com.vmware.admiral.compute.container.GroupResourcePlacementService.GroupResourcePlacementState placementState, String descLink, int count) throws Throwable { makeResourcePlacementReservationRequest(-count, descLink, placementState, false); }