From bf49d552b003072c6bc64ae838a4699c1f4028bd Mon Sep 17 00:00:00 2001 From: Kiran Kamineni Date: Tue, 16 Apr 2019 18:09:13 -0700 Subject: Replace Kind with GroupVersionKind Kind is not unique to track resources in Kubernetes GroupVersionKind is unique. We are just using that to track our data. It is abstracted behind a couple of new types for templates and resources. This change makes a lot of the old kind based operations redundant and simplified. Issue-ID: MULTICLOUD-573 Change-Id: I8f4ded2ba6a0821a8fbd679dc99ce3a44d805524 Signed-off-by: Kiran Kamineni --- src/k8splugin/internal/app/instance.go | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/k8splugin/internal/app/instance.go') diff --git a/src/k8splugin/internal/app/instance.go b/src/k8splugin/internal/app/instance.go index 93305c30..8e9a2b7a 100644 --- a/src/k8splugin/internal/app/instance.go +++ b/src/k8splugin/internal/app/instance.go @@ -23,6 +23,7 @@ import ( "os" "k8splugin/internal/db" + "k8splugin/internal/helm" "k8splugin/internal/rb" pkgerrors "github.com/pkg/errors" @@ -40,13 +41,13 @@ type InstanceRequest struct { // InstanceResponse contains the response from instantiation type InstanceResponse struct { - ID string `json:"id"` - RBName string `json:"rb-name"` - RBVersion string `json:"rb-version"` - ProfileName string `json:"profile-name"` - CloudRegion string `json:"cloud-region"` - Namespace string `json:"namespace"` - Resources map[string][]string `json:"resources"` + ID string `json:"id"` + RBName string `json:"rb-name"` + RBVersion string `json:"rb-version"` + ProfileName string `json:"profile-name"` + CloudRegion string `json:"cloud-region"` + Namespace string `json:"namespace"` + Resources []helm.KubernetesResource `json:"resources"` } // InstanceManager is an interface exposes the instantiation functionality @@ -113,7 +114,7 @@ func (v *InstanceClient) Create(i InstanceRequest) (InstanceResponse, error) { overrideValues := []string{} //Execute the kubernetes create command - resMap, err := rb.NewProfileClient().Resolve(i.RBName, i.RBVersion, i.ProfileName, overrideValues) + sortedTemplates, err := rb.NewProfileClient().Resolve(i.RBName, i.RBVersion, i.ProfileName, overrideValues) if err != nil { return InstanceResponse{}, pkgerrors.Wrap(err, "Error resolving helm charts") } @@ -124,7 +125,7 @@ func (v *InstanceClient) Create(i InstanceRequest) (InstanceResponse, error) { return InstanceResponse{}, pkgerrors.Wrap(err, "Getting CloudRegion Information") } - createdResources, err := k8sClient.createResources(resMap, profile.Namespace) + createdResources, err := k8sClient.createResources(sortedTemplates, profile.Namespace) if err != nil { return InstanceResponse{}, pkgerrors.Wrap(err, "Create Kubernetes Resources") } -- cgit 1.2.3-korg