From 09e62b52feb8d090fe5b91e761a1d74674c02f73 Mon Sep 17 00:00:00 2001 From: Remigiusz Janeczek Date: Tue, 23 Feb 2021 14:43:09 +0100 Subject: BPGen externalize resources limit defaults config Issue-ID: DCAEGEN2-2636 Signed-off-by: Remigiusz Janeczek Change-Id: Id73b44a5b0286473ff4c2a05c7fa9586cac26c8a --- .../service/common/ResourceConfigService.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ResourceConfigService.java') diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ResourceConfigService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ResourceConfigService.java index a3a9c97..ab33bfa 100644 --- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ResourceConfigService.java +++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ResourceConfigService.java @@ -4,6 +4,7 @@ * * org.onap.dcae * * ================================================================================ * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * Copyright (c) 2021 Nokia. All rights reserved. * * ================================================================================ * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. @@ -28,6 +29,7 @@ import org.onap.blueprintgenerator.model.common.GetInput; import org.onap.blueprintgenerator.model.common.ResourceConfig; import org.onap.blueprintgenerator.service.base.BlueprintHelperService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import java.util.HashMap; @@ -46,6 +48,12 @@ public class ResourceConfigService { @Autowired private BlueprintHelperService blueprintHelperService; + @Value("${resources.cpuLimit}") + private String defaultCpuLimit; + + @Value("${resources.memoryLimit}") + private String defaultMemoryLimit; + /** * Creates Resouce Config for properties * @@ -59,10 +67,10 @@ public class ResourceConfigService { ResourceConfig resourceConfig = new ResourceConfig(); LinkedHashMap memoryLimit = - blueprintHelperService.createStringInput(Constants.MEMORY_LIMIT_128Mi); + blueprintHelperService.createStringInput(defaultMemoryLimit); LinkedHashMap cpuLimit = - blueprintHelperService.createStringInput(Constants.CPU_LIMIT_250m); + blueprintHelperService.createStringInput(defaultCpuLimit); name = blueprintHelperService.getNamePrefix(name); -- cgit 1.2.3-korg