From 9c942a11c14836630ba528b75bdcb2790045b91f Mon Sep 17 00:00:00 2001 From: "vamshi.nemalikonda" Date: Fri, 24 Jul 2020 12:05:51 +0000 Subject: Improve configure API to support k8s resource updations Code fore review. Issue-ID: MULTICLOUD-1124 Change-Id: I6bb9786660f6760c15008132f1c254e7f9b39561 Signed-off-by: vamshi.nemalikonda Improve configure API to support k8s resource updations create resource enabled. Issue-ID: MULTICLOUD-1124 Change-Id: I6bb9786660f6760c15008132f1c254e7f9b39561 Signed-off-by: vamshi.nemalikonda Improve configure API to support k8s resource updations code improvements. Issue-ID: MULTICLOUD-1124 Change-Id: I6bb9786660f6760c15008132f1c254e7f9b39561 Signed-off-by: vamshi.nemalikonda Improve configure API to support k8s resource updations fixing unit test failures. Issue-ID: MULTICLOUD-1124 Change-Id: I6bb9786660f6760c15008132f1c254e7f9b39561 Signed-off-by: vamshi.nemalikonda --- src/k8splugin/internal/app/config_backend.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/k8splugin/internal/app/config_backend.go') diff --git a/src/k8splugin/internal/app/config_backend.go b/src/k8splugin/internal/app/config_backend.go index 6bc145ee..4cbe1da3 100644 --- a/src/k8splugin/internal/app/config_backend.go +++ b/src/k8splugin/internal/app/config_backend.go @@ -360,10 +360,17 @@ func scheduleResources(c chan configResourceList) { //Move onto the next cloud region continue } + //assuming - the resource is not exist already data.createdResources, err = k8sClient.createResources(data.resourceTemplates, inst.Namespace) + errCreate := err if err != nil { - log.Printf("Error Creating resources: %s", err.Error()) - continue + // assuming - the err represent the resource is already exist, so going for update + data.createdResources, err = k8sClient.updateResources(data.resourceTemplates, inst.Namespace) + if err != nil { + log.Printf("Error Creating resources: %s", errCreate.Error()) + log.Printf("Error Updating resources: %s", err.Error()) + continue + } } } //TODO: Needs to add code to call Kubectl create -- cgit 1.2.3-korg