From cf79276e2b633211d9a0befcb0e978dea447a9cf Mon Sep 17 00:00:00 2001 From: Konrad Bańka Date: Fri, 4 Sep 2020 14:44:45 +0200 Subject: Provide capability to specify release-name during instantiation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allow release-name property to be provided during instantiation that, if provided, overrides release-name specified in profile. Additionally updated Makefile to allow easy compilation with different go version easily. Issue-ID: MULTICLOUD-1175 Signed-off-by: Konrad Bańka Change-Id: Id8db484369045cfb0bc99543a80317644fc838f9 --- src/k8splugin/internal/app/instance.go | 35 +++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) (limited to 'src/k8splugin/internal/app') diff --git a/src/k8splugin/internal/app/instance.go b/src/k8splugin/internal/app/instance.go index ad677644..220c82da 100644 --- a/src/k8splugin/internal/app/instance.go +++ b/src/k8splugin/internal/app/instance.go @@ -35,6 +35,7 @@ type InstanceRequest struct { RBName string `json:"rb-name"` RBVersion string `json:"rb-version"` ProfileName string `json:"profile-name"` + ReleaseName string `json:"release-name"` CloudRegion string `json:"cloud-region"` Labels map[string]string `json:"labels"` OverrideValues map[string]string `json:"override-values"` @@ -42,19 +43,21 @@ type InstanceRequest struct { // InstanceResponse contains the response from instantiation type InstanceResponse struct { - ID string `json:"id"` - Request InstanceRequest `json:"request"` - Namespace string `json:"namespace"` - Resources []helm.KubernetesResource `json:"resources"` + ID string `json:"id"` + Request InstanceRequest `json:"request"` + Namespace string `json:"namespace"` + ReleaseName string `json:"release-name"` + Resources []helm.KubernetesResource `json:"resources"` } // InstanceMiniResponse contains the response from instantiation // It does NOT include the created resources. // Use the regular GET to get the created resources for a particular instance type InstanceMiniResponse struct { - ID string `json:"id"` - Request InstanceRequest `json:"request"` - Namespace string `json:"namespace"` + ID string `json:"id"` + Request InstanceRequest `json:"request"` + ReleaseName string `json:"release-name"` + Namespace string `json:"namespace"` } // PodStatus defines the observed state of ResourceBundleState @@ -144,7 +147,7 @@ func (v *InstanceClient) Create(i InstanceRequest) (InstanceResponse, error) { } //Execute the kubernetes create command - sortedTemplates, err := rb.NewProfileClient().Resolve(i.RBName, i.RBVersion, i.ProfileName, overrideValues) + sortedTemplates, releaseName, err := rb.NewProfileClient().Resolve(i.RBName, i.RBVersion, i.ProfileName, overrideValues, i.ReleaseName) if err != nil { return InstanceResponse{}, pkgerrors.Wrap(err, "Error resolving helm charts") } @@ -165,10 +168,11 @@ func (v *InstanceClient) Create(i InstanceRequest) (InstanceResponse, error) { //Compose the return response resp := InstanceResponse{ - ID: id, - Request: i, - Namespace: profile.Namespace, - Resources: createdResources, + ID: id, + Request: i, + Namespace: profile.Namespace, + ReleaseName: releaseName, + Resources: createdResources, } key := InstanceKey{ @@ -252,9 +256,10 @@ func (v *InstanceClient) List(rbname, rbversion, profilename string) ([]Instance } miniresp := InstanceMiniResponse{ - ID: resp.ID, - Request: resp.Request, - Namespace: resp.Namespace, + ID: resp.ID, + Request: resp.Request, + Namespace: resp.Namespace, + ReleaseName: resp.ReleaseName, } //Filter based on the accepted keys -- cgit 1.2.3-korg