summaryrefslogtreecommitdiffstats
path: root/so-cnfm
diff options
context:
space:
mode:
authorwaqas.ikram <waqas.ikram@est.tech>2023-04-06 17:51:04 +0100
committerwaqas.ikram <waqas.ikram@est.tech>2023-04-06 17:53:26 +0100
commit0d6f08c1d3a62144f4894af22ada1c49d3947609 (patch)
tree63feda9b9c2dd9f481d464abec26bda81e9f77ca /so-cnfm
parentd57532cace7ca1201b9042e6c4f6d907bbaf7ba3 (diff)
Adding dynamic namespace support1.12.1
Change-Id: I62ea7d94043bc2f3617e8f19b4f84a9d58c20b6b Issue-ID: SO-4097 Signed-off-by: waqas.ikram <waqas.ikram@est.tech>
Diffstat (limited to 'so-cnfm')
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-api/src/main/java/org/onap/so/cnfm/lcm/model/utils/AdditionalParamsConstants.java2
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/CamundaVariableNameConstants.java1
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/helm/HelmClient.java63
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/helm/HelmClientImpl.java101
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/kubernetes/KubernetesClient.java29
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/kubernetes/KubernetesClientImpl.java211
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/kubernetes/KubernetesResourceStatusCheck.java28
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/CreateAsTask.java22
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/InstantiateAsTask.java5
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/InstantiateDeploymentItemRequest.java19
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/InstantiateDeploymentItemTask.java37
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/MonitorHelmInstallStatusTask.java23
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/MonitorHelmUnInstallStatusTask.java20
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/TerminateAsTask.java3
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/TerminateDeploymentItemRequest.java15
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/TerminateDeploymentItemTask.java9
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/resources/InstantiateDeploymentItem.bpmn3
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/resources/TerminateDeploymentItem.bpmn21
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/helm/HelmClientTest.java39
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/kubernetes/KubernetesClientTest.java73
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/CreateAsTaskTest.java2
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/DeleteAsTaskTest.java12
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/InstantiateAsTaskTest.java103
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/MockedHelmClient.java16
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/TerminateAsTaskTest.java57
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/AsInst.java22
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/resources/db/migration/V1_1__create_cnfm_tables.sql1
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/test/java/org/onap/so/cnfm/lcm/database/service/DatabaseServiceProviderTest.java16
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-service/src/test/java/org/onap/so/cnfm/lcm/rest/AsLcmOperationOccurrencesControllerTest.java2
29 files changed, 556 insertions, 399 deletions
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-api/src/main/java/org/onap/so/cnfm/lcm/model/utils/AdditionalParamsConstants.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-api/src/main/java/org/onap/so/cnfm/lcm/model/utils/AdditionalParamsConstants.java
index ce0e615..99bef60 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-api/src/main/java/org/onap/so/cnfm/lcm/model/utils/AdditionalParamsConstants.java
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-api/src/main/java/org/onap/so/cnfm/lcm/model/utils/AdditionalParamsConstants.java
@@ -33,6 +33,8 @@ public class AdditionalParamsConstants {
public static final String TENANT_ID_PARAM_KEY = "tenantId";
public static final String RESOURCE_ID_KEY = "resourceId";
+ public static final String NAMESPACE_KEY = "namespace";
+
private AdditionalParamsConstants() {}
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/CamundaVariableNameConstants.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/CamundaVariableNameConstants.java
index 47c5795..1a90fb5 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/CamundaVariableNameConstants.java
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/CamundaVariableNameConstants.java
@@ -31,6 +31,7 @@ public class CamundaVariableNameConstants {
public static final String KUBE_KINDS_PARAM_NAME = "kubeKinds";
public static final String KIND_PARAM_NAME = "kind";
public static final String RELEASE_NAME_PARAM_NAME = "releaseName";
+ public static final String NAMESPACE_PARAM_NAME = "namespace";
public static final String JOB_ID_PARAM_NAME = "jobId";
public static final String JOB_BUSINESS_KEY_PARAM_NAME = "jobBusinessKey";
public static final String CREATE_AS_REQUEST_PARAM_NAME = "createAsRequest";
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/helm/HelmClient.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/helm/HelmClient.java
index db5d092..67ce91b 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/helm/HelmClient.java
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/helm/HelmClient.java
@@ -32,17 +32,64 @@ import org.onap.so.cnfm.lcm.bpmn.flows.exceptions.HelmClientExecuteException;
*/
public interface HelmClient {
- void runHelmChartInstallWithDryRunFlag(final String releaseName, final Path kubeconfig, final Path helmChart)
- throws HelmClientExecuteException;
+ /**
+ * Execute <a href="https://helm.sh/docs/helm/helm_install/">helm install</a> with dry run flag
+ *
+ * @param namespace Namespace scope for this request
+ * @param releaseName Name of the release given to helm install
+ * @param kubeconfig kubernetes configuration file path
+ * @param helmChart path of the helm chart to install
+ *
+ * @throws HelmClientExecuteException when exception occurs while executing command
+ */
+ void runHelmChartInstallWithDryRunFlag(final String namespace, final String releaseName, final Path kubeconfig,
+ final Path helmChart) throws HelmClientExecuteException;
- List<String> getKubeKinds(final String releaseName, final Path kubeconfig, final Path helmChart)
- throws HelmClientExecuteException;
+ /**
+ * Retrieve kube kinds using <a href="https://helm.sh/docs/helm/helm_template/">helm template</a> with dry run and
+ * skip-tests flag
+ *
+ *
+ * @param namespace Namespace scope for this request
+ * @param releaseName Name of the release given to helm install
+ * @param kubeconfig kubernetes configuration file path
+ * @param helmChart path of the helm chart to install
+ *
+ * @return Resources for helmChart as a List of strings
+ */
+ List<String> getKubeKinds(final String namespace, final String releaseName, final Path kubeconfig,
+ final Path helmChart) throws HelmClientExecuteException;
- List<String> getKubeKindsUsingManifestCommand(final String releaseName, final Path kubeconfig)
- throws HelmClientExecuteException;
+ /**
+ * Retrieve kube kinds using <a href="https://helm.sh/docs/helm/helm_get_manifest/">helm get manifest</a>
+ *
+ * @param namespace Namespace scope for this request
+ * @param releaseName Name of the release given to helm install
+ * @param kubeconfig kubernetes configuration file path
+ * @return
+ * @throws HelmClientExecuteException
+ */
+ List<String> getKubeKindsUsingManifestCommand(final String namespace, final String releaseName,
+ final Path kubeconfig) throws HelmClientExecuteException;
- void installHelmChart(final String releaseName, final Path kubeconfig, final Path helmChart,
+ /**
+ * @param namespace Namespace scope for this request
+ * @param releaseName Name of the release given to helm install
+ * @param kubeconfig kubernetes configuration file path
+ * @param helmChart path of the helm chart to install
+ * @param lifeCycleParams override values in a chart
+ * @throws HelmClientExecuteException
+ */
+ void installHelmChart(final String namespace, final String releaseName, final Path kubeconfig, final Path helmChart,
final Map<String, String> lifeCycleParams) throws HelmClientExecuteException;
- void unInstallHelmChart(final String releaseName, final Path kubeConfigFilePath) throws HelmClientExecuteException;
+ /**
+ *
+ * @param namespace Namespace scope for this request
+ * @param releaseName Name of the release given to helm install
+ * @param kubeConfigFilePath kubernetes configuration file path
+ * @throws HelmClientExecuteException
+ */
+ void unInstallHelmChart(final String namespace, final String releaseName, final Path kubeConfigFilePath)
+ throws HelmClientExecuteException;
}
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/helm/HelmClientImpl.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/helm/HelmClientImpl.java
index b43bda6..e53a7c6 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/helm/HelmClientImpl.java
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/helm/HelmClientImpl.java
@@ -46,7 +46,6 @@ import org.springframework.stereotype.Service;
@Service
public class HelmClientImpl implements HelmClient {
- private static final String DEFAULT_NAMESPACE = "default";
private static final String KIND_KEY = "kind: ";
private static final String ANY_UNICODE_NEWLINE = "\\R";
private static final Logger logger = LoggerFactory.getLogger(HelmClientImpl.class);
@@ -60,37 +59,23 @@ public class HelmClientImpl implements HelmClient {
private static final Set<String> SUPPORTED_KINDS = Set.of(KIND_JOB, KIND_POD, KIND_SERVICE, KIND_DEPLOYMENT,
KIND_REPLICA_SET, KIND_DAEMON_SET, KIND_STATEFUL_SET);
- /**
- * Execute a helm install dry run
- *
- * @param releaseName Name of the release given to helm install
- * @param kubeconfig kubernetes configuration file path
- * @param helmChart path of the helm chart to install
- *
- * @throws HelmClientExecuteException when exception occurs on executing command
- */
@Override
- public void runHelmChartInstallWithDryRunFlag(final String releaseName, final Path kubeconfig, final Path helmChart)
- throws HelmClientExecuteException {
- logger.info("Running dry-run on {} to cluster {} using releaseName: {}", helmChart, kubeconfig, releaseName);
- final ProcessBuilder processBuilder = prepareDryRunCommand(releaseName, kubeconfig, helmChart);
+ public void runHelmChartInstallWithDryRunFlag(final String namespace, final String releaseName,
+ final Path kubeconfig, final Path helmChart) throws HelmClientExecuteException {
+ logger.info("Running dry-run on {} to cluster {} using namespace: {}, releaseName: {}", helmChart, kubeconfig,
+ namespace, releaseName);
+ final ProcessBuilder processBuilder = prepareDryRunCommand(namespace, releaseName, kubeconfig, helmChart);
executeCommand(processBuilder);
logger.info("Successfully ran dry for Chart {}", helmChart);
}
- /**
- *
- * @param releaseName Name of the release given to helm install
- * @param kubeconfig kubernetes configuration file path
- * @param helmChart path of the helm chart to install
- *
- * @return Resources for helmChart as a List of strings
- */
@Override
- public List<String> getKubeKinds(final String releaseName, final Path kubeconfig, final Path helmChart) {
- logger.info("Retrieving kinds from chart {} using releaseName {}", helmChart, releaseName);
- final ProcessBuilder processBuilder = prepareKubeKindCommand(releaseName, kubeconfig, helmChart);
+ public List<String> getKubeKinds(final String namespace, final String releaseName, final Path kubeconfig,
+ final Path helmChart) {
+ logger.info("Retrieving kinds from chart {} using namespace: {}, releaseName {}", helmChart, namespace,
+ releaseName);
+ final ProcessBuilder processBuilder = prepareKubeKindCommand(namespace, releaseName, kubeconfig, helmChart);
final String response = executeCommand(processBuilder);
if (StringUtils.isEmpty(response)) {
logger.warn("Response is empty: {}", response);
@@ -104,11 +89,12 @@ public class HelmClientImpl implements HelmClient {
@Override
- public List<String> getKubeKindsUsingManifestCommand(final String releaseName, final Path kubeConfig)
- throws HelmClientExecuteException {
- logger.info("Retrieving kinds from helm release history using releaseName {}", releaseName);
+ public List<String> getKubeKindsUsingManifestCommand(final String namespace, final String releaseName,
+ final Path kubeConfig) throws HelmClientExecuteException {
+ logger.info("Retrieving kinds from helm release history using namespace: {}, releaseName {}", namespace,
+ releaseName);
- final ProcessBuilder processBuilder = prepareGetKubeKindCommand(releaseName, kubeConfig);
+ final ProcessBuilder processBuilder = prepareGetKubeKindCommand(namespace, releaseName, kubeConfig);
final String response = executeCommand(processBuilder);
if (StringUtils.isEmpty(response)) {
logger.warn("Response is empty: {}", response);
@@ -120,35 +106,22 @@ public class HelmClientImpl implements HelmClient {
return kinds;
}
-
- /**
- *
- * @param releaseName Name of the release given to helm install
- * @param kubeconfig kubernetes configuration file path
- * @param helmChart path of the helm chart to install
- * @throws HelmClientExecuteException when exception occurs on executing command
- */
@Override
- public void installHelmChart(final String releaseName, final Path kubeconfig, final Path helmChart,
- final Map<String, String> lifeCycleParams) throws HelmClientExecuteException {
+ public void installHelmChart(final String namespace, final String releaseName, final Path kubeconfig,
+ final Path helmChart, final Map<String, String> lifeCycleParams) throws HelmClientExecuteException {
logger.info("Installing {} to cluster {} using releaseName: {}", helmChart, kubeconfig, releaseName);
final ProcessBuilder processBuilder =
- prepareInstallCommand(releaseName, kubeconfig, helmChart, lifeCycleParams);
+ prepareInstallCommand(namespace, releaseName, kubeconfig, helmChart, lifeCycleParams);
executeCommand(processBuilder);
logger.info("Chart {} installed successfully", helmChart);
}
- /**
- * @param releaseName Name of the release given to helm install
- * @param kubeConfigFilePath kubernetes configuration file path
- * @throws HelmClientExecuteException when exception occurs on executing command
- */
@Override
- public void unInstallHelmChart(final String releaseName, final Path kubeConfigFilePath)
+ public void unInstallHelmChart(final String namespace, final String releaseName, final Path kubeConfigFilePath)
throws HelmClientExecuteException {
logger.info("uninstalling the release {} from cluster {}", releaseName, kubeConfigFilePath);
- final ProcessBuilder processBuilder = prepareUnInstallCommand(releaseName, kubeConfigFilePath);
+ final ProcessBuilder processBuilder = prepareUnInstallCommand(namespace, releaseName, kubeConfigFilePath);
final String commandResponse = executeCommand(processBuilder);
if (!StringUtils.isEmpty(commandResponse) && commandResponse.contains("Release not loaded")) {
throw new HelmClientExecuteException(
@@ -158,15 +131,16 @@ public class HelmClientImpl implements HelmClient {
logger.info("Release {} uninstalled successfully", releaseName);
}
- private ProcessBuilder prepareDryRunCommand(final String releaseName, final Path kubeconfig, final Path helmChart) {
- final List<String> helmArguments = List.of("helm", "install", releaseName, "-n", DEFAULT_NAMESPACE,
+ private ProcessBuilder prepareDryRunCommand(final String namespace, final String releaseName, final Path kubeconfig,
+ final Path helmChart) {
+ final List<String> helmArguments = List.of("helm", "install", releaseName, "-n", namespace,
helmChart.toString(), "--dry-run", "--kubeconfig", kubeconfig.toString());
return getProcessBuilder().command(helmArguments);
}
- private ProcessBuilder prepareInstallCommand(final String releaseName, final Path kubeconfig, final Path helmChart,
- final Map<String, String> lifeCycleParams) {
- final List<String> commands = new ArrayList<>(List.of("helm", "install", releaseName, "-n", DEFAULT_NAMESPACE,
+ private ProcessBuilder prepareInstallCommand(final String namespace, final String releaseName,
+ final Path kubeconfig, final Path helmChart, final Map<String, String> lifeCycleParams) {
+ final List<String> commands = new ArrayList<>(List.of("helm", "install", releaseName, "-n", namespace,
helmChart.toString(), "--kubeconfig", kubeconfig.toString()));
if (lifeCycleParams != null && !lifeCycleParams.isEmpty()) {
@@ -190,25 +164,26 @@ public class HelmClientImpl implements HelmClient {
}
}
- private ProcessBuilder prepareUnInstallCommand(final String releaseName, final Path kubeConfig) {
+ private ProcessBuilder prepareUnInstallCommand(final String namespace, final String releaseName,
+ final Path kubeConfig) {
logger.debug("Will remove tis log after checking ubeconfig path: {}", kubeConfig.toFile().getName());
- final List<String> helmArguments = new ArrayList<>(List.of("helm", "uninstall", releaseName, "-n",
- DEFAULT_NAMESPACE, "--kubeconfig", kubeConfig.toString()));
+ final List<String> helmArguments = new ArrayList<>(
+ List.of("helm", "uninstall", releaseName, "-n", namespace, "--kubeconfig", kubeConfig.toString()));
return getProcessBuilder().command(helmArguments);
}
- private ProcessBuilder prepareKubeKindCommand(final String releaseName, final Path kubeconfig,
- final Path helmChart) {
- final List<String> commands =
- List.of("helm", "template", releaseName, "-n", DEFAULT_NAMESPACE, helmChart.toString(), "--dry-run",
- "--kubeconfig", kubeconfig.toString(), "--skip-tests", "| grep kind | uniq");
+ private ProcessBuilder prepareKubeKindCommand(final String namespace, final String releaseName,
+ final Path kubeconfig, final Path helmChart) {
+ final List<String> commands = List.of("helm", "template", releaseName, "-n", namespace, helmChart.toString(),
+ "--dry-run", "--kubeconfig", kubeconfig.toString(), "--skip-tests", "| grep kind | uniq");
final List<String> helmArguments = List.of("sh", "-c", toString(commands));
return getProcessBuilder().command(helmArguments);
}
- private ProcessBuilder prepareGetKubeKindCommand(final String releaseName, final Path kubeconfig) {
- final List<String> commands = List.of("helm", "get", "manifest", releaseName, "-n", DEFAULT_NAMESPACE,
- "--kubeconfig", kubeconfig.toString(), "| grep kind | uniq");
+ private ProcessBuilder prepareGetKubeKindCommand(final String namespace, final String releaseName,
+ final Path kubeconfig) {
+ final List<String> commands = List.of("helm", "get", "manifest", releaseName, "-n", namespace, "--kubeconfig",
+ kubeconfig.toString(), "| grep kind | uniq");
final List<String> helmArguments = List.of("sh", "-c", toString(commands));
return getProcessBuilder().command(helmArguments);
}
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/kubernetes/KubernetesClient.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/kubernetes/KubernetesClient.java
index d4a3425..5efeaef 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/kubernetes/KubernetesClient.java
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/kubernetes/KubernetesClient.java
@@ -30,26 +30,25 @@ import io.kubernetes.client.openapi.ApiClient;
*/
public interface KubernetesClient extends KubernetesResourceStatusCheck {
- List<KubernetesResource> getJobResources(final ApiClient apiClient, final String labelSelector)
- throws KubernetesRequestProcessingException;
+ List<KubernetesResource> getJobResources(final ApiClient apiClient, final String namespace,
+ final String labelSelector) throws KubernetesRequestProcessingException;
- List<KubernetesResource> getDeploymentResources(final ApiClient apiClient, final String labelSelector)
- throws KubernetesRequestProcessingException;
+ List<KubernetesResource> getDeploymentResources(final ApiClient apiClient, final String namespace,
+ final String labelSelector) throws KubernetesRequestProcessingException;
- List<KubernetesResource> getPodResources(final ApiClient apiClient, final String labelSelector)
- throws KubernetesRequestProcessingException;
+ List<KubernetesResource> getPodResources(final ApiClient apiClient, final String namespace,
+ final String labelSelector) throws KubernetesRequestProcessingException;
- List<KubernetesResource> getServiceResources(final ApiClient apiClient, final String labelSelector)
- throws KubernetesRequestProcessingException;
+ List<KubernetesResource> getServiceResources(final ApiClient apiClient, final String namespace,
+ final String labelSelector) throws KubernetesRequestProcessingException;
- List<KubernetesResource> getReplicaSetResources(final ApiClient apiClient, final String labelSelector)
- throws KubernetesRequestProcessingException;
+ List<KubernetesResource> getReplicaSetResources(final ApiClient apiClient, final String namespace,
+ final String labelSelector) throws KubernetesRequestProcessingException;
- List<KubernetesResource> getDaemonSetResources(final ApiClient apiClient, final String labelSelector)
- throws KubernetesRequestProcessingException;
-
- List<KubernetesResource> getStatefulSetResources(final ApiClient apiClient, final String labelSelector)
- throws KubernetesRequestProcessingException;
+ List<KubernetesResource> getDaemonSetResources(final ApiClient apiClient, final String namespace,
+ final String labelSelector) throws KubernetesRequestProcessingException;
+ List<KubernetesResource> getStatefulSetResources(final ApiClient apiClient, final String namespace,
+ final String labelSelector) throws KubernetesRequestProcessingException;
}
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/kubernetes/KubernetesClientImpl.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/kubernetes/KubernetesClientImpl.java
index 5018091..2f4e1b9 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/kubernetes/KubernetesClientImpl.java
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/kubernetes/KubernetesClientImpl.java
@@ -114,13 +114,14 @@ public class KubernetesClientImpl implements KubernetesClient {
private Integer timeoutSeconds;
@Override
- public boolean isJobReady(final ApiClient apiClient, final String labelSelector)
+ public boolean isJobReady(final ApiClient apiClient, final String namespace, final String labelSelector)
throws KubernetesRequestProcessingException {
- logger.debug("Will check if Job is ready using labelSelector: {}", labelSelector);
+
+ logger.debug("Will check if Job is ready using namespace: {}, labelSelector: {}", namespace, labelSelector);
try {
final BatchV1Api batchV1Api = new BatchV1Api(apiClient);
- final Call call = batchV1Api.listJobForAllNamespacesCall(null, null, null, labelSelector, null, null, null,
- null, timeoutSeconds, ENABLE_WATCH, null);
+ final Call call = batchV1Api.listNamespacedJobCall(namespace, null, null, null, null, labelSelector, null,
+ null, null, timeoutSeconds, ENABLE_WATCH, null);
final Map<V1Job, String> readyResources =
getReadyResources(apiClient, call, new TypeToken<Response<V1Job>>() {}.getType());
@@ -134,9 +135,9 @@ public class KubernetesClientImpl implements KubernetesClient {
logger.debug("JobList is ready ...");
return true;
}
+
logger.debug("JobList is not yet Ready: {}", jobNotReadyList);
return false;
-
}
logger.warn("No items found in jobList : {}", readyResources);
@@ -147,18 +148,20 @@ public class KubernetesClientImpl implements KubernetesClient {
} catch (final RuntimeException runtimeException) {
handleRuntimeException(KIND_JOB, labelSelector, runtimeException);
}
+
logger.debug("Returning false as Job is not ready ...");
return false;
}
@Override
- public boolean isPodReady(final ApiClient apiClient, final String labelSelector)
+ public boolean isPodReady(final ApiClient apiClient, final String namespace, final String labelSelector)
throws KubernetesRequestProcessingException {
- logger.debug("Will check if Pod is ready using labelSelector: {}", labelSelector);
+
+ logger.debug("Will check if Pod is ready using namespace: {}, labelSelector: {}", namespace, labelSelector);
try {
final CoreV1Api coreV1Api = new CoreV1Api(apiClient);
- final Call call = coreV1Api.listPodForAllNamespacesCall(null, null, null, labelSelector, null, null, null,
- null, timeoutSeconds, ENABLE_WATCH, null);
+ final Call call = coreV1Api.listNamespacedPodCall(namespace, null, null, null, null, labelSelector, null,
+ null, null, timeoutSeconds, ENABLE_WATCH, null);
final Map<V1Pod, String> readyResources =
getReadyResources(apiClient, call, new TypeToken<Response<V1Pod>>() {}.getType());
@@ -172,9 +175,9 @@ public class KubernetesClientImpl implements KubernetesClient {
logger.debug("PodList is ready ...");
return true;
}
+
logger.debug("PodList is not yet Ready: {}", podNotReadyList);
return false;
-
}
logger.warn("No items found in podList : {}", readyResources);
@@ -187,18 +190,18 @@ public class KubernetesClientImpl implements KubernetesClient {
}
logger.debug("Returning false as Pod is not ready ...");
-
return false;
}
@Override
- public boolean isServiceReady(final ApiClient apiClient, final String labelSelector)
+ public boolean isServiceReady(final ApiClient apiClient, final String namespace, final String labelSelector)
throws KubernetesRequestProcessingException {
- logger.debug("Will check if Service is ready using labelSelector: {}", labelSelector);
+
+ logger.debug("Will check if Service is ready using namespace: {}, labelSelector: {}", namespace, labelSelector);
try {
final CoreV1Api api = new CoreV1Api(apiClient);
- final Call call = api.listServiceForAllNamespacesCall(null, null, null, labelSelector, null, null, null,
- null, timeoutSeconds, ENABLE_WATCH, null);
+ final Call call = api.listNamespacedServiceCall(namespace, null, null, null, null, labelSelector, null,
+ null, null, timeoutSeconds, ENABLE_WATCH, null);
final Map<V1Service, String> readyResources =
getReadyResources(apiClient, call, new TypeToken<Response<V1Service>>() {}.getType());
@@ -212,9 +215,9 @@ public class KubernetesClientImpl implements KubernetesClient {
logger.debug("ServiceList is ready ...");
return true;
}
+
logger.debug("ServiceList is not yet Ready: {}", serviceNotReadyList);
return false;
-
}
logger.warn("No items found in serviceList : {}", readyResources);
@@ -231,14 +234,15 @@ public class KubernetesClientImpl implements KubernetesClient {
}
@Override
- public boolean isDeploymentReady(final ApiClient apiClient, final String labelSelector)
+ public boolean isDeploymentReady(final ApiClient apiClient, final String namespace, final String labelSelector)
throws KubernetesRequestProcessingException {
- logger.debug("Will check if Deployment is ready using labelSelector: {}", labelSelector);
+ logger.debug("Will check if Deployment is ready using namespace: {}, labelSelector: {}", namespace,
+ labelSelector);
try {
final AppsV1Api appsV1Api = new AppsV1Api(apiClient);
- final Call call = appsV1Api.listDeploymentForAllNamespacesCall(null, null, null, labelSelector, null, null,
- null, null, timeoutSeconds, ENABLE_WATCH, null);
+ final Call call = appsV1Api.listNamespacedDeploymentCall(namespace, null, null, null, null, labelSelector,
+ null, null, null, timeoutSeconds, ENABLE_WATCH, null);
final Map<V1Deployment, String> readyResources =
getReadyResources(apiClient, call, new TypeToken<Response<V1Deployment>>() {}.getType());
@@ -252,9 +256,9 @@ public class KubernetesClientImpl implements KubernetesClient {
logger.debug("DeploymentList is ready ...");
return true;
}
+
logger.debug("DeploymentList is not yet Ready: {}", deploymentNotReadyList);
return false;
-
}
logger.warn("No items found in deploymentList : {}", readyResources);
@@ -271,13 +275,15 @@ public class KubernetesClientImpl implements KubernetesClient {
}
@Override
- public boolean isReplicaSetReady(final ApiClient apiClient, final String labelSelector)
+ public boolean isReplicaSetReady(final ApiClient apiClient, final String namespace, final String labelSelector)
throws KubernetesRequestProcessingException {
- logger.debug("Will check if ReplicaSet is ready using labelSelector: {}", labelSelector);
+
+ logger.debug("Will check if ReplicaSet is ready using namespace: {}, labelSelector: {}", namespace,
+ labelSelector);
try {
final AppsV1Api appsV1Api = new AppsV1Api(apiClient);
- final Call call = appsV1Api.listReplicaSetForAllNamespacesCall(null, null, null, labelSelector, null, null,
- null, null, timeoutSeconds, ENABLE_WATCH, null);
+ final Call call = appsV1Api.listNamespacedReplicaSetCall(namespace, null, null, null, null, labelSelector,
+ null, null, null, timeoutSeconds, ENABLE_WATCH, null);
final Map<V1ReplicaSet, String> readyResources =
getReadyResources(apiClient, call, new TypeToken<Response<V1ReplicaSet>>() {}.getType());
@@ -291,9 +297,9 @@ public class KubernetesClientImpl implements KubernetesClient {
logger.debug("ReplicaSetList is ready ...");
return true;
}
+
logger.debug("ReplicaSetList is not yet Ready: {}", replicaSet);
return false;
-
}
logger.warn("No items found in replicaSetList : {}", readyResources);
@@ -304,18 +310,21 @@ public class KubernetesClientImpl implements KubernetesClient {
} catch (final RuntimeException runtimeException) {
handleRuntimeException(KIND_REPLICA_SET, labelSelector, runtimeException);
}
+
logger.debug("Returning false as ReplicaSet is not ready ...");
return false;
}
@Override
- public boolean isDaemonSetReady(final ApiClient apiClient, final String labelSelector)
+ public boolean isDaemonSetReady(final ApiClient apiClient, final String namespace, final String labelSelector)
throws KubernetesRequestProcessingException {
- logger.debug("Will check if DaemonSet is ready using labelSelector: {}", labelSelector);
+
+ logger.debug("Will check if DaemonSet is ready using namespace: {}, labelSelector: {}", namespace,
+ labelSelector);
try {
final AppsV1Api appsV1Api = new AppsV1Api(apiClient);
- final Call call = appsV1Api.listDaemonSetForAllNamespacesCall(null, null, null, labelSelector, null, null,
- null, null, timeoutSeconds, ENABLE_WATCH, null);
+ final Call call = appsV1Api.listNamespacedDaemonSetCall(namespace, null, null, null, null, labelSelector,
+ null, null, null, timeoutSeconds, ENABLE_WATCH, null);
final Map<V1DaemonSet, String> readyResources =
getReadyResources(apiClient, call, new TypeToken<Response<V1DaemonSet>>() {}.getType());
@@ -329,9 +338,9 @@ public class KubernetesClientImpl implements KubernetesClient {
logger.debug("DaemonSetList is ready ...");
return true;
}
+
logger.debug("DaemonSetList is not yet Ready: {}", daemonSetNotReadyList);
return false;
-
}
logger.warn("No items found in daemonSetList : {}", readyResources);
@@ -342,18 +351,21 @@ public class KubernetesClientImpl implements KubernetesClient {
} catch (final RuntimeException runtimeException) {
handleRuntimeException(KIND_DAEMON_SET, labelSelector, runtimeException);
}
+
logger.debug("Returning false as DaemonSet is not ready ...");
return false;
}
@Override
- public boolean isStatefulSetReady(final ApiClient apiClient, final String labelSelector)
+ public boolean isStatefulSetReady(final ApiClient apiClient, final String namespace, final String labelSelector)
throws KubernetesRequestProcessingException {
- logger.debug("Will check if StatefulSet is ready using labelSelector: {}", labelSelector);
+
+ logger.debug("Will check if StatefulSet is ready using namespace: {}, labelSelector: {}", namespace,
+ labelSelector);
try {
final AppsV1Api appsV1Api = new AppsV1Api(apiClient);
- final Call call = appsV1Api.listStatefulSetForAllNamespacesCall(null, null, null, labelSelector, null, null,
- null, null, timeoutSeconds, ENABLE_WATCH, null);
+ final Call call = appsV1Api.listNamespacedStatefulSetCall(namespace, null, null, null, null, labelSelector,
+ null, null, null, timeoutSeconds, ENABLE_WATCH, null);
final Map<V1StatefulSet, String> readyResources =
getReadyResources(apiClient, call, new TypeToken<Response<V1StatefulSet>>() {}.getType());
@@ -385,13 +397,14 @@ public class KubernetesClientImpl implements KubernetesClient {
}
@Override
- public boolean isServiceDeleted(final ApiClient apiClient, final String labelSelector)
+ public boolean isServiceDeleted(final ApiClient apiClient, final String namespace, final String labelSelector)
throws KubernetesRequestProcessingException {
- logger.debug("Check is Service deleted by using labelSelector: {}", labelSelector);
+
+ logger.debug("Check is Service deleted by using namespace: {}, labelSelector: {}", namespace, labelSelector);
try {
final CoreV1Api coreV1Api = new CoreV1Api(apiClient);
- final V1ServiceList v1ServiceList = coreV1Api.listServiceForAllNamespaces(null, null, null, labelSelector,
- null, null, null, null, timeoutSeconds, DISABLE_WATCH);
+ final V1ServiceList v1ServiceList = coreV1Api.listNamespacedService(namespace, null, null, null, null,
+ labelSelector, null, null, null, timeoutSeconds, DISABLE_WATCH);
logger.debug("Response from list service for all Namespaces: {}", v1ServiceList);
return v1ServiceList.getItems().isEmpty();
} catch (final ApiException exception) {
@@ -404,13 +417,14 @@ public class KubernetesClientImpl implements KubernetesClient {
}
@Override
- public boolean isPodDeleted(final ApiClient apiClient, final String labelSelector)
+ public boolean isPodDeleted(final ApiClient apiClient, final String namespace, final String labelSelector)
throws KubernetesRequestProcessingException {
- logger.debug("Check is Pod deleted by using labelSelector: {}", labelSelector);
+
+ logger.debug("Check is Pod deleted by using namespace: {}, labelSelector: {}", namespace, labelSelector);
try {
final CoreV1Api coreV1Api = new CoreV1Api(apiClient);
- final V1PodList v1PodList = coreV1Api.listPodForAllNamespaces(null, null, null, labelSelector, null, null,
- null, null, timeoutSeconds, DISABLE_WATCH);
+ final V1PodList v1PodList = coreV1Api.listNamespacedPod(namespace, null, null, null, null, labelSelector,
+ null, null, null, timeoutSeconds, DISABLE_WATCH);
logger.debug("Response from list Pod for all Namespaces: {}", v1PodList);
return v1PodList.getItems().isEmpty();
} catch (final ApiException exception) {
@@ -423,13 +437,13 @@ public class KubernetesClientImpl implements KubernetesClient {
}
@Override
- public boolean isJobDeleted(final ApiClient apiClient, final String labelSelector)
+ public boolean isJobDeleted(final ApiClient apiClient, final String namespace, final String labelSelector)
throws KubernetesRequestProcessingException {
- logger.debug("Check is Job deleted by using labelSelector: {}", labelSelector);
+ logger.debug("Check is Job deleted by using namespace: {}, labelSelector: {}", namespace, labelSelector);
try {
final BatchV1Api batchV1Api = new BatchV1Api(apiClient);
- final V1JobList v1JobList = batchV1Api.listJobForAllNamespaces(null, null, null, labelSelector, null, null,
- null, null, timeoutSeconds, DISABLE_WATCH);
+ final V1JobList v1JobList = batchV1Api.listNamespacedJob(namespace, null, null, null, null, labelSelector,
+ null, null, null, timeoutSeconds, DISABLE_WATCH);
logger.debug("Response from list Job for all Namespaces: {}", v1JobList);
return v1JobList.getItems().isEmpty();
} catch (final ApiException exception) {
@@ -442,13 +456,13 @@ public class KubernetesClientImpl implements KubernetesClient {
}
@Override
- public boolean isDeploymentDeleted(final ApiClient apiClient, final String labelSelector)
+ public boolean isDeploymentDeleted(final ApiClient apiClient, final String namespace, final String labelSelector)
throws KubernetesRequestProcessingException {
- logger.debug("Check is Deployment deleted by using labelSelector: {}", labelSelector);
+ logger.debug("Check is Deployment deleted by using namespace: {}, labelSelector: {}", namespace, labelSelector);
try {
final AppsV1Api batchV1Api = new AppsV1Api(apiClient);
- final V1DeploymentList v1DeploymentList = batchV1Api.listDeploymentForAllNamespaces(null, null, null,
- labelSelector, null, null, null, null, timeoutSeconds, DISABLE_WATCH);
+ final V1DeploymentList v1DeploymentList = batchV1Api.listNamespacedDeployment(namespace, null, null, null,
+ null, labelSelector, null, null, null, timeoutSeconds, DISABLE_WATCH);
logger.debug("Response from list Deployment for all Namespaces: {}", v1DeploymentList);
return v1DeploymentList.getItems().isEmpty();
} catch (final ApiException exception) {
@@ -461,13 +475,13 @@ public class KubernetesClientImpl implements KubernetesClient {
}
@Override
- public boolean isReplicaSetDeleted(final ApiClient apiClient, final String labelSelector)
+ public boolean isReplicaSetDeleted(final ApiClient apiClient, final String namespace, final String labelSelector)
throws KubernetesRequestProcessingException {
- logger.debug("Check is ReplicaSet deleted by using labelSelector: {}", labelSelector);
+ logger.debug("Check is ReplicaSet deleted by using namespace: {}, labelSelector: {}", namespace, labelSelector);
try {
final AppsV1Api batchV1Api = new AppsV1Api(apiClient);
- final V1ReplicaSetList v1ReplicaSetList = batchV1Api.listReplicaSetForAllNamespaces(null, null, null,
- labelSelector, null, null, null, null, timeoutSeconds, DISABLE_WATCH);
+ final V1ReplicaSetList v1ReplicaSetList = batchV1Api.listNamespacedReplicaSet(namespace, null, null, null,
+ null, labelSelector, null, null, null, timeoutSeconds, DISABLE_WATCH);
logger.debug("Response from list ReplicaSet for all Namespaces: {}", v1ReplicaSetList);
return v1ReplicaSetList.getItems().isEmpty();
} catch (final ApiException exception) {
@@ -480,13 +494,13 @@ public class KubernetesClientImpl implements KubernetesClient {
}
@Override
- public boolean isDaemonSetDeleted(final ApiClient apiClient, final String labelSelector)
+ public boolean isDaemonSetDeleted(final ApiClient apiClient, final String namespace, final String labelSelector)
throws KubernetesRequestProcessingException {
- logger.debug("Check is DaemonSet deleted by using labelSelector: {}", labelSelector);
+ logger.debug("Check is DaemonSet deleted by using namespace: {}, labelSelector: {}", namespace, labelSelector);
try {
final AppsV1Api batchV1Api = new AppsV1Api(apiClient);
- final V1DaemonSetList v1DaemonSetList = batchV1Api.listDaemonSetForAllNamespaces(null, null, null,
- labelSelector, null, null, null, null, timeoutSeconds, DISABLE_WATCH);
+ final V1DaemonSetList v1DaemonSetList = batchV1Api.listNamespacedDaemonSet(namespace, null, null, null,
+ null, labelSelector, null, null, null, timeoutSeconds, DISABLE_WATCH);
logger.debug("Response from list DaemonSet for all Namespaces: {}", v1DaemonSetList);
return v1DaemonSetList.getItems().isEmpty();
} catch (final ApiException exception) {
@@ -499,13 +513,14 @@ public class KubernetesClientImpl implements KubernetesClient {
}
@Override
- public boolean isStatefulSetDeleted(final ApiClient apiClient, final String labelSelector)
+ public boolean isStatefulSetDeleted(final ApiClient apiClient, final String namespace, final String labelSelector)
throws KubernetesRequestProcessingException {
- logger.debug("Check is StatefulSet deleted by using labelSelector: {}", labelSelector);
+ logger.debug("Check is StatefulSet deleted by using namespace: {}, labelSelector: {}", namespace,
+ labelSelector);
try {
final AppsV1Api batchV1Api = new AppsV1Api(apiClient);
- final V1StatefulSetList v1StatefulSetList = batchV1Api.listStatefulSetForAllNamespaces(null, null, null,
- labelSelector, null, null, null, null, timeoutSeconds, DISABLE_WATCH);
+ final V1StatefulSetList v1StatefulSetList = batchV1Api.listNamespacedStatefulSet(namespace, null, null,
+ null, null, labelSelector, null, null, null, timeoutSeconds, DISABLE_WATCH);
logger.debug("Response from list StatefulSet for all Namespaces: {}", v1StatefulSetList);
return v1StatefulSetList.getItems().isEmpty();
} catch (final ApiException exception) {
@@ -519,13 +534,13 @@ public class KubernetesClientImpl implements KubernetesClient {
@Override
- public List<KubernetesResource> getJobResources(final ApiClient apiClient, final String labelSelector)
- throws KubernetesRequestProcessingException {
- logger.debug("Retrieving Jobs using labelSelector: {}", labelSelector);
+ public List<KubernetesResource> getJobResources(final ApiClient apiClient, final String namespace,
+ final String labelSelector) throws KubernetesRequestProcessingException {
+ logger.debug("Retrieving Jobs using namespace: {}, labelSelector: {}", namespace, labelSelector);
try {
final BatchV1Api batchV1Api = new BatchV1Api(apiClient);
- final V1JobList jobList = batchV1Api.listJobForAllNamespaces(null, null, null, labelSelector, null, null,
- null, null, timeoutSeconds, DISABLE_WATCH);
+ final V1JobList jobList = batchV1Api.listNamespacedJob(namespace, null, null, null, null, labelSelector,
+ null, null, null, timeoutSeconds, DISABLE_WATCH);
logger.debug("Received Jobs: {}", jobList);
return getKubernetesResource(jobList);
@@ -543,13 +558,13 @@ public class KubernetesClientImpl implements KubernetesClient {
}
@Override
- public List<KubernetesResource> getDeploymentResources(final ApiClient apiClient, final String labelSelector)
- throws KubernetesRequestProcessingException {
- logger.debug("Retrieving Deployment using labelSelector: {}", labelSelector);
+ public List<KubernetesResource> getDeploymentResources(final ApiClient apiClient, final String namespace,
+ final String labelSelector) throws KubernetesRequestProcessingException {
+ logger.debug("Retrieving Deployment using namespace: {}, labelSelector: {}", namespace, labelSelector);
try {
final AppsV1Api appsV1Api = new AppsV1Api(apiClient);
- final V1DeploymentList deploymentList = appsV1Api.listDeploymentForAllNamespaces(null, null, null,
- labelSelector, null, null, null, null, timeoutSeconds, DISABLE_WATCH);
+ final V1DeploymentList deploymentList = appsV1Api.listNamespacedDeployment(namespace, null, null, null,
+ null, labelSelector, null, null, null, timeoutSeconds, DISABLE_WATCH);
logger.debug("Received Deployments: {}", deploymentList);
return getKubernetesResource(deploymentList);
@@ -567,13 +582,13 @@ public class KubernetesClientImpl implements KubernetesClient {
}
@Override
- public List<KubernetesResource> getPodResources(final ApiClient apiClient, final String labelSelector)
- throws KubernetesRequestProcessingException {
- logger.debug("Retrieving Pod using labelSelector: {}", labelSelector);
+ public List<KubernetesResource> getPodResources(final ApiClient apiClient, final String namespace,
+ final String labelSelector) throws KubernetesRequestProcessingException {
+ logger.debug("Retrieving Pod using namespace: {}, labelSelector: {}", namespace, labelSelector);
try {
final CoreV1Api coreV1Api = new CoreV1Api(apiClient);
- final V1PodList podList = coreV1Api.listPodForAllNamespaces(null, null, null, labelSelector, null, null,
- null, null, timeoutSeconds, DISABLE_WATCH);
+ final V1PodList podList = coreV1Api.listNamespacedPod(namespace, null, null, null, null, labelSelector,
+ null, null, null, timeoutSeconds, DISABLE_WATCH);
logger.debug("Received Pods: {}", podList);
return getKubernetesResource(podList);
@@ -591,13 +606,13 @@ public class KubernetesClientImpl implements KubernetesClient {
}
@Override
- public List<KubernetesResource> getServiceResources(final ApiClient apiClient, final String labelSelector)
- throws KubernetesRequestProcessingException {
- logger.debug("Retrieving Service using labelSelector: {}", labelSelector);
+ public List<KubernetesResource> getServiceResources(final ApiClient apiClient, final String namespace,
+ final String labelSelector) throws KubernetesRequestProcessingException {
+ logger.debug("Retrieving Service using namespace: {}, labelSelector: {}", namespace, labelSelector);
try {
final CoreV1Api coreV1Api = new CoreV1Api(apiClient);
- final V1ServiceList serviceList = coreV1Api.listServiceForAllNamespaces(null, null, null, labelSelector,
- null, null, null, null, timeoutSeconds, DISABLE_WATCH);
+ final V1ServiceList serviceList = coreV1Api.listNamespacedService(namespace, null, null, null, null,
+ labelSelector, null, null, null, timeoutSeconds, DISABLE_WATCH);
logger.debug("Received Services: {}", serviceList);
return getKubernetesResource(serviceList);
@@ -615,13 +630,13 @@ public class KubernetesClientImpl implements KubernetesClient {
}
@Override
- public List<KubernetesResource> getReplicaSetResources(final ApiClient apiClient, final String labelSelector)
- throws KubernetesRequestProcessingException {
- logger.debug("Retrieving ReplicaSet using labelSelector: {}", labelSelector);
+ public List<KubernetesResource> getReplicaSetResources(final ApiClient apiClient, final String namespace,
+ final String labelSelector) throws KubernetesRequestProcessingException {
+ logger.debug("Retrieving ReplicaSet using namespace: {}, labelSelector: {}", namespace, labelSelector);
try {
final AppsV1Api appsV1Api = new AppsV1Api(apiClient);
- final V1ReplicaSetList replicaSetList = appsV1Api.listReplicaSetForAllNamespaces(null, null, null,
- labelSelector, null, null, null, null, timeoutSeconds, DISABLE_WATCH);
+ final V1ReplicaSetList replicaSetList = appsV1Api.listNamespacedReplicaSet(namespace, null, null, null,
+ null, labelSelector, null, null, null, timeoutSeconds, DISABLE_WATCH);
logger.debug("Received ReplicaSets: {}", replicaSetList);
return getKubernetesResource(replicaSetList);
@@ -639,14 +654,14 @@ public class KubernetesClientImpl implements KubernetesClient {
}
@Override
- public List<KubernetesResource> getDaemonSetResources(final ApiClient apiClient, final String labelSelector)
- throws KubernetesRequestProcessingException {
- logger.debug("Retrieving DaemonSet using labelSelector: {}", labelSelector);
+ public List<KubernetesResource> getDaemonSetResources(final ApiClient apiClient, final String namespace,
+ final String labelSelector) throws KubernetesRequestProcessingException {
+ logger.debug("Retrieving DaemonSet using namespace: {}, labelSelector: {}", namespace, labelSelector);
try {
final AppsV1Api appsV1Api = new AppsV1Api(apiClient);
- final V1DaemonSetList daemonSetList = appsV1Api.listDaemonSetForAllNamespaces(null, null, null,
- labelSelector, null, null, null, null, timeoutSeconds, DISABLE_WATCH);
+ final V1DaemonSetList daemonSetList = appsV1Api.listNamespacedDaemonSet(namespace, null, null, null, null,
+ labelSelector, null, null, null, timeoutSeconds, DISABLE_WATCH);
logger.debug("Received DaemonSets: {}", daemonSetList);
return getKubernetesResource(daemonSetList);
@@ -664,14 +679,14 @@ public class KubernetesClientImpl implements KubernetesClient {
}
@Override
- public List<KubernetesResource> getStatefulSetResources(final ApiClient apiClient, final String labelSelector)
- throws KubernetesRequestProcessingException {
- logger.debug("Retrieving StatefulSet using labelSelector: {}", labelSelector);
+ public List<KubernetesResource> getStatefulSetResources(final ApiClient apiClient, final String namespace,
+ final String labelSelector) throws KubernetesRequestProcessingException {
+ logger.debug("Retrieving StatefulSet using namespace: {}, labelSelector: {}", namespace, labelSelector);
try {
final AppsV1Api appsV1Api = new AppsV1Api(apiClient);
- final V1StatefulSetList statefulSetList = appsV1Api.listStatefulSetForAllNamespaces(null, null, null,
- labelSelector, null, null, null, null, timeoutSeconds, DISABLE_WATCH);
+ final V1StatefulSetList statefulSetList = appsV1Api.listNamespacedStatefulSet(namespace, null, null, null,
+ null, labelSelector, null, null, null, timeoutSeconds, DISABLE_WATCH);
logger.debug("Received StatefulSets: {}", statefulSetList);
return getKubernetesResource(statefulSetList);
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/kubernetes/KubernetesResourceStatusCheck.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/kubernetes/KubernetesResourceStatusCheck.java
index b32fd65..a75957a 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/kubernetes/KubernetesResourceStatusCheck.java
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/kubernetes/KubernetesResourceStatusCheck.java
@@ -29,45 +29,45 @@ import org.onap.so.cnfm.lcm.bpmn.flows.exceptions.KubernetesRequestProcessingExc
*
*/
public interface KubernetesResourceStatusCheck {
- boolean isJobReady(final ApiClient apiClient, final String labelSelector)
+ boolean isJobReady(final ApiClient apiClient, final String namespace, final String labelSelector)
throws KubernetesRequestProcessingException;
- boolean isPodReady(final ApiClient apiClient, final String labelSelector)
+ boolean isPodReady(final ApiClient apiClient, final String namespace, final String labelSelector)
throws KubernetesRequestProcessingException;
- boolean isServiceReady(final ApiClient apiClient, final String labelSelector)
+ boolean isServiceReady(final ApiClient apiClient, final String namespace, final String labelSelector)
throws KubernetesRequestProcessingException;
- boolean isDeploymentReady(final ApiClient apiClient, final String labelSelector)
+ boolean isDeploymentReady(final ApiClient apiClient, final String namespace, final String labelSelector)
throws KubernetesRequestProcessingException;
- boolean isReplicaSetReady(final ApiClient apiClient, final String labelSelector)
+ boolean isReplicaSetReady(final ApiClient apiClient, final String namespace, final String labelSelector)
throws KubernetesRequestProcessingException;
- boolean isDaemonSetReady(final ApiClient apiClient, final String labelSelector)
+ boolean isDaemonSetReady(final ApiClient apiClient, final String namespace, final String labelSelector)
throws KubernetesRequestProcessingException;
- boolean isStatefulSetReady(final ApiClient apiClient, final String labelSelector)
+ boolean isStatefulSetReady(final ApiClient apiClient, final String namespace, final String labelSelector)
throws KubernetesRequestProcessingException;
- boolean isServiceDeleted(final ApiClient apiClient, final String labelSelector)
+ boolean isServiceDeleted(final ApiClient apiClient, final String namespace, final String labelSelector)
throws KubernetesRequestProcessingException;
- boolean isPodDeleted(final ApiClient apiClient, final String labelSelector)
+ boolean isPodDeleted(final ApiClient apiClient, final String namespace, final String labelSelector)
throws KubernetesRequestProcessingException;
- boolean isJobDeleted(final ApiClient apiClient, final String labelSelector)
+ boolean isJobDeleted(final ApiClient apiClient, final String namespace, final String labelSelector)
throws KubernetesRequestProcessingException;
- boolean isDeploymentDeleted(final ApiClient apiClient, final String labelSelector)
+ boolean isDeploymentDeleted(final ApiClient apiClient, final String namespace, final String labelSelector)
throws KubernetesRequestProcessingException;
- boolean isReplicaSetDeleted(final ApiClient apiClient, final String labelSelector)
+ boolean isReplicaSetDeleted(final ApiClient apiClient, final String namespace, final String labelSelector)
throws KubernetesRequestProcessingException;
- boolean isDaemonSetDeleted(final ApiClient apiClient, final String labelSelector)
+ boolean isDaemonSetDeleted(final ApiClient apiClient, final String namespace, final String labelSelector)
throws KubernetesRequestProcessingException;
- boolean isStatefulSetDeleted(final ApiClient apiClient, final String labelSelector)
+ boolean isStatefulSetDeleted(final ApiClient apiClient, final String namespace, final String labelSelector)
throws KubernetesRequestProcessingException;
}
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/CreateAsTask.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/CreateAsTask.java
index 6e2b489..f63ffb4 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/CreateAsTask.java
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/CreateAsTask.java
@@ -31,18 +31,18 @@ import static org.onap.so.cnfm.lcm.bpmn.flows.extclients.sdc.SdcCsarPropertiesCo
import static org.onap.so.cnfm.lcm.bpmn.flows.extclients.sdc.SdcCsarPropertiesConstants.PROVIDER_PARAM_NAME;
import static org.onap.so.cnfm.lcm.model.utils.AdditionalParamsConstants.CLOUD_OWNER_PARAM_KEY;
import static org.onap.so.cnfm.lcm.model.utils.AdditionalParamsConstants.CLOUD_REGION_PARAM_KEY;
+import static org.onap.so.cnfm.lcm.model.utils.AdditionalParamsConstants.NAMESPACE_KEY;
import static org.onap.so.cnfm.lcm.model.utils.AdditionalParamsConstants.RESOURCE_ID_KEY;
import static org.onap.so.cnfm.lcm.model.utils.AdditionalParamsConstants.SERVICE_INSTANCE_ID_PARAM_KEY;
import static org.onap.so.cnfm.lcm.model.utils.AdditionalParamsConstants.SERVICE_INSTANCE_NAME_PARAM_KEY;
import static org.onap.so.cnfm.lcm.model.utils.AdditionalParamsConstants.TENANT_ID_PARAM_KEY;
-import java.util.Arrays;
+import java.time.LocalDateTime;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
-import java.time.LocalDateTime;
-
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.so.cnfm.lcm.bpmn.flows.extclients.aai.AaiServiceProvider;
@@ -51,9 +51,9 @@ import org.onap.so.cnfm.lcm.bpmn.flows.extclients.sdc.SdcCsarPackageParser;
import org.onap.so.cnfm.lcm.bpmn.flows.extclients.sdc.SdcPackageProvider;
import org.onap.so.cnfm.lcm.database.beans.AsDeploymentItem;
import org.onap.so.cnfm.lcm.database.beans.AsInst;
+import org.onap.so.cnfm.lcm.database.beans.AsLifecycleParam;
import org.onap.so.cnfm.lcm.database.beans.JobStatusEnum;
import org.onap.so.cnfm.lcm.database.beans.State;
-import org.onap.so.cnfm.lcm.database.beans.AsLifecycleParam;
import org.onap.so.cnfm.lcm.database.service.DatabaseServiceProvider;
import org.onap.so.cnfm.lcm.model.AsInstance;
import org.onap.so.cnfm.lcm.model.AsInstance.InstantiationStateEnum;
@@ -73,6 +73,7 @@ public class CreateAsTask extends AbstractServiceTask {
private static final String ASD_PROPERTIES_PARAM_NAME = "asdProperties";
private static final String DOES_AS_PACKAGE_EXISTS_PARAM_NAME = "doesAsPackageExists";
private static final String DOES_AS_INSTANCE_EXISTS_PARAM_NAME = "doesAsInstanceExists";
+ private static final String DEFAULT_NAMESPACE = "default";
private static final Logger logger = LoggerFactory.getLogger(CreateAsTask.class);
private final AaiServiceProvider aaiServiceProvider;
@@ -180,6 +181,7 @@ public class CreateAsTask extends AbstractServiceTask {
final String cloudRegion = getMandatoryValue(additionalParams, CLOUD_REGION_PARAM_KEY, execution);
final String tenantId = getMandatoryValue(additionalParams, TENANT_ID_PARAM_KEY, execution);
final String resourceId = (String) additionalParams.get(RESOURCE_ID_KEY);
+ final String namespace = getNamespace((String) additionalParams.get(NAMESPACE_KEY));
final String serviceInstanceName =
getMandatoryValue(additionalParams, SERVICE_INSTANCE_NAME_PARAM_KEY, execution);
@@ -202,7 +204,8 @@ public class CreateAsTask extends AbstractServiceTask {
.asApplicationVersion(getParamValue(asdProperties, APPLICATION_VERSION_PARAM_NAME))
.description(createAsRequest.getAsInstanceDescription()).serviceInstanceId(serviceInstanceId)
.serviceInstanceName(serviceInstanceName).cloudOwner(cloudOwner).cloudRegion(cloudRegion)
- .tenantId(tenantId).status(State.NOT_INSTANTIATED).statusUpdatedTime(LocalDateTime.now());
+ .tenantId(tenantId).namespace(namespace).status(State.NOT_INSTANTIATED)
+ .statusUpdatedTime(LocalDateTime.now());
@SuppressWarnings("unchecked")
final List<DeploymentItem> deploymentItems =
@@ -327,6 +330,15 @@ public class CreateAsTask extends AbstractServiceTask {
return asInstId;
}
+ private String getNamespace(final String namespace) {
+ if (namespace != null && !namespace.isBlank()) {
+ logger.debug("Namespace found in additionalParams namespace: {}", namespace);
+ return namespace;
+ }
+ logger.debug("No namespace found in additionalParams, will use namespace: {}", DEFAULT_NAMESPACE);
+ return DEFAULT_NAMESPACE;
+ }
+
private String getParamValue(final Map<String, Object> properties, final String key) {
final Object object = properties.get(key);
if (object != null) {
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/InstantiateAsTask.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/InstantiateAsTask.java
index 9fa3100..e378d57 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/InstantiateAsTask.java
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/InstantiateAsTask.java
@@ -215,6 +215,8 @@ public class InstantiateAsTask extends AbstractServiceTask {
setJobStatus(execution, IN_PROGRESS, "Preparing InstantiateDeploymentItemRequest requests");
final String asInstId = (String) execution.getVariable(AS_INSTANCE_ID_PARAM_NAME);
+ final AsInst asInst = getAsInst(execution, asInstId);
+
final InstantiateAsRequest instantiateAsRequest =
(InstantiateAsRequest) execution.getVariable(INSTANTIATE_AS_REQUEST_PARAM_NAME);
@@ -254,7 +256,8 @@ public class InstantiateAsTask extends AbstractServiceTask {
requests.add(new InstantiateDeploymentItemRequest().asInstId(asInstId)
.asDeploymentItemInstId(asDeploymentItemInstId).asDeploymentItemName(asDeploymentItem.getName())
.helmArtifactFilePath(artifactFilePath).deploymentOrder(asDeploymentItem.getDeploymentOrder())
- .kubeConfigFile(kubeConfigFile).lifeCycleParameters(lifeCycleParams).releaseName((releaseName)));
+ .kubeConfigFile(kubeConfigFile).lifeCycleParameters(lifeCycleParams).releaseName((releaseName))
+ .namespace(asInst.getNamespace()));
});
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/InstantiateDeploymentItemRequest.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/InstantiateDeploymentItemRequest.java
index b7b8598..5eeef53 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/InstantiateDeploymentItemRequest.java
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/InstantiateDeploymentItemRequest.java
@@ -41,6 +41,7 @@ public class InstantiateDeploymentItemRequest implements Serializable, Comparabl
private Integer deploymentOrder;
private Map<String, String> lifeCycleParameters;
private String releaseName;
+ private String namespace;
private static final Comparator<Integer> COMPARATOR = Comparator.nullsFirst(Integer::compare);
@@ -148,10 +149,23 @@ public class InstantiateDeploymentItemRequest implements Serializable, Comparabl
return this;
}
+ public String getNamespace() {
+ return namespace;
+ }
+
+ public void setNamespace(final String namespace) {
+ this.namespace = namespace;
+ }
+
+ public InstantiateDeploymentItemRequest namespace(final String namespace) {
+ this.namespace = namespace;
+ return this;
+ }
+
@Override
public int hashCode() {
return Objects.hash(asInstId, asDeploymentItemInstId, asDeploymentItemName, helmArtifactFilePath,
- deploymentOrder, kubeConfigFile, lifeCycleParameters, releaseName);
+ deploymentOrder, kubeConfigFile, lifeCycleParameters, releaseName, namespace);
}
@Override
@@ -170,7 +184,7 @@ public class InstantiateDeploymentItemRequest implements Serializable, Comparabl
&& Objects.equals(deploymentOrder, other.deploymentOrder)
&& Objects.equals(kubeConfigFile, other.kubeConfigFile)
&& Objects.equals(lifeCycleParameters, other.lifeCycleParameters)
- && Objects.equals(releaseName, other.releaseName);
+ && Objects.equals(releaseName, other.releaseName) && Objects.equals(namespace, other.namespace);
}
return false;
}
@@ -187,6 +201,7 @@ public class InstantiateDeploymentItemRequest implements Serializable, Comparabl
sb.append(" kubeConfigFile: ").append(toIndentedString(kubeConfigFile)).append("\n");
sb.append(" LifeCycleParameters: ").append(toIndentedString(lifeCycleParameters)).append("\n");
sb.append(" releaseName: ").append(toIndentedString(releaseName)).append("\n");
+ sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n");
sb.append("}");
return sb.toString();
}
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/InstantiateDeploymentItemTask.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/InstantiateDeploymentItemTask.java
index 4017946..b8b4893 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/InstantiateDeploymentItemTask.java
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/InstantiateDeploymentItemTask.java
@@ -25,6 +25,7 @@ import static org.onap.so.cnfm.lcm.bpmn.flows.CamundaVariableNameConstants.AS_IN
import static org.onap.so.cnfm.lcm.bpmn.flows.CamundaVariableNameConstants.KUBE_CONFIG_FILE_PATH_PARAM_NAME;
import static org.onap.so.cnfm.lcm.bpmn.flows.CamundaVariableNameConstants.KUBE_KINDS_PARAM_NAME;
import static org.onap.so.cnfm.lcm.bpmn.flows.CamundaVariableNameConstants.KUBE_KINDS_RESULT_PARAM_NAME;
+import static org.onap.so.cnfm.lcm.bpmn.flows.CamundaVariableNameConstants.NAMESPACE_PARAM_NAME;
import static org.onap.so.cnfm.lcm.bpmn.flows.CamundaVariableNameConstants.RELEASE_NAME_PARAM_NAME;
import static org.onap.so.cnfm.lcm.bpmn.flows.Constants.KIND_DAEMON_SET;
import static org.onap.so.cnfm.lcm.bpmn.flows.Constants.KIND_DEPLOYMENT;
@@ -33,8 +34,6 @@ import static org.onap.so.cnfm.lcm.bpmn.flows.Constants.KIND_POD;
import static org.onap.so.cnfm.lcm.bpmn.flows.Constants.KIND_REPLICA_SET;
import static org.onap.so.cnfm.lcm.bpmn.flows.Constants.KIND_SERVICE;
import static org.onap.so.cnfm.lcm.bpmn.flows.Constants.KIND_STATEFUL_SET;
-
-import io.kubernetes.client.openapi.ApiClient;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
@@ -59,6 +58,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import io.kubernetes.client.openapi.ApiClient;
/**
*
@@ -161,13 +161,14 @@ public class InstantiateDeploymentItemTask extends AbstractServiceTask {
(InstantiateDeploymentItemRequest) execution.getVariable(INSTANTIATE_REQUEST_PARAM_NAME);
final String releaseName = request.getReleaseName();
+ final String namespace = request.getNamespace();
try {
final Path kubeConfigFilePath = Paths.get(request.getKubeConfigFile());
final Path helmChartPath = Paths.get(request.getHelmArtifactFilePath());
logger.debug("Running helm install with dry run flag");
- helmClient.runHelmChartInstallWithDryRunFlag(releaseName, kubeConfigFilePath, helmChartPath);
+ helmClient.runHelmChartInstallWithDryRunFlag(namespace, releaseName, kubeConfigFilePath, helmChartPath);
} catch (final Exception exception) {
final String message = "Unable to run helm install with dry run flag";
logger.error(message, exception);
@@ -187,7 +188,10 @@ public class InstantiateDeploymentItemTask extends AbstractServiceTask {
final Path kubeConfigFilePath = Paths.get(request.getKubeConfigFile());
final Path helmChartPath = Paths.get(request.getHelmArtifactFilePath());
final String releaseName = request.getReleaseName();
- final List<String> kubeKinds = helmClient.getKubeKinds(releaseName, kubeConfigFilePath, helmChartPath);
+ final String namespace = request.getNamespace();
+
+ final List<String> kubeKinds =
+ helmClient.getKubeKinds(namespace, releaseName, kubeConfigFilePath, helmChartPath);
if (kubeKinds.isEmpty()) {
abortOperation(execution,
@@ -218,14 +222,18 @@ public class InstantiateDeploymentItemTask extends AbstractServiceTask {
final InstantiateDeploymentItemRequest request =
(InstantiateDeploymentItemRequest) execution.getVariable(INSTANTIATE_REQUEST_PARAM_NAME);
+
+ final String namespace = request.getNamespace();
final String releaseName = request.getReleaseName();
+
execution.setVariable(RELEASE_NAME_PARAM_NAME, releaseName);
+ execution.setVariable(NAMESPACE_PARAM_NAME, namespace);
try {
final Path kubeConfigFilePath = Paths.get(request.getKubeConfigFile());
final Path helmChartPath = Paths.get(request.getHelmArtifactFilePath());
final Map<String, String> lifeCycleParams = request.getLifeCycleParameters();
- helmClient.installHelmChart(releaseName, kubeConfigFilePath, helmChartPath, lifeCycleParams);
+ helmClient.installHelmChart(namespace, releaseName, kubeConfigFilePath, helmChartPath, lifeCycleParams);
} catch (final Exception exception) {
final String message = "Unable to install helm chart: " + request.getHelmArtifactFilePath()
+ " using kube-config file: " + request.getKubeConfigFile();
@@ -263,6 +271,7 @@ public class InstantiateDeploymentItemTask extends AbstractServiceTask {
public void retrieveKubernetesResources(final DelegateExecution execution) {
logger.info("Executing retrieveKubernetesResources");
+ final String namespace = (String) execution.getVariable(NAMESPACE_PARAM_NAME);
final String releaseName = (String) execution.getVariable(RELEASE_NAME_PARAM_NAME);
final String kubeConfigFile = (String) execution.getVariable(KUBE_CONFIG_FILE_PATH_PARAM_NAME);
@SuppressWarnings("unchecked")
@@ -279,25 +288,29 @@ public class InstantiateDeploymentItemTask extends AbstractServiceTask {
labelSelector);
switch (kind) {
case KIND_JOB:
- resources.addAll(kubernetesClient.getJobResources(apiClient, labelSelector));
+ resources.addAll(kubernetesClient.getJobResources(apiClient, namespace, labelSelector));
break;
case KIND_POD:
- resources.addAll(kubernetesClient.getPodResources(apiClient, labelSelector));
+ resources.addAll(kubernetesClient.getPodResources(apiClient, namespace, labelSelector));
break;
case KIND_SERVICE:
- resources.addAll(kubernetesClient.getServiceResources(apiClient, labelSelector));
+ resources.addAll(kubernetesClient.getServiceResources(apiClient, namespace, labelSelector));
break;
case KIND_DEPLOYMENT:
- resources.addAll(kubernetesClient.getDeploymentResources(apiClient, labelSelector));
+ resources.addAll(
+ kubernetesClient.getDeploymentResources(apiClient, namespace, labelSelector));
break;
case KIND_REPLICA_SET:
- resources.addAll(kubernetesClient.getReplicaSetResources(apiClient, labelSelector));
+ resources.addAll(
+ kubernetesClient.getReplicaSetResources(apiClient, namespace, labelSelector));
break;
case KIND_DAEMON_SET:
- resources.addAll(kubernetesClient.getDaemonSetResources(apiClient, labelSelector));
+ resources.addAll(
+ kubernetesClient.getDaemonSetResources(apiClient, namespace, labelSelector));
break;
case KIND_STATEFUL_SET:
- resources.addAll(kubernetesClient.getStatefulSetResources(apiClient, labelSelector));
+ resources.addAll(
+ kubernetesClient.getStatefulSetResources(apiClient, namespace, labelSelector));
break;
default:
logger.warn("Unknown resource type {} found skipping it ...", kind);
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/MonitorHelmInstallStatusTask.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/MonitorHelmInstallStatusTask.java
index 4462829..7156d4d 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/MonitorHelmInstallStatusTask.java
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/MonitorHelmInstallStatusTask.java
@@ -24,8 +24,8 @@ import static org.onap.so.cnfm.lcm.bpmn.flows.CamundaVariableNameConstants.AS_DE
import static org.onap.so.cnfm.lcm.bpmn.flows.CamundaVariableNameConstants.KIND_PARAM_NAME;
import static org.onap.so.cnfm.lcm.bpmn.flows.CamundaVariableNameConstants.KUBE_CONFIG_FILE_PATH_PARAM_NAME;
import static org.onap.so.cnfm.lcm.bpmn.flows.CamundaVariableNameConstants.KUBE_KINDS_RESULT_PARAM_NAME;
+import static org.onap.so.cnfm.lcm.bpmn.flows.CamundaVariableNameConstants.NAMESPACE_PARAM_NAME;
import static org.onap.so.cnfm.lcm.bpmn.flows.CamundaVariableNameConstants.RELEASE_NAME_PARAM_NAME;
-
import static org.onap.so.cnfm.lcm.bpmn.flows.Constants.KIND_DAEMON_SET;
import static org.onap.so.cnfm.lcm.bpmn.flows.Constants.KIND_DEPLOYMENT;
import static org.onap.so.cnfm.lcm.bpmn.flows.Constants.KIND_JOB;
@@ -33,8 +33,6 @@ import static org.onap.so.cnfm.lcm.bpmn.flows.Constants.KIND_POD;
import static org.onap.so.cnfm.lcm.bpmn.flows.Constants.KIND_REPLICA_SET;
import static org.onap.so.cnfm.lcm.bpmn.flows.Constants.KIND_SERVICE;
import static org.onap.so.cnfm.lcm.bpmn.flows.Constants.KIND_STATEFUL_SET;
-
-import io.kubernetes.client.openapi.ApiClient;
import java.util.Map;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.cnfm.lcm.bpmn.flows.exceptions.KubernetesRequestTimeOut;
@@ -46,6 +44,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import io.kubernetes.client.openapi.ApiClient;
/**
@@ -89,33 +88,35 @@ public class MonitorHelmInstallStatusTask extends AbstractServiceTask {
logger.info("Executing isResourceReady ");
final String kind = (String) execution.getVariable(KIND_PARAM_NAME);
final String releaseName = (String) execution.getVariable(RELEASE_NAME_PARAM_NAME);
+ final String namespace = (String) execution.getVariable(NAMESPACE_PARAM_NAME);
final String kubeConfigFile = (String) execution.getVariable(KUBE_CONFIG_FILE_PATH_PARAM_NAME);
final String labelSelector = "app.kubernetes.io/instance=" + releaseName;
try {
final ApiClient apiClient = kubernetesClientProvider.getApiClient(kubeConfigFile);
boolean isReady = false;
- logger.debug("Will check if resource type: {} is ready using labelSelector: {}", kind, labelSelector);
+ logger.debug("Will check if resource type: {} is ready using namespace: {}, labelSelector: {}", kind,
+ namespace, labelSelector);
switch (kind) {
case KIND_JOB:
- isReady = kubernetesClient.isJobReady(apiClient, labelSelector);
+ isReady = kubernetesClient.isJobReady(apiClient, namespace, labelSelector);
break;
case KIND_POD:
- isReady = kubernetesClient.isPodReady(apiClient, labelSelector);
+ isReady = kubernetesClient.isPodReady(apiClient, namespace, labelSelector);
break;
case KIND_SERVICE:
- isReady = kubernetesClient.isServiceReady(apiClient, labelSelector);
+ isReady = kubernetesClient.isServiceReady(apiClient, namespace, labelSelector);
break;
case KIND_DEPLOYMENT:
- isReady = kubernetesClient.isDeploymentReady(apiClient, labelSelector);
+ isReady = kubernetesClient.isDeploymentReady(apiClient, namespace, labelSelector);
break;
case KIND_REPLICA_SET:
- isReady = kubernetesClient.isReplicaSetReady(apiClient, labelSelector);
+ isReady = kubernetesClient.isReplicaSetReady(apiClient, namespace, labelSelector);
break;
case KIND_DAEMON_SET:
- isReady = kubernetesClient.isDaemonSetReady(apiClient, labelSelector);
+ isReady = kubernetesClient.isDaemonSetReady(apiClient, namespace, labelSelector);
break;
case KIND_STATEFUL_SET:
- isReady = kubernetesClient.isStatefulSetReady(apiClient, labelSelector);
+ isReady = kubernetesClient.isStatefulSetReady(apiClient, namespace, labelSelector);
break;
default:
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/MonitorHelmUnInstallStatusTask.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/MonitorHelmUnInstallStatusTask.java
index 3f2a1bd..5d2f41c 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/MonitorHelmUnInstallStatusTask.java
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/MonitorHelmUnInstallStatusTask.java
@@ -24,8 +24,8 @@ import static org.onap.so.cnfm.lcm.bpmn.flows.CamundaVariableNameConstants.AS_DE
import static org.onap.so.cnfm.lcm.bpmn.flows.CamundaVariableNameConstants.KIND_PARAM_NAME;
import static org.onap.so.cnfm.lcm.bpmn.flows.CamundaVariableNameConstants.KUBE_CONFIG_FILE_PATH_PARAM_NAME;
import static org.onap.so.cnfm.lcm.bpmn.flows.CamundaVariableNameConstants.KUBE_KINDS_RESULT_PARAM_NAME;
+import static org.onap.so.cnfm.lcm.bpmn.flows.CamundaVariableNameConstants.NAMESPACE_PARAM_NAME;
import static org.onap.so.cnfm.lcm.bpmn.flows.CamundaVariableNameConstants.RELEASE_NAME_PARAM_NAME;
-
import static org.onap.so.cnfm.lcm.bpmn.flows.Constants.KIND_DAEMON_SET;
import static org.onap.so.cnfm.lcm.bpmn.flows.Constants.KIND_DEPLOYMENT;
import static org.onap.so.cnfm.lcm.bpmn.flows.Constants.KIND_JOB;
@@ -33,8 +33,6 @@ import static org.onap.so.cnfm.lcm.bpmn.flows.Constants.KIND_POD;
import static org.onap.so.cnfm.lcm.bpmn.flows.Constants.KIND_REPLICA_SET;
import static org.onap.so.cnfm.lcm.bpmn.flows.Constants.KIND_SERVICE;
import static org.onap.so.cnfm.lcm.bpmn.flows.Constants.KIND_STATEFUL_SET;
-
-import io.kubernetes.client.openapi.ApiClient;
import java.util.Map;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.cnfm.lcm.bpmn.flows.exceptions.KubernetesRequestTimeOut;
@@ -46,6 +44,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import io.kubernetes.client.openapi.ApiClient;
/**
* @author Raviteja Karumuri (raviteja.karumuri@est.tech)
@@ -84,6 +83,7 @@ public class MonitorHelmUnInstallStatusTask extends AbstractServiceTask {
public void isResourceDeleted(final DelegateExecution execution) {
logger.info("Executing isResourceDeleted ");
final String kind = (String) execution.getVariable(KIND_PARAM_NAME);
+ final String namespace = (String) execution.getVariable(NAMESPACE_PARAM_NAME);
final String releaseName = (String) execution.getVariable(RELEASE_NAME_PARAM_NAME);
final String kubeConfigFile = (String) execution.getVariable(KUBE_CONFIG_FILE_PATH_PARAM_NAME);
final String labelSelector = "app.kubernetes.io/instance=" + releaseName;
@@ -93,25 +93,25 @@ public class MonitorHelmUnInstallStatusTask extends AbstractServiceTask {
logger.debug("Will check if resource type: {} is Deleted using labelSelector: {}", kind, labelSelector);
switch (kind) {
case KIND_JOB:
- isDeleted = kubernetesClient.isJobDeleted(apiClient, labelSelector);
+ isDeleted = kubernetesClient.isJobDeleted(apiClient, namespace, labelSelector);
break;
case KIND_POD:
- isDeleted = kubernetesClient.isPodDeleted(apiClient, labelSelector);
+ isDeleted = kubernetesClient.isPodDeleted(apiClient, namespace, labelSelector);
break;
case KIND_SERVICE:
- isDeleted = kubernetesClient.isServiceDeleted(apiClient, labelSelector);
+ isDeleted = kubernetesClient.isServiceDeleted(apiClient, namespace, labelSelector);
break;
case KIND_DEPLOYMENT:
- isDeleted = kubernetesClient.isDeploymentDeleted(apiClient, labelSelector);
+ isDeleted = kubernetesClient.isDeploymentDeleted(apiClient, namespace, labelSelector);
break;
case KIND_REPLICA_SET:
- isDeleted = kubernetesClient.isReplicaSetDeleted(apiClient, labelSelector);
+ isDeleted = kubernetesClient.isReplicaSetDeleted(apiClient, namespace, labelSelector);
break;
case KIND_DAEMON_SET:
- isDeleted = kubernetesClient.isDaemonSetDeleted(apiClient, labelSelector);
+ isDeleted = kubernetesClient.isDaemonSetDeleted(apiClient, namespace, labelSelector);
break;
case KIND_STATEFUL_SET:
- isDeleted = kubernetesClient.isStatefulSetDeleted(apiClient, labelSelector);
+ isDeleted = kubernetesClient.isStatefulSetDeleted(apiClient, namespace, labelSelector);
break;
default:
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/TerminateAsTask.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/TerminateAsTask.java
index 4ffcb2d..e863108 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/TerminateAsTask.java
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/TerminateAsTask.java
@@ -132,6 +132,8 @@ public class TerminateAsTask extends AbstractServiceTask {
final String asInstId = (String) execution.getVariable(AS_INSTANCE_ID_PARAM_NAME);
final String kubeConfigFile = (String) execution.getVariable(KUBE_CONFIG_FILE_PARAM_NAME);
+ final AsInst asInst = getAsInst(execution, asInstId);
+
final List<AsDeploymentItem> asDeploymentItems =
databaseServiceProvider.getAsDeploymentItemByAsInstId(asInstId);
@@ -147,6 +149,7 @@ public class TerminateAsTask extends AbstractServiceTask {
terminatedeploymentitemrequest.setDeploymentOrder(asDeploymentItem.getDeploymentOrder());
terminatedeploymentitemrequest.setKubeConfigFile(kubeConfigFile);
terminatedeploymentitemrequest.setReleaseName(asDeploymentItem.getReleaseName());
+ terminatedeploymentitemrequest.setNamespace(asInst.getNamespace());
requests.add(terminatedeploymentitemrequest);
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/TerminateDeploymentItemRequest.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/TerminateDeploymentItemRequest.java
index b4fb233..3ef3ebe 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/TerminateDeploymentItemRequest.java
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/TerminateDeploymentItemRequest.java
@@ -40,6 +40,7 @@ public class TerminateDeploymentItemRequest implements Serializable, Comparable<
private String kubeConfigFile;
private Integer deploymentOrder;
private String releaseName;
+ private String namespace;
private static final Comparator<Integer> COMPARATOR = Comparator.nullsFirst(Integer::compare).reversed();
@@ -83,6 +84,14 @@ public class TerminateDeploymentItemRequest implements Serializable, Comparable<
this.releaseName = releaseName;
}
+ public String getNamespace() {
+ return namespace;
+ }
+
+ public void setNamespace(final String namespace) {
+ this.namespace = namespace;
+ }
+
@Override
public boolean equals(final Object obj) {
if (obj instanceof TerminateDeploymentItemRequest) {
@@ -91,15 +100,14 @@ public class TerminateDeploymentItemRequest implements Serializable, Comparable<
&& Objects.equals(asDeploymentItemInstId, that.asDeploymentItemInstId)
&& Objects.equals(kubeConfigFile, that.kubeConfigFile)
&& Objects.equals(deploymentOrder, that.deploymentOrder)
- && Objects.equals(releaseName, that.releaseName);
+ && Objects.equals(releaseName, that.releaseName) && Objects.equals(namespace, that.namespace);
}
return false;
}
@Override
public int hashCode() {
- return Objects.hash(asInstId, asDeploymentItemInstId, kubeConfigFile, deploymentOrder,
- releaseName);
+ return Objects.hash(asInstId, asDeploymentItemInstId, kubeConfigFile, deploymentOrder, releaseName, namespace);
}
@Override
@@ -116,6 +124,7 @@ public class TerminateDeploymentItemRequest implements Serializable, Comparable<
sb.append(" deploymentOrder: ").append(toIndentedString(deploymentOrder)).append("\n");
sb.append(" kubeConfigFile: ").append(toIndentedString(kubeConfigFile)).append("\n");
sb.append(" releaseName: ").append(toIndentedString(releaseName)).append("\n");
+ sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n");
sb.append("}");
return sb.toString();
}
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/TerminateDeploymentItemTask.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/TerminateDeploymentItemTask.java
index e78f8f0..6c1e187 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/TerminateDeploymentItemTask.java
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/TerminateDeploymentItemTask.java
@@ -24,6 +24,7 @@ import static org.onap.so.cnfm.lcm.bpmn.flows.CamundaVariableNameConstants.AS_DE
import static org.onap.so.cnfm.lcm.bpmn.flows.CamundaVariableNameConstants.KUBE_CONFIG_FILE_PATH_PARAM_NAME;
import static org.onap.so.cnfm.lcm.bpmn.flows.CamundaVariableNameConstants.KUBE_KINDS_PARAM_NAME;
import static org.onap.so.cnfm.lcm.bpmn.flows.CamundaVariableNameConstants.KUBE_KINDS_RESULT_PARAM_NAME;
+import static org.onap.so.cnfm.lcm.bpmn.flows.CamundaVariableNameConstants.NAMESPACE_PARAM_NAME;
import static org.onap.so.cnfm.lcm.bpmn.flows.CamundaVariableNameConstants.RELEASE_NAME_PARAM_NAME;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -99,10 +100,11 @@ public class TerminateDeploymentItemTask extends AbstractServiceTask {
final TerminateDeploymentItemRequest request =
(TerminateDeploymentItemRequest) execution.getVariable(TERMINATE_REQUEST_PARAM_NAME);
final String releaseName = request.getReleaseName();
+ final String namespace = request.getNamespace();
try {
final Path kubeConfigFilePath = Paths.get(request.getKubeConfigFile());
- helmClient.unInstallHelmChart(releaseName, kubeConfigFilePath);
+ helmClient.unInstallHelmChart(namespace, releaseName, kubeConfigFilePath);
} catch (final Exception exception) {
final String message = "Failed to uninstall helm chart: " + " using kube-config file: "
+ request.getKubeConfigFile() + "for reason: " + exception.getMessage();
@@ -135,9 +137,11 @@ public class TerminateDeploymentItemTask extends AbstractServiceTask {
final TerminateDeploymentItemRequest request =
(TerminateDeploymentItemRequest) execution.getVariable(TERMINATE_REQUEST_PARAM_NAME);
final String releaseName = request.getReleaseName();
+ final String namespace = request.getNamespace();
final Path kubeConfigFilePath = Paths.get(request.getKubeConfigFile());
final Map<String, Boolean> kubeKindsMap = new HashMap<>();
- final List<String> kinds = helmClient.getKubeKindsUsingManifestCommand(releaseName, kubeConfigFilePath);
+ final List<String> kinds =
+ helmClient.getKubeKindsUsingManifestCommand(namespace, releaseName, kubeConfigFilePath);
if (kinds.isEmpty()) {
abortOperation(execution,
"Unable to retrieve kinds from helm release history for releaseName: " + releaseName);
@@ -145,6 +149,7 @@ public class TerminateDeploymentItemTask extends AbstractServiceTask {
kinds.forEach(kind -> kubeKindsMap.put(kind, false));
execution.setVariable(RELEASE_NAME_PARAM_NAME, releaseName);
+ execution.setVariable(NAMESPACE_PARAM_NAME, namespace);
execution.setVariable(KUBE_KINDS_RESULT_PARAM_NAME, kubeKindsMap);
execution.setVariable(KUBE_KINDS_PARAM_NAME, kinds);
}
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/resources/InstantiateDeploymentItem.bpmn b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/resources/InstantiateDeploymentItem.bpmn
index ede1341..9c20f22 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/resources/InstantiateDeploymentItem.bpmn
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/resources/InstantiateDeploymentItem.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0do535p" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.12.0">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0do535p" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.0.0">
<bpmn:process id="InstantiateDeploymentItem" name="InstantiateDeploymentItem" isExecutable="true">
<bpmn:startEvent id="StartEvent_1">
<bpmn:outgoing>Flow_0ghkhbe</bpmn:outgoing>
@@ -43,6 +43,7 @@
<camunda:out source="kubeKindsResult" target="kubeKindsResult" />
<camunda:in source="releaseName" target="releaseName" />
<camunda:in source="kubeConfigFilePath" target="kubeConfigFilePath" />
+ <camunda:in source="namespace" target="namespace" />
</bpmn:extensionElements>
<bpmn:incoming>Flow_0drw9oj</bpmn:incoming>
<bpmn:outgoing>Flow_01sku2c</bpmn:outgoing>
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/resources/TerminateDeploymentItem.bpmn b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/resources/TerminateDeploymentItem.bpmn
index d5b2073..5212a51 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/resources/TerminateDeploymentItem.bpmn
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/main/resources/TerminateDeploymentItem.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_1va0vwc" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.12.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.15.0">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_1va0vwc" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.0.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.15.0">
<bpmn:process id="TerminateDeploymentItem" isExecutable="true">
<bpmn:startEvent id="Terminate_deployment_start_event">
<bpmn:outgoing>Flow_11nr4yl</bpmn:outgoing>
@@ -31,6 +31,7 @@
<camunda:out source="kubeKindsResult" target="kubeKindsResult" />
<camunda:in source="releaseName" target="releaseName" />
<camunda:in source="kubeConfigFilePath" target="kubeConfigFilePath" />
+ <camunda:in source="namespace" target="namespace" />
</bpmn:extensionElements>
<bpmn:incoming>Flow_0hqyoqt</bpmn:incoming>
<bpmn:outgoing>Flow_0tc7pv4</bpmn:outgoing>
@@ -90,6 +91,10 @@
<bpmn:error id="Error_04z28em" name="AsWorkflowProcessingException" errorCode="INSTANTIATE_AS_WORKFLOW_PROCESSING_EXCEPTION" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="TerminateDeploymentItem">
+ <bpmndi:BPMNEdge id="Flow_1ey2cql_di" bpmnElement="Flow_1ey2cql">
+ <di:waypoint x="500" y="120" />
+ <di:waypoint x="570" y="120" />
+ </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_044y6ke_di" bpmnElement="Flow_044y6ke">
<di:waypoint x="1510" y="120" />
<di:waypoint x="1590" y="120" />
@@ -145,21 +150,14 @@
<di:waypoint x="188" y="120" />
<di:waypoint x="240" y="120" />
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="Flow_1ey2cql_di" bpmnElement="Flow_1ey2cql">
- <di:waypoint x="500" y="120" />
- <di:waypoint x="570" y="120" />
- </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="Event_0fwtu82_di" bpmnElement="Terminate_deployment_start_event">
<dc:Bounds x="152" y="102" width="36" height="36" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="Activity_0ij2kxo_di" bpmnElement="Activity_08pudch">
- <dc:Bounds x="240" y="80" width="100" height="80" />
- </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0sj1npl_di" bpmnElement="Activity_0sj1npl">
<dc:Bounds x="570" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="Activity_1d6qam7_di" bpmnElement="Activity_1d6qam7">
- <dc:Bounds x="400" y="80" width="100" height="80" />
+ <bpmndi:BPMNShape id="Activity_0ij2kxo_di" bpmnElement="Activity_08pudch">
+ <dc:Bounds x="240" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_11evvnx_di" bpmnElement="Event_11evvnx">
<dc:Bounds x="1762" y="102" width="36" height="36" />
@@ -188,6 +186,9 @@
<bpmndi:BPMNShape id="Activity_1jdaz83_di" bpmnElement="Activity_1jdaz83">
<dc:Bounds x="1410" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1d6qam7_di" bpmnElement="Activity_1d6qam7">
+ <dc:Bounds x="400" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_04fi7zc_di" bpmnElement="Event_04fi7zc">
<dc:Bounds x="802" y="142" width="36" height="36" />
<bpmndi:BPMNLabel>
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/helm/HelmClientTest.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/helm/HelmClientTest.java
index 1856dec..4f6de0f 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/helm/HelmClientTest.java
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/helm/HelmClientTest.java
@@ -54,6 +54,7 @@ public class HelmClientTest {
private static final Path DUMMY_HELM_CHART = Paths.get("/some/dir/dummy/dummy-chart.tgz");
private static final Path DUMMY_KUBE_CONFIG = Paths.get("/some/dir/dummy/kube-config");
private static final String DUMMY_RELEASE_NAME = "RELEASE_NAME";
+ private static final String DUMMY_NAME_SPACE = "default";
private static final PropertiesToYamlConverter PROPERTIES_TO_YAML_CONVERTER = new PropertiesToYamlConverter();
private static final List<String> EXPECTED_COMMANDS = Arrays.asList("helm", "install", DUMMY_RELEASE_NAME, "-n",
"default", DUMMY_HELM_CHART.toString(), "--dry-run", "--kubeconfig", DUMMY_KUBE_CONFIG.toString());
@@ -87,7 +88,8 @@ public class HelmClientTest {
final HelmClient objUnderTest =
new StubbedHelmClientImpl(PROPERTIES_TO_YAML_CONVERTER, mockedProcessBuilder);
- objUnderTest.runHelmChartInstallWithDryRunFlag(DUMMY_RELEASE_NAME, DUMMY_KUBE_CONFIG, DUMMY_HELM_CHART);
+ objUnderTest.runHelmChartInstallWithDryRunFlag(DUMMY_NAME_SPACE, DUMMY_RELEASE_NAME, DUMMY_KUBE_CONFIG,
+ DUMMY_HELM_CHART);
}
}
@@ -101,13 +103,14 @@ public class HelmClientTest {
final ProcessBuilder mockedProcessBuilder = mock(ProcessBuilder.class);
final ListMatcher expectedCommandsMatcher = new ListMatcher(EXPECTED_COMMANDS);
- mockProcessBuilder(mockedProcessBuilder, expectedCommandsMatcher, errorStream, inputStream, FAILED_EXIT_CODE,
- EXPECTED_COMMANDS);
+ mockProcessBuilder(mockedProcessBuilder, expectedCommandsMatcher, errorStream, inputStream,
+ FAILED_EXIT_CODE, EXPECTED_COMMANDS);
final HelmClient objUnderTest =
new StubbedHelmClientImpl(PROPERTIES_TO_YAML_CONVERTER, mockedProcessBuilder);
- objUnderTest.runHelmChartInstallWithDryRunFlag(DUMMY_RELEASE_NAME, DUMMY_KUBE_CONFIG, DUMMY_HELM_CHART);
+ objUnderTest.runHelmChartInstallWithDryRunFlag(DUMMY_NAME_SPACE, DUMMY_RELEASE_NAME, DUMMY_KUBE_CONFIG,
+ DUMMY_HELM_CHART);
}
}
@@ -121,13 +124,13 @@ public class HelmClientTest {
final ProcessBuilder mockedProcessBuilder = mock(ProcessBuilder.class);
final ListMatcher expectedCommandsMatcher = new ListMatcher(EXPECTED_GET_KUBE_KINDS_COMMANDS);
- mockProcessBuilder(mockedProcessBuilder, expectedCommandsMatcher, errorStream, inputStream, SUCCESSFUL_EXIT_CODE,
- EXPECTED_GET_KUBE_KINDS_COMMANDS);
+ mockProcessBuilder(mockedProcessBuilder, expectedCommandsMatcher, errorStream, inputStream,
+ SUCCESSFUL_EXIT_CODE, EXPECTED_GET_KUBE_KINDS_COMMANDS);
final HelmClient objUnderTest =
new StubbedHelmClientImpl(PROPERTIES_TO_YAML_CONVERTER, mockedProcessBuilder);
- final List<String> actualKubeKinds =
- objUnderTest.getKubeKinds(DUMMY_RELEASE_NAME, DUMMY_KUBE_CONFIG, DUMMY_HELM_CHART);
+ final List<String> actualKubeKinds = objUnderTest.getKubeKinds(DUMMY_NAME_SPACE, DUMMY_RELEASE_NAME,
+ DUMMY_KUBE_CONFIG, DUMMY_HELM_CHART);
assertEquals(Arrays.asList(Constants.KIND_REPLICA_SET), actualKubeKinds);
@@ -144,14 +147,14 @@ public class HelmClientTest {
final ProcessBuilder mockedProcessBuilder = mock(ProcessBuilder.class);
final ListMatcher expectedCommandsMatcher = new ListMatcher(EXPECTED_GET_KUBE_KINDS_MANIFEST_COMMANDS);
- mockProcessBuilder(mockedProcessBuilder, expectedCommandsMatcher, errorStream, inputStream, SUCCESSFUL_EXIT_CODE,
- EXPECTED_GET_KUBE_KINDS_COMMANDS);
+ mockProcessBuilder(mockedProcessBuilder, expectedCommandsMatcher, errorStream, inputStream,
+ SUCCESSFUL_EXIT_CODE, EXPECTED_GET_KUBE_KINDS_COMMANDS);
final HelmClient objUnderTest =
new StubbedHelmClientImpl(PROPERTIES_TO_YAML_CONVERTER, mockedProcessBuilder);
- final List<String> actualKubeKinds =
- objUnderTest.getKubeKindsUsingManifestCommand(DUMMY_RELEASE_NAME, DUMMY_KUBE_CONFIG);
+ final List<String> actualKubeKinds = objUnderTest.getKubeKindsUsingManifestCommand(DUMMY_NAME_SPACE,
+ DUMMY_RELEASE_NAME, DUMMY_KUBE_CONFIG);
assertEquals(Arrays.asList(Constants.KIND_DAEMON_SET), actualKubeKinds);
}
}
@@ -165,13 +168,13 @@ public class HelmClientTest {
final ProcessBuilder mockedProcessBuilder = mock(ProcessBuilder.class);
final ListMatcher expectedCommandsMatcher = new ListMatcher(EXPECTED_HELM_INSTALL_COMMANDS);
- mockProcessBuilder(mockedProcessBuilder, expectedCommandsMatcher, errorStream, inputStream, SUCCESSFUL_EXIT_CODE,
- EXPECTED_HELM_INSTALL_COMMANDS);
+ mockProcessBuilder(mockedProcessBuilder, expectedCommandsMatcher, errorStream, inputStream,
+ SUCCESSFUL_EXIT_CODE, EXPECTED_HELM_INSTALL_COMMANDS);
final HelmClient objUnderTest =
new StubbedHelmClientImpl(PROPERTIES_TO_YAML_CONVERTER, mockedProcessBuilder);
- objUnderTest.installHelmChart(DUMMY_RELEASE_NAME, DUMMY_KUBE_CONFIG, DUMMY_HELM_CHART,
+ objUnderTest.installHelmChart(DUMMY_NAME_SPACE, DUMMY_RELEASE_NAME, DUMMY_KUBE_CONFIG, DUMMY_HELM_CHART,
Collections.emptyMap());
}
}
@@ -185,13 +188,13 @@ public class HelmClientTest {
final ProcessBuilder mockedProcessBuilder = mock(ProcessBuilder.class);
final ListMatcher expectedCommandsMatcher = new ListMatcher(EXPECTED_HELM_UNINSTALL_COMMANDS);
- mockProcessBuilder(mockedProcessBuilder, expectedCommandsMatcher, errorStream, inputStream, SUCCESSFUL_EXIT_CODE,
- EXPECTED_HELM_UNINSTALL_COMMANDS);
+ mockProcessBuilder(mockedProcessBuilder, expectedCommandsMatcher, errorStream, inputStream,
+ SUCCESSFUL_EXIT_CODE, EXPECTED_HELM_UNINSTALL_COMMANDS);
final HelmClient objUnderTest =
new StubbedHelmClientImpl(PROPERTIES_TO_YAML_CONVERTER, mockedProcessBuilder);
- objUnderTest.unInstallHelmChart(DUMMY_RELEASE_NAME, DUMMY_KUBE_CONFIG);
+ objUnderTest.unInstallHelmChart(DUMMY_NAME_SPACE, DUMMY_RELEASE_NAME, DUMMY_KUBE_CONFIG);
}
}
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/kubernetes/KubernetesClientTest.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/kubernetes/KubernetesClientTest.java
index 7d69436..8dcab50 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/kubernetes/KubernetesClientTest.java
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/kubernetes/KubernetesClientTest.java
@@ -22,6 +22,7 @@ package org.onap.so.cnfm.lcm.bpmn.flows.extclients.kubernetes;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
@@ -74,6 +75,7 @@ import okio.BufferedSource;
*/
public class KubernetesClientTest {
+ private static final String DUMMY_NAME_SPACE = "default";
private static final String DUMMY_LABEL_SELECTOR = "app.kubernetes.io/instance=test";
private static final String BATCH_V1 = "batch/v1";
private static final String V1 = "v1";
@@ -90,7 +92,7 @@ public class KubernetesClientTest {
public void testIsJobReady_jobStatusComplete_true() throws ApiException, IOException {
final ApiClient mockedApiClient = mockApiClientResponse(getJobResponse("Complete", "Running"));
- assertTrue(objUnderTest.isJobReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertTrue(objUnderTest.isJobReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@@ -98,7 +100,7 @@ public class KubernetesClientTest {
public void testIsJobReady_jobStatusFailed_throwException() throws ApiException, IOException {
final ApiClient mockedApiClient = mockApiClientResponse(getJobResponse("Failed", "Not Running"));
- objUnderTest.isJobReady(mockedApiClient, DUMMY_LABEL_SELECTOR);
+ objUnderTest.isJobReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR);
}
@@ -106,7 +108,7 @@ public class KubernetesClientTest {
public void testIsJobReady_apiExceptionThrown_throwsException() throws ApiException, IOException {
final ApiClient mockedApiClient = mockApiClientResponse(ApiException.class);
- objUnderTest.isJobReady(mockedApiClient, DUMMY_LABEL_SELECTOR);
+ objUnderTest.isJobReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR);
}
@@ -114,7 +116,7 @@ public class KubernetesClientTest {
public void testIsJobReady_RuntimeExceptionThrown_throwsException() throws ApiException, IOException {
final ApiClient mockedApiClient = mockApiClientResponse(RuntimeException.class);
- objUnderTest.isJobReady(mockedApiClient, DUMMY_LABEL_SELECTOR);
+ objUnderTest.isJobReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR);
}
@@ -122,7 +124,7 @@ public class KubernetesClientTest {
public void testIsJobReady_jobStatusPending_false() throws ApiException, IOException {
final ApiClient mockedApiClient = mockApiClientResponse(getJobResponse("pending", "pending"));
- assertFalse(objUnderTest.isJobReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertFalse(objUnderTest.isJobReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@@ -131,7 +133,7 @@ public class KubernetesClientTest {
final V1PodCondition condition = new V1PodCondition().type("Ready").status(Boolean.TRUE.toString());
final ApiClient mockedApiClient = mockApiClientResponse(getPodResponse(condition));
- assertTrue(objUnderTest.isPodReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertTrue(objUnderTest.isPodReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@@ -140,7 +142,7 @@ public class KubernetesClientTest {
final V1PodCondition condition = new V1PodCondition().type("Ready").status(Boolean.FALSE.toString());
final ApiClient mockedApiClient = mockApiClientResponse(getPodResponse(condition));
- assertFalse(objUnderTest.isPodReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertFalse(objUnderTest.isPodReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@@ -148,7 +150,7 @@ public class KubernetesClientTest {
public void testIsPodReady_missingCondition_false() throws ApiException, IOException {
final ApiClient mockedApiClient = mockApiClientResponse(getPodResponse(null));
- assertFalse(objUnderTest.isPodReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertFalse(objUnderTest.isPodReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@@ -156,7 +158,7 @@ public class KubernetesClientTest {
public void testIsPodReady_apiExceptionThrown_throwsException() throws ApiException, IOException {
final ApiClient mockedApiClient = mockApiClientResponse(ApiException.class);
- objUnderTest.isPodReady(mockedApiClient, DUMMY_LABEL_SELECTOR);
+ objUnderTest.isPodReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR);
}
@@ -164,14 +166,14 @@ public class KubernetesClientTest {
public void testIsPodReady_RuntimeExceptionThrown_throwsException() throws ApiException, IOException {
final ApiClient mockedApiClient = mockApiClientResponse(RuntimeException.class);
- objUnderTest.isPodReady(mockedApiClient, DUMMY_LABEL_SELECTOR);
+ objUnderTest.isPodReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR);
}
@Test
public void testIsServiceReady_exists_true() throws ApiException, IOException {
final ApiClient mockedApiClient = mockApiClientResponse(getServiceResponse());
- assertTrue(objUnderTest.isServiceReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertTrue(objUnderTest.isServiceReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@@ -179,7 +181,7 @@ public class KubernetesClientTest {
public void testIsServiceReady_apiExceptionThrown_throwsException() throws ApiException, IOException {
final ApiClient mockedApiClient = mockApiClientResponse(ApiException.class);
- objUnderTest.isServiceReady(mockedApiClient, DUMMY_LABEL_SELECTOR);
+ objUnderTest.isServiceReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR);
}
@@ -187,7 +189,7 @@ public class KubernetesClientTest {
public void testIsServiceReady_RuntimeExceptionThrown_throwsException() throws ApiException, IOException {
final ApiClient mockedApiClient = mockApiClientResponse(RuntimeException.class);
- objUnderTest.isServiceReady(mockedApiClient, DUMMY_LABEL_SELECTOR);
+ objUnderTest.isServiceReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR);
}
@@ -199,7 +201,7 @@ public class KubernetesClientTest {
final V1DeploymentSpec spec = new V1DeploymentSpec().replicas(Integer.valueOf(2));
final ApiClient mockedApiClient = mockApiClientResponse(getDeploymentResponse(status, spec));
- assertTrue(objUnderTest.isDeploymentReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertTrue(objUnderTest.isDeploymentReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@@ -211,7 +213,7 @@ public class KubernetesClientTest {
final V1DeploymentSpec spec = new V1DeploymentSpec().replicas(Integer.valueOf(2));
final ApiClient mockedApiClient = mockApiClientResponse(getDeploymentResponse(status, spec));
- assertFalse(objUnderTest.isDeploymentReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertFalse(objUnderTest.isDeploymentReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@@ -221,7 +223,7 @@ public class KubernetesClientTest {
final V1DeploymentSpec spec = new V1DeploymentSpec().replicas(Integer.valueOf(2));
final ApiClient mockedApiClient = mockApiClientResponse(getDeploymentResponse(null, spec));
- assertFalse(objUnderTest.isDeploymentReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertFalse(objUnderTest.isDeploymentReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@@ -229,7 +231,7 @@ public class KubernetesClientTest {
public void testIsDeploymentReady_apiExceptionThrown_throwsException() throws ApiException, IOException {
final ApiClient mockedApiClient = mockApiClientResponse(ApiException.class);
- objUnderTest.isDeploymentReady(mockedApiClient, DUMMY_LABEL_SELECTOR);
+ objUnderTest.isDeploymentReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR);
}
@@ -237,7 +239,7 @@ public class KubernetesClientTest {
public void testIsDeploymentReady_RuntimeExceptionThrown_throwsException() throws ApiException, IOException {
final ApiClient mockedApiClient = mockApiClientResponse(RuntimeException.class);
- objUnderTest.isDeploymentReady(mockedApiClient, DUMMY_LABEL_SELECTOR);
+ objUnderTest.isDeploymentReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR);
}
@@ -249,7 +251,7 @@ public class KubernetesClientTest {
final V1ReplicaSetSpec spec = new V1ReplicaSetSpec().replicas(Integer.valueOf(1));
final ApiClient mockedApiClient = mockApiClientResponse(getReplicaSetResponse(status, spec));
- assertTrue(objUnderTest.isReplicaSetReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertTrue(objUnderTest.isReplicaSetReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@@ -260,7 +262,7 @@ public class KubernetesClientTest {
final V1ReplicaSetSpec spec = new V1ReplicaSetSpec().replicas(Integer.valueOf(2));
final ApiClient mockedApiClient = mockApiClientResponse(getReplicaSetResponse(status, spec));
- assertFalse(objUnderTest.isReplicaSetReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertFalse(objUnderTest.isReplicaSetReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@@ -270,7 +272,7 @@ public class KubernetesClientTest {
final V1ReplicaSetStatus status = new V1ReplicaSetStatus().readyReplicas(Integer.valueOf(1));
final ApiClient mockedApiClient = mockApiClientResponse(getReplicaSetResponse(status, null));
- assertFalse(objUnderTest.isReplicaSetReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertFalse(objUnderTest.isReplicaSetReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@@ -278,7 +280,7 @@ public class KubernetesClientTest {
public void testIsReplicaSetReady_apiExceptionThrown_throwsException() throws ApiException, IOException {
final ApiClient mockedApiClient = mockApiClientResponse(ApiException.class);
- objUnderTest.isReplicaSetReady(mockedApiClient, DUMMY_LABEL_SELECTOR);
+ objUnderTest.isReplicaSetReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR);
}
@@ -286,7 +288,7 @@ public class KubernetesClientTest {
public void testIsReplicaSetReady_RuntimeExceptionThrown_throwsException() throws ApiException, IOException {
final ApiClient mockedApiClient = mockApiClientResponse(RuntimeException.class);
- objUnderTest.isReplicaSetReady(mockedApiClient, DUMMY_LABEL_SELECTOR);
+ objUnderTest.isReplicaSetReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR);
}
@@ -301,7 +303,7 @@ public class KubernetesClientTest {
.numberReady(Integer.valueOf(2)).updatedNumberScheduled(Integer.valueOf(2));
final ApiClient mockedApiClient = mockApiClientResponse(getDaemonSetResponse(status, spec));
- assertTrue(objUnderTest.isDaemonSetReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertTrue(objUnderTest.isDaemonSetReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@@ -314,7 +316,7 @@ public class KubernetesClientTest {
final V1DaemonSetStatus status = new V1DaemonSetStatus();
final ApiClient mockedApiClient = mockApiClientResponse(getDaemonSetResponse(status, spec));
- assertTrue(objUnderTest.isDaemonSetReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertTrue(objUnderTest.isDaemonSetReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@@ -328,7 +330,7 @@ public class KubernetesClientTest {
final ApiClient mockedApiClient = mockApiClientResponse(getDaemonSetResponse(status, spec));
- assertFalse(objUnderTest.isDaemonSetReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertFalse(objUnderTest.isDaemonSetReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@@ -344,7 +346,7 @@ public class KubernetesClientTest {
.numberReady(Integer.valueOf(2)).updatedNumberScheduled(Integer.valueOf(6));
final ApiClient mockedApiClient = mockApiClientResponse(getDaemonSetResponse(status, spec));
- assertTrue(objUnderTest.isDaemonSetReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertTrue(objUnderTest.isDaemonSetReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@@ -361,7 +363,7 @@ public class KubernetesClientTest {
.numberReady(Integer.valueOf(1)).updatedNumberScheduled(Integer.valueOf(6));
final ApiClient mockedApiClient = mockApiClientResponse(getDaemonSetResponse(status, spec));
- assertFalse(objUnderTest.isDaemonSetReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertFalse(objUnderTest.isDaemonSetReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@@ -369,7 +371,7 @@ public class KubernetesClientTest {
public void testIsDaemonSetReady_apiExceptionThrown_throwsException() throws ApiException, IOException {
final ApiClient mockedApiClient = mockApiClientResponse(ApiException.class);
- objUnderTest.isDaemonSetReady(mockedApiClient, DUMMY_LABEL_SELECTOR);
+ objUnderTest.isDaemonSetReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR);
}
@@ -377,7 +379,7 @@ public class KubernetesClientTest {
public void testIsDaemonSetReady_RuntimeExceptionThrown_throwsException() throws ApiException, IOException {
final ApiClient mockedApiClient = mockApiClientResponse(RuntimeException.class);
- objUnderTest.isDaemonSetReady(mockedApiClient, DUMMY_LABEL_SELECTOR);
+ objUnderTest.isDaemonSetReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR);
}
@@ -393,7 +395,7 @@ public class KubernetesClientTest {
new V1StatefulSetStatus().updatedReplicas(Integer.valueOf(2)).readyReplicas(Integer.valueOf(2));
final ApiClient mockedApiClient = mockApiClientResponse(getStatefulSetResponse(status, spec));
- assertTrue(objUnderTest.isStatefulSetReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertTrue(objUnderTest.isStatefulSetReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@@ -406,7 +408,7 @@ public class KubernetesClientTest {
final V1StatefulSetStatus status = new V1StatefulSetStatus();
final ApiClient mockedApiClient = mockApiClientResponse(getStatefulSetResponse(status, spec));
- assertTrue(objUnderTest.isStatefulSetReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertTrue(objUnderTest.isStatefulSetReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@@ -420,14 +422,14 @@ public class KubernetesClientTest {
final V1StatefulSetStatus status = new V1StatefulSetStatus().updatedReplicas(Integer.valueOf(2));
final ApiClient mockedApiClient = mockApiClientResponse(getStatefulSetResponse(status, spec));
- assertFalse(objUnderTest.isStatefulSetReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertFalse(objUnderTest.isStatefulSetReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@Test(expected = KubernetesRequestProcessingException.class)
public void testIsStatefulSetReady_apiExceptionThrown_throwsException() throws ApiException, IOException {
final ApiClient mockedApiClient = mockApiClientResponse(ApiException.class);
- objUnderTest.isStatefulSetReady(mockedApiClient, DUMMY_LABEL_SELECTOR);
+ objUnderTest.isStatefulSetReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR);
}
@@ -435,7 +437,7 @@ public class KubernetesClientTest {
public void testIsStatefulSetReady_RuntimeExceptionThrown_throwsException() throws ApiException, IOException {
final ApiClient mockedApiClient = mockApiClientResponse(RuntimeException.class);
- objUnderTest.isStatefulSetReady(mockedApiClient, DUMMY_LABEL_SELECTOR);
+ objUnderTest.isStatefulSetReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR);
}
@@ -512,6 +514,7 @@ public class KubernetesClientTest {
final BufferedSource mockedBufferedSource = mock(BufferedSource.class);
final Call mockedCall = mock(Call.class);
+ when(mockedApiClient.escapeString(anyString())).thenCallRealMethod();
when(mockedApiClient.getJSON()).thenReturn(json);
doNothing().when(mockedResponse).close();
when(mockedResponse.body()).thenReturn(mockedResponseBody);
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/CreateAsTaskTest.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/CreateAsTaskTest.java
index c5683e8..5beadbd 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/CreateAsTaskTest.java
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/CreateAsTaskTest.java
@@ -206,7 +206,7 @@ public class CreateAsTaskTest extends BaseTest {
.asPackageId(UUID.randomUUID().toString()).asdInvariantId(asdId).asProvider(DUMMY_VALUE)
.asApplicationName(DUMMY_VALUE).asApplicationVersion(DUMMY_VALUE).serviceInstanceId(DUMMY_VALUE)
.serviceInstanceName(DUMMY_VALUE).cloudOwner(DUMMY_VALUE).cloudRegion(DUMMY_VALUE).tenantId(DUMMY_VALUE)
- .status(State.INSTANTIATED).statusUpdatedTime(LocalDateTime.now()));
+ .namespace(DUMMY_VALUE).status(State.INSTANTIATED).statusUpdatedTime(LocalDateTime.now()));
try {
objUnderTest.runCreateAsJob(createAsRequest);
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/DeleteAsTaskTest.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/DeleteAsTaskTest.java
index 9ad993b..3b5d5c6 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/DeleteAsTaskTest.java
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/DeleteAsTaskTest.java
@@ -184,12 +184,12 @@ public class DeleteAsTaskTest extends BaseTest {
private void addDummyAsToDatabase(final String asInstanceId, final State state) {
final String asdId = UUID.randomUUID().toString();
- final AsInst asInst =
- new AsInst().asInstId(asInstanceId).name("asName").asdId(asdId).asdInvariantId(asInstanceId)
- .status(state).statusUpdatedTime(LocalDateTime.now()).asApplicationName("asApplicationName")
- .asApplicationVersion("asApplicationVersion").asProvider("asProvider")
- .serviceInstanceId(SERVICE_INSTANCE_ID).serviceInstanceName("serviceInstanceName")
- .cloudOwner("cloudOwner").cloudRegion("cloudRegion").tenantId("tenantId");
+ final AsInst asInst = new AsInst().asInstId(asInstanceId).name("asName").asdId(asdId)
+ .asdInvariantId(asInstanceId).status(state).statusUpdatedTime(LocalDateTime.now())
+ .asApplicationName("asApplicationName").asApplicationVersion("asApplicationVersion")
+ .asProvider("asProvider").serviceInstanceId(SERVICE_INSTANCE_ID)
+ .serviceInstanceName("serviceInstanceName").cloudOwner("cloudOwner").cloudRegion("cloudRegion")
+ .tenantId("tenantId").namespace("namespace");
databaseServiceProvider.saveAsInst(asInst);
}
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/InstantiateAsTaskTest.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/InstantiateAsTaskTest.java
index 3080459..3061bff 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/InstantiateAsTaskTest.java
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/InstantiateAsTaskTest.java
@@ -104,6 +104,7 @@ import io.kubernetes.client.util.Watch;
* @author Waqas Ikram (waqas.ikram@est.tech)
*/
public class InstantiateAsTaskTest extends BaseTest {
+ private static final String NAMESPACE_VALUE = "default";
private static final String BATCH_V1 = "batch/v1";
private static final String V1 = "v1";
private static final String APPS_V1 = "apps/v1";
@@ -312,7 +313,7 @@ public class InstantiateAsTaskTest extends BaseTest {
.asApplicationName("asApplicationName").asApplicationVersion("asApplicationVersion")
.asProvider("asProvider").serviceInstanceId(SERVICE_INSTANCE_ID)
.serviceInstanceName("serviceInstanceName").cloudOwner("cloudOwner").cloudRegion("cloudRegion")
- .tenantId("tenantId");
+ .tenantId("tenantId").namespace(NAMESPACE_VALUE);
databaseServiceProvider.saveAsInst(asInst);
@@ -339,55 +340,65 @@ public class InstantiateAsTaskTest extends BaseTest {
}
private void mockKubernetesClientEndpoint() {
- wireMockServer.stubFor(get(urlMatching("/apis/batch/v1/jobs\\?labelSelector.*(" + DEPLOYMENT_ITEM_1_RELEASE_NAME
- + "|" + DEPLOYMENT_ITEM_2_RELEASE_NAME + ")&timeoutSeconds=1&watch=true"))
+ wireMockServer.stubFor(get(urlMatching("/apis/batch/v1/namespaces/" + NAMESPACE_VALUE
+ + "/jobs\\?labelSelector.*(" + DEPLOYMENT_ITEM_1_RELEASE_NAME + "|" + DEPLOYMENT_ITEM_2_RELEASE_NAME
+ + ")&timeoutSeconds=1&watch=true"))
.willReturn(aResponse().withBody(getJobResponse()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
- wireMockServer.stubFor(get(urlMatching("/apis/batch/v1/jobs\\?labelSelector.*&watch=false"))
- .willReturn(aResponse().withBody(getJobList()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
+ wireMockServer.stubFor(
+ get(urlMatching("/apis/batch/v1/namespaces/" + NAMESPACE_VALUE + "/jobs\\?labelSelector.*&watch=false"))
+ .willReturn(aResponse().withBody(getJobList()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
- wireMockServer.stubFor(get(urlMatching("/api/v1/pods\\?labelSelector.*(" + DEPLOYMENT_ITEM_1_RELEASE_NAME + "|"
- + DEPLOYMENT_ITEM_2_RELEASE_NAME + ")&timeoutSeconds=1&watch=true"))
- .willReturn(aResponse().withBody(getPodResponse()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
- wireMockServer.stubFor(get(urlMatching("/api/v1/pods\\?labelSelector.*&watch=false"))
- .willReturn(aResponse().withBody(getPodList()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
+ wireMockServer.stubFor(get(urlMatching(
+ "/api/v1/namespaces/" + NAMESPACE_VALUE + "/pods\\?labelSelector.*(" + DEPLOYMENT_ITEM_1_RELEASE_NAME
+ + "|" + DEPLOYMENT_ITEM_2_RELEASE_NAME + ")&timeoutSeconds=1&watch=true")).willReturn(
+ aResponse().withBody(getPodResponse()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
+ wireMockServer.stubFor(
+ get(urlMatching("/api/v1/namespaces/" + NAMESPACE_VALUE + "/pods\\?labelSelector.*&watch=false"))
+ .willReturn(aResponse().withBody(getPodList()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
- wireMockServer.stubFor(get(urlMatching("/api/v1/services\\?labelSelector.*(" + DEPLOYMENT_ITEM_1_RELEASE_NAME
- + "|" + DEPLOYMENT_ITEM_2_RELEASE_NAME + ")&timeoutSeconds=1&watch=true")).willReturn(
+ wireMockServer.stubFor(get(urlMatching("/api/v1/namespaces/" + NAMESPACE_VALUE + "/services\\?labelSelector.*("
+ + DEPLOYMENT_ITEM_1_RELEASE_NAME + "|" + DEPLOYMENT_ITEM_2_RELEASE_NAME
+ + ")&timeoutSeconds=1&watch=true")).willReturn(
aResponse().withBody(getServiceResponse()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
- wireMockServer.stubFor(get(urlMatching("/api/v1/services\\?labelSelector.*&watch=false"))
- .willReturn(aResponse().withBody(getServiceList()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
-
- wireMockServer
- .stubFor(get(urlMatching("/apis/apps/v1/deployments\\?labelSelector.*(" + DEPLOYMENT_ITEM_1_RELEASE_NAME
- + "|" + DEPLOYMENT_ITEM_2_RELEASE_NAME + ")&timeoutSeconds=1&watch=true"))
- .willReturn(aResponse().withBody(getDeploymentResponse()).withHeader(ACCEPT,
- APPLICATION_JSON_VALUE)));
- wireMockServer.stubFor(get(urlMatching("/apis/apps/v1/deployments\\?labelSelector.*&watch=false"))
- .willReturn(aResponse().withBody(getDeploymentList()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
-
- wireMockServer
- .stubFor(get(urlMatching("/apis/apps/v1/replicasets\\?labelSelector.*(" + DEPLOYMENT_ITEM_1_RELEASE_NAME
- + "|" + DEPLOYMENT_ITEM_2_RELEASE_NAME + ")&timeoutSeconds=1&watch=true"))
- .willReturn(aResponse().withBody(getReplicaSetResponse()).withHeader(ACCEPT,
- APPLICATION_JSON_VALUE)));
- wireMockServer.stubFor(get(urlMatching("/apis/apps/v1/replicasets\\?labelSelector.*&watch=false"))
- .willReturn(aResponse().withBody(getReplicaSetList()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
-
- wireMockServer
- .stubFor(get(urlMatching("/apis/apps/v1/daemonsets\\?labelSelector.*(" + DEPLOYMENT_ITEM_1_RELEASE_NAME
- + "|" + DEPLOYMENT_ITEM_2_RELEASE_NAME + ")&timeoutSeconds=1&watch=true"))
- .willReturn(aResponse().withBody(getDaemonSetResponse()).withHeader(ACCEPT,
- APPLICATION_JSON_VALUE)));
- wireMockServer.stubFor(get(urlMatching("/apis/apps/v1/daemonsets\\?labelSelector.*&watch=false"))
- .willReturn(aResponse().withBody(getDaemonSetList()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
-
wireMockServer.stubFor(
- get(urlMatching("/apis/apps/v1/statefulsets\\?labelSelector.*(" + DEPLOYMENT_ITEM_1_RELEASE_NAME + "|"
- + DEPLOYMENT_ITEM_2_RELEASE_NAME + ")&timeoutSeconds=1&watch=true"))
- .willReturn(aResponse().withBody(getStatefulSetResponse()).withHeader(ACCEPT,
- APPLICATION_JSON_VALUE)));
- wireMockServer.stubFor(get(urlMatching("/apis/apps/v1/statefulsets\\?labelSelector.*&watch=false"))
- .willReturn(aResponse().withBody(getStatefulSetList()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
+ get(urlMatching("/api/v1/namespaces/" + NAMESPACE_VALUE + "/services\\?labelSelector.*&watch=false"))
+ .willReturn(aResponse().withBody(getServiceList()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
+
+ wireMockServer.stubFor(get(urlMatching("/apis/apps/v1/namespaces/" + NAMESPACE_VALUE
+ + "/deployments\\?labelSelector.*(" + DEPLOYMENT_ITEM_1_RELEASE_NAME + "|"
+ + DEPLOYMENT_ITEM_2_RELEASE_NAME + ")&timeoutSeconds=1&watch=true")).willReturn(
+ aResponse().withBody(getDeploymentResponse()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
+ wireMockServer.stubFor(get(urlMatching(
+ "/apis/apps/v1/namespaces/" + NAMESPACE_VALUE + "/deployments\\?labelSelector.*&watch=false"))
+ .willReturn(
+ aResponse().withBody(getDeploymentList()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
+
+ wireMockServer.stubFor(get(urlMatching("/apis/apps/v1/namespaces/" + NAMESPACE_VALUE
+ + "/replicasets\\?labelSelector.*(" + DEPLOYMENT_ITEM_1_RELEASE_NAME + "|"
+ + DEPLOYMENT_ITEM_2_RELEASE_NAME + ")&timeoutSeconds=1&watch=true")).willReturn(
+ aResponse().withBody(getReplicaSetResponse()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
+ wireMockServer.stubFor(get(urlMatching(
+ "/apis/apps/v1/namespaces/" + NAMESPACE_VALUE + "/replicasets\\?labelSelector.*&watch=false"))
+ .willReturn(
+ aResponse().withBody(getReplicaSetList()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
+
+ wireMockServer.stubFor(get(urlMatching("/apis/apps/v1/namespaces/" + NAMESPACE_VALUE
+ + "/daemonsets\\?labelSelector.*(" + DEPLOYMENT_ITEM_1_RELEASE_NAME + "|"
+ + DEPLOYMENT_ITEM_2_RELEASE_NAME + ")&timeoutSeconds=1&watch=true")).willReturn(
+ aResponse().withBody(getDaemonSetResponse()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
+ wireMockServer.stubFor(get(urlMatching(
+ "/apis/apps/v1/namespaces/" + NAMESPACE_VALUE + "/daemonsets\\?labelSelector.*&watch=false"))
+ .willReturn(
+ aResponse().withBody(getDaemonSetList()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
+
+ wireMockServer.stubFor(get(urlMatching("/apis/apps/v1/namespaces/" + NAMESPACE_VALUE
+ + "/statefulsets\\?labelSelector.*(" + DEPLOYMENT_ITEM_1_RELEASE_NAME + "|"
+ + DEPLOYMENT_ITEM_2_RELEASE_NAME + ")&timeoutSeconds=1&watch=true")).willReturn(
+ aResponse().withBody(getStatefulSetResponse()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
+ wireMockServer.stubFor(get(urlMatching(
+ "/apis/apps/v1/namespaces/" + NAMESPACE_VALUE + "/statefulsets\\?labelSelector.*&watch=false"))
+ .willReturn(
+ aResponse().withBody(getStatefulSetList()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
}
private String getStatefulSetResponse() {
@@ -558,7 +569,7 @@ public class InstantiateAsTaskTest extends BaseTest {
.asdInvariantId(as_inst_id).status(State.NOT_INSTANTIATED).statusUpdatedTime(LocalDateTime.now())
.asApplicationName("asApplicationName").asApplicationVersion("asApplicationVersion")
.asProvider("asProvider").serviceInstanceId(as_inst_id).serviceInstanceName("serviceInstanceName")
- .cloudOwner("cloudOwner").cloudRegion("cloudRegion").tenantId("tenantId");
+ .cloudOwner("cloudOwner").cloudRegion("cloudRegion").tenantId("tenantId").namespace(NAMESPACE_VALUE);
final String helmFile1 = "Artifacts/Deployment/HELM/sampleapp-db-operator-helm.tgz";
final AsLifecycleParam lcp1 = new AsLifecycleParam().asLifecycleParam(DEPLOYMENT_ITEM_1_LIFECYCLE_PARAM_1);
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/MockedHelmClient.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/MockedHelmClient.java
index 2b718d5..1729b5d 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/MockedHelmClient.java
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/MockedHelmClient.java
@@ -45,8 +45,8 @@ public class MockedHelmClient implements HelmClient {
}
@Override
- public void runHelmChartInstallWithDryRunFlag(final String releaseName, final Path kubeconfig,
- final Path helmChart) {
+ public void runHelmChartInstallWithDryRunFlag(final String namespace, final String releaseName,
+ final Path kubeconfig, final Path helmChart) {
Integer count = counter.get(releaseName);
if (count == null) {
count = 0;
@@ -56,7 +56,8 @@ public class MockedHelmClient implements HelmClient {
}
@Override
- public List<String> getKubeKinds(final String releaseName, final Path kubeconfig, final Path helmChart) {
+ public List<String> getKubeKinds(final String namespace, final String releaseName, final Path kubeconfig,
+ final Path helmChart) {
Integer count = counter.get(releaseName);
if (count == null) {
count = 0;
@@ -66,7 +67,8 @@ public class MockedHelmClient implements HelmClient {
}
@Override
- public List<String> getKubeKindsUsingManifestCommand(final String releaseName, final Path kubeconfig) {
+ public List<String> getKubeKindsUsingManifestCommand(final String namespace, final String releaseName,
+ final Path kubeconfig) {
Integer count = unInstallCounter.get(releaseName);
if (count == null) {
count = 0;
@@ -76,8 +78,8 @@ public class MockedHelmClient implements HelmClient {
}
@Override
- public void installHelmChart(final String releaseName, final Path kubeconfig, final Path helmChart,
- final Map<String, String> lifeCycleParams) {
+ public void installHelmChart(final String namespace, final String releaseName, final Path kubeconfig,
+ final Path helmChart, final Map<String, String> lifeCycleParams) {
Integer count = counter.get(releaseName);
if (count == null) {
count = 0;
@@ -86,7 +88,7 @@ public class MockedHelmClient implements HelmClient {
}
@Override
- public void unInstallHelmChart(final String releaseName, final Path kubeConfigFilePath)
+ public void unInstallHelmChart(final String namespace, final String releaseName, final Path kubeConfigFilePath)
throws HelmClientExecuteException {
Integer count = unInstallCounter.get(releaseName);
if (count == null) {
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/TerminateAsTaskTest.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/TerminateAsTaskTest.java
index 832d675..4f89617 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/TerminateAsTaskTest.java
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/TerminateAsTaskTest.java
@@ -73,6 +73,7 @@ import org.springframework.beans.factory.annotation.Value;
*/
public class TerminateAsTaskTest extends BaseTest {
+ private static final String NAMESPACE_VALUE = "default";
private static final String AS_INST_ID = UUID.randomUUID().toString();
private static final String AS_DEPLOYMENT_ITEM_ONE_INST_ID = UUID.randomUUID().toString();
private static final String AS_DEPLOYMENT_ITEM_TWO_INST_ID = UUID.randomUUID().toString();
@@ -154,7 +155,7 @@ public class TerminateAsTaskTest extends BaseTest {
.asApplicationName("asApplicationName").asApplicationVersion("asApplicationVersion")
.asProvider("asProvider").serviceInstanceId(SERVICE_INSTANCE_ID)
.serviceInstanceName(SERVICE_INSTANCE_NAME).cloudOwner("cloudOwner").cloudRegion("cloudRegion")
- .tenantId("tenantId");
+ .tenantId("tenantId").namespace(NAMESPACE_VALUE);
final String helmFile1 = "Artifacts/Deployment/HELM/sampleapp-db-operator-helm.tgz";
final AsDeploymentItem dItemOne = new AsDeploymentItem().asDeploymentItemInstId(AS_DEPLOYMENT_ITEM_ONE_INST_ID)
@@ -176,26 +177,40 @@ public class TerminateAsTaskTest extends BaseTest {
private void mockKubernetesClientEndpoint() {
- wireMockServer.stubFor(get(urlMatching("/apis/batch/v1/jobs\\?labelSelector.*&watch=false"))
- .willReturn(aResponse().withBody(getJobList()).withHeader(CONTENT_TYPE, APPLICATION_JSON_VALUE)));
-
- wireMockServer.stubFor(get(urlMatching("/api/v1/pods\\?labelSelector.*&watch=false"))
- .willReturn(aResponse().withBody(getPodList()).withHeader(CONTENT_TYPE, APPLICATION_JSON_VALUE)));
-
- wireMockServer.stubFor(get(urlMatching("/api/v1/services\\?labelSelector.*&watch=false"))
- .willReturn(aResponse().withBody(getServiceList()).withHeader(CONTENT_TYPE, APPLICATION_JSON_VALUE)));
-
- wireMockServer.stubFor(get(urlMatching("/apis/apps/v1/deployments\\?labelSelector.*&watch=false")).willReturn(
- aResponse().withBody(getDeploymentList()).withHeader(CONTENT_TYPE, APPLICATION_JSON_VALUE)));
-
- wireMockServer.stubFor(get(urlMatching("/apis/apps/v1/daemonsets\\?labelSelector.*&watch=false"))
- .willReturn(aResponse().withBody(getDaemonList()).withHeader(CONTENT_TYPE, APPLICATION_JSON_VALUE)));
-
- wireMockServer.stubFor(get(urlMatching("/apis/apps/v1/replicasets\\?labelSelector.*&watch=false")).willReturn(
- aResponse().withBody(getReplicaSetList()).withHeader(CONTENT_TYPE, APPLICATION_JSON_VALUE)));
-
- wireMockServer.stubFor(get(urlMatching("/apis/apps/v1/statefulsets\\?labelSelector.*&watch=false")).willReturn(
- aResponse().withBody(getStatefulSetList()).withHeader(CONTENT_TYPE, APPLICATION_JSON_VALUE)));
+ wireMockServer.stubFor(
+ get(urlMatching("/apis/batch/v1/namespaces/" + NAMESPACE_VALUE + "/jobs\\?labelSelector.*&watch=false"))
+ .willReturn(
+ aResponse().withBody(getJobList()).withHeader(CONTENT_TYPE, APPLICATION_JSON_VALUE)));
+
+ wireMockServer.stubFor(
+ get(urlMatching("/api/v1/namespaces/" + NAMESPACE_VALUE + "/pods\\?labelSelector.*&watch=false"))
+ .willReturn(
+ aResponse().withBody(getPodList()).withHeader(CONTENT_TYPE, APPLICATION_JSON_VALUE)));
+
+ wireMockServer.stubFor(
+ get(urlMatching("/api/v1/namespaces/" + NAMESPACE_VALUE + "/services\\?labelSelector.*&watch=false"))
+ .willReturn(aResponse().withBody(getServiceList()).withHeader(CONTENT_TYPE,
+ APPLICATION_JSON_VALUE)));
+
+ wireMockServer.stubFor(get(urlMatching(
+ "/apis/apps/v1/namespaces/" + NAMESPACE_VALUE + "/deployments\\?labelSelector.*&watch=false"))
+ .willReturn(aResponse().withBody(getDeploymentList()).withHeader(CONTENT_TYPE,
+ APPLICATION_JSON_VALUE)));
+
+ wireMockServer.stubFor(get(urlMatching(
+ "/apis/apps/v1/namespaces/" + NAMESPACE_VALUE + "/daemonsets\\?labelSelector.*&watch=false"))
+ .willReturn(aResponse().withBody(getDaemonList()).withHeader(CONTENT_TYPE,
+ APPLICATION_JSON_VALUE)));
+
+ wireMockServer.stubFor(get(urlMatching(
+ "/apis/apps/v1/namespaces/" + NAMESPACE_VALUE + "/replicasets\\?labelSelector.*&watch=false"))
+ .willReturn(aResponse().withBody(getReplicaSetList()).withHeader(CONTENT_TYPE,
+ APPLICATION_JSON_VALUE)));
+
+ wireMockServer.stubFor(get(urlMatching(
+ "/apis/apps/v1/namespaces/" + NAMESPACE_VALUE + "/statefulsets\\?labelSelector.*&watch=false"))
+ .willReturn(aResponse().withBody(getStatefulSetList()).withHeader(CONTENT_TYPE,
+ APPLICATION_JSON_VALUE)));
}
private void mockAAIEndPoints() {
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/AsInst.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/AsInst.java
index e6538bc..b47047b 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/AsInst.java
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/AsInst.java
@@ -86,6 +86,9 @@ public class AsInst {
@Column(name = "TENANT_ID", nullable = false)
private String tenantId;
+ @Column(name = "NAME_SPACE", nullable = false)
+ private String namespace;
+
@Enumerated(EnumType.STRING)
@Column(name = "STATUS", nullable = false)
private State status;
@@ -282,6 +285,19 @@ public class AsInst {
return this;
}
+ public String getNamespace() {
+ return namespace;
+ }
+
+ public void setNamespace(final String namespace) {
+ this.namespace = namespace;
+ }
+
+ public AsInst namespace(final String namespace) {
+ this.namespace = namespace;
+ return this;
+ }
+
public State getStatus() {
return status;
}
@@ -326,7 +342,7 @@ public class AsInst {
public int hashCode() {
return Objects.hash(asInstId, name, description, asPackageId, asdId, asdInvariantId, asProvider,
asApplicationName, asApplicationVersion, serviceInstanceId, serviceInstanceName, cloudOwner,
- cloudRegion, tenantId, status, statusUpdatedTime, asdeploymentItems);
+ cloudRegion, tenantId, namespace, status, statusUpdatedTime, asdeploymentItems);
}
@Override
@@ -346,7 +362,8 @@ public class AsInst {
&& Objects.equals(serviceInstanceId, other.serviceInstanceId)
&& Objects.equals(serviceInstanceName, other.serviceInstanceName)
&& Objects.equals(cloudOwner, other.cloudOwner) && Objects.equals(cloudRegion, other.cloudRegion)
- && Objects.equals(tenantId, other.tenantId) && Objects.equals(status, other.status)
+ && Objects.equals(tenantId, other.tenantId) && Objects.equals(namespace, other.namespace)
+ && Objects.equals(status, other.status)
&& Objects.equals(statusUpdatedTime, other.statusUpdatedTime)
&& Objects.equals(asdeploymentItems, other.asdeploymentItems);
}
@@ -370,6 +387,7 @@ public class AsInst {
sb.append(" cloudOwner: ").append(toIndentedString(cloudOwner)).append("\n");
sb.append(" cloudRegion: ").append(toIndentedString(cloudRegion)).append("\n");
sb.append(" tenantId: ").append(toIndentedString(tenantId)).append("\n");
+ sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n");
sb.append(" status: ").append(toIndentedString(status)).append("\n");
sb.append(" statusUpdatedTime: ").append(toIndentedString(statusUpdatedTime)).append("\n");
sb.append(" asdeploymentItems: ").append(toIndentedString(asdeploymentItems)).append("\n");
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/resources/db/migration/V1_1__create_cnfm_tables.sql b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/resources/db/migration/V1_1__create_cnfm_tables.sql
index 5e75171..de447d3 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/resources/db/migration/V1_1__create_cnfm_tables.sql
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/resources/db/migration/V1_1__create_cnfm_tables.sql
@@ -40,6 +40,7 @@ CREATE TABLE IF NOT EXISTS `AS_INST` (
`CLOUD_OWNER` varchar(255) NOT NULL,
`CLOUD_REGION` varchar(255) NOT NULL,
`TENANT_ID` varchar(255) NOT NULL,
+ `NAME_SPACE` varchar(255) NOT NULL,
`STATUS` varchar(255) NOT NULL,
`STATUS_UPDATED_TIME` DATETIME NOT NULL,
PRIMARY KEY (`AS_INST_ID`)
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/test/java/org/onap/so/cnfm/lcm/database/service/DatabaseServiceProviderTest.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/test/java/org/onap/so/cnfm/lcm/database/service/DatabaseServiceProviderTest.java
index 4397fb5..062f501 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/test/java/org/onap/so/cnfm/lcm/database/service/DatabaseServiceProviderTest.java
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/test/java/org/onap/so/cnfm/lcm/database/service/DatabaseServiceProviderTest.java
@@ -102,7 +102,7 @@ public class DatabaseServiceProviderTest {
.asdInvariantId(RANDOM_ID).statusUpdatedTime(CURRENT_DATE_TIME).asApplicationName("asApplicationName")
.asApplicationVersion("asApplicationVersion").asProvider("asProvider").serviceInstanceId(RANDOM_ID)
.serviceInstanceName("serviceInstanceName").cloudOwner("cloudOwner").cloudRegion("cloudRegion")
- .tenantId("tenantId");
+ .tenantId("tenantId").namespace("namespace");
databaseServiceProvider.saveAsInst(asInst);
@@ -135,7 +135,7 @@ public class DatabaseServiceProviderTest {
.asdInvariantId(RANDOM_ID).statusUpdatedTime(CURRENT_DATE_TIME).asApplicationName("asApplicationName")
.asApplicationVersion("asApplicationVersion").asProvider("asProvider").serviceInstanceId(RANDOM_ID)
.serviceInstanceName("serviceInstanceName").cloudOwner("cloudOwner").cloudRegion("cloudRegion")
- .tenantId("tenantId");
+ .tenantId("tenantId").namespace("namespace");
databaseServiceProvider.saveAsInst(asInst);
@@ -177,13 +177,15 @@ public class DatabaseServiceProviderTest {
databaseServiceProvider.getAsLifecycleParam(aslifecycleparam.getAsLifecycleParamId());
final AsLifecycleParam actualLifecycleParam = actualLP.get();
assertEquals(aslifecycleparam.getLifecycleParam(), actualLifecycleParam.getLifecycleParam());
- assertEquals(asdeploymentItem.getAsDeploymentItemInstId(), actualLifecycleParam.getAsDeploymentItemInst().getAsDeploymentItemInstId());
+ assertEquals(asdeploymentItem.getAsDeploymentItemInstId(),
+ actualLifecycleParam.getAsDeploymentItemInst().getAsDeploymentItemInstId());
assertEquals(aslifecycleparam.getAsLifecycleParamId(), actualLifecycleParam.getAsLifecycleParamId());
- List<AsLifecycleParam> aslifecycleParamsList =
- databaseServiceProvider.getAsLifecycleParamByAsDeploymentItemId(asdeploymentItem.getAsDeploymentItemInstId());
+ List<AsLifecycleParam> aslifecycleParamsList = databaseServiceProvider
+ .getAsLifecycleParamByAsDeploymentItemId(asdeploymentItem.getAsDeploymentItemInstId());
assertFalse(aslifecycleParamsList.isEmpty());
- assertEquals(asdeploymentItem.getAsDeploymentItemInstId(), aslifecycleParamsList.get(0).getAsDeploymentItemInst().getAsDeploymentItemInstId());
+ assertEquals(asdeploymentItem.getAsDeploymentItemInstId(),
+ aslifecycleParamsList.get(0).getAsDeploymentItemInst().getAsDeploymentItemInstId());
}
@Test
@@ -193,7 +195,7 @@ public class DatabaseServiceProviderTest {
.asdInvariantId(RANDOM_ID).statusUpdatedTime(CURRENT_DATE_TIME).asApplicationName("asApplicationName")
.asApplicationVersion("asApplicationVersion").asProvider("asProvider").serviceInstanceId(RANDOM_ID)
.serviceInstanceName("serviceInstanceName").cloudOwner("cloudOwner").cloudRegion("cloudRegion")
- .tenantId("tenantId");
+ .tenantId("tenantId").namespace("namespace");
databaseServiceProvider.saveAsInst(asInst);
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-service/src/test/java/org/onap/so/cnfm/lcm/rest/AsLcmOperationOccurrencesControllerTest.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-service/src/test/java/org/onap/so/cnfm/lcm/rest/AsLcmOperationOccurrencesControllerTest.java
index 4f1a0b6..fc71ed9 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-service/src/test/java/org/onap/so/cnfm/lcm/rest/AsLcmOperationOccurrencesControllerTest.java
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-service/src/test/java/org/onap/so/cnfm/lcm/rest/AsLcmOperationOccurrencesControllerTest.java
@@ -117,7 +117,7 @@ public class AsLcmOperationOccurrencesControllerTest {
.asdInvariantId(RANDOM_UUID).statusUpdatedTime(now).asApplicationName("asApplicationName")
.asApplicationVersion("asApplicationVersion").asProvider("asProvider").serviceInstanceId(RANDOM_UUID)
.serviceInstanceName("serviceInstanceName").cloudOwner("cloudOwner").cloudRegion("cloudRegion")
- .tenantId("tenantId");
+ .tenantId("tenantId").namespace("namespace");
databaseServiceProvider.saveAsInst(asInst);