Java Code Examples for org.springframework.cloud.deployer.spi.util.ByteSizeUtils#parseToMebibytes()

The following examples show how to use org.springframework.cloud.deployer.spi.util.ByteSizeUtils#parseToMebibytes() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DeploymentPropertiesResolver.java    From spring-cloud-deployer-kubernetes with Apache License 2.0 5 votes vote down vote up
/**
 * Get the StatefulSet storage value to be set in VolumeClaim template for the given deployment properties.
 *
 * @param kubernetesDeployerProperties the kubernetes deployer properties
 * @return the StatefulSet storage
 */
String getStatefulSetStorage(Map<String, String> kubernetesDeployerProperties) {
	String storage = PropertyParserUtils.getDeploymentPropertyValue(kubernetesDeployerProperties,
			this.propertyPrefix + ".statefulSet.volumeClaimTemplate.storage");

	if (storage == null && properties.getStatefulSet() != null && properties.getStatefulSet().getVolumeClaimTemplate() != null) {
		storage = properties.getStatefulSet().getVolumeClaimTemplate().getStorage();
	}

	return ByteSizeUtils.parseToMebibytes(storage) + "Mi";
}
 
Example 2
Source File: AbstractCloudFoundryDeployer.java    From spring-cloud-deployer-cloudfoundry with Apache License 2.0 5 votes vote down vote up
int memory(AppScaleRequest request) {
	if (request.getProperties().isPresent() && request.getProperties().get() != null) {
		return (int) ByteSizeUtils.parseToMebibytes(request.getProperties().get().getOrDefault(AppDeployer.MEMORY_PROPERTY_KEY,
				this.deploymentProperties.getMemory()));
	}
	return (int) ByteSizeUtils.parseToMebibytes(this.deploymentProperties.getMemory());
}
 
Example 3
Source File: AbstractCloudFoundryDeployer.java    From spring-cloud-deployer-cloudfoundry with Apache License 2.0 5 votes vote down vote up
int diskQuota(AppScaleRequest request) {
	if (request.getProperties().isPresent() && request.getProperties().get() != null) {
		return (int) ByteSizeUtils.parseToMebibytes(request.getProperties().get().getOrDefault(AppDeployer.DISK_PROPERTY_KEY,
				this.deploymentProperties.getDisk()));
	}
	return (int) ByteSizeUtils.parseToMebibytes(this.deploymentProperties.getDisk());
}
 
Example 4
Source File: AbstractCloudFoundryDeployer.java    From spring-cloud-deployer-cloudfoundry with Apache License 2.0 4 votes vote down vote up
int memory(AppDeploymentRequest request) {
	String withUnit = request.getDeploymentProperties()
		.getOrDefault(AppDeployer.MEMORY_PROPERTY_KEY, this.deploymentProperties.getMemory());
	return (int) ByteSizeUtils.parseToMebibytes(withUnit);
}
 
Example 5
Source File: AbstractCloudFoundryDeployer.java    From spring-cloud-deployer-cloudfoundry with Apache License 2.0 4 votes vote down vote up
int diskQuota(AppDeploymentRequest request) {
	String withUnit = request.getDeploymentProperties()
		.getOrDefault(AppDeployer.DISK_PROPERTY_KEY, this.deploymentProperties.getDisk());
	return (int) ByteSizeUtils.parseToMebibytes(withUnit);
}