aboutsummaryrefslogtreecommitdiffstats
path: root/src/k8splugin/internal/app/instance.go
diff options
context:
space:
mode:
authorKonrad Bańka <k.banka@samsung.com>2020-09-04 14:44:45 +0200
committerKonrad Banka <k.banka@samsung.com>2020-09-08 11:29:55 +0000
commitcf79276e2b633211d9a0befcb0e978dea447a9cf (patch)
treee7e9c22c6e1e13bb7a039aa3eff23eff246875a1 /src/k8splugin/internal/app/instance.go
parentd14246bb9a2c8874f9925c45322d678a93584adb (diff)
Provide capability to specify release-name during instantiation
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 <k.banka@samsung.com> Change-Id: Id8db484369045cfb0bc99543a80317644fc838f9
Diffstat (limited to 'src/k8splugin/internal/app/instance.go')
-rw-r--r--src/k8splugin/internal/app/instance.go35
1 files changed, 20 insertions, 15 deletions
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