diff options
author | Konrad Bańka <k.banka@samsung.com> | 2021-02-25 00:08:05 +0100 |
---|---|---|
committer | Konrad Bańka <k.banka@samsung.com> | 2021-02-25 15:30:45 +0100 |
commit | 22a37f42a54c1acd2f095bc559ab03745e5ae7f9 (patch) | |
tree | 18be25e5475c5bf8d00d2e43a734d4eca2658a7b /src/k8splugin/internal/app/instance.go | |
parent | fec64d4a5d7986e4d92b1350f31c9a3c81e82e6e (diff) |
Provide Healthcheck API MVP0.8.0
Implements basic functionality of running starting Healthcheck.
Results can be inspected so-far without dedicated API, by using, for
example, Query API.
Issue-ID: MULTICLOUD-1233
Signed-off-by: Konrad Bańka <k.banka@samsung.com>
Change-Id: Ia4d96d936d573173d7d8f41e6c39d059bf5f8b1f
Diffstat (limited to 'src/k8splugin/internal/app/instance.go')
-rw-r--r-- | src/k8splugin/internal/app/instance.go | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/k8splugin/internal/app/instance.go b/src/k8splugin/internal/app/instance.go index b11283e0..337ce687 100644 --- a/src/k8splugin/internal/app/instance.go +++ b/src/k8splugin/internal/app/instance.go @@ -22,6 +22,8 @@ import ( "log" "strings" + protorelease "k8s.io/helm/pkg/proto/hapi/release" + "github.com/onap/multicloud-k8s/src/k8splugin/internal/db" "github.com/onap/multicloud-k8s/src/k8splugin/internal/helm" "github.com/onap/multicloud-k8s/src/k8splugin/internal/namegenerator" @@ -49,6 +51,7 @@ type InstanceResponse struct { Namespace string `json:"namespace"` ReleaseName string `json:"release-name"` Resources []helm.KubernetesResource `json:"resources"` + Hooks []*protorelease.Hook `json:"hooks"` } // InstanceMiniResponse contains the response from instantiation @@ -147,7 +150,7 @@ func (v *InstanceClient) Create(i InstanceRequest) (InstanceResponse, error) { } //Execute the kubernetes create command - sortedTemplates, releaseName, err := rb.NewProfileClient().Resolve(i.RBName, i.RBVersion, i.ProfileName, overrideValues, i.ReleaseName) + sortedTemplates, hookList, 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") } @@ -156,7 +159,7 @@ func (v *InstanceClient) Create(i InstanceRequest) (InstanceResponse, error) { id := namegenerator.Generate() k8sClient := KubernetesClient{} - err = k8sClient.init(i.CloudRegion, id) + err = k8sClient.Init(i.CloudRegion, id) if err != nil { return InstanceResponse{}, pkgerrors.Wrap(err, "Getting CloudRegion Information") } @@ -173,6 +176,7 @@ func (v *InstanceClient) Create(i InstanceRequest) (InstanceResponse, error) { Namespace: profile.Namespace, ReleaseName: releaseName, Resources: createdResources, + Hooks: hookList, } key := InstanceKey{ @@ -230,7 +234,7 @@ func (v *InstanceClient) Query(id, apiVersion, kind, name, labels string) (Insta } k8sClient := KubernetesClient{} - err = k8sClient.init(resResp.Request.CloudRegion, id) + err = k8sClient.Init(resResp.Request.CloudRegion, id) if err != nil { return InstanceStatus{}, pkgerrors.Wrap(err, "Getting CloudRegion Information") } @@ -296,7 +300,7 @@ func (v *InstanceClient) Status(id string) (InstanceStatus, error) { } k8sClient := KubernetesClient{} - err = k8sClient.init(resResp.Request.CloudRegion, id) + err = k8sClient.Init(resResp.Request.CloudRegion, id) if err != nil { return InstanceStatus{}, pkgerrors.Wrap(err, "Getting CloudRegion Information") } @@ -432,7 +436,7 @@ func (v *InstanceClient) Delete(id string) error { } k8sClient := KubernetesClient{} - err = k8sClient.init(inst.Request.CloudRegion, inst.ID) + err = k8sClient.Init(inst.Request.CloudRegion, inst.ID) if err != nil { return pkgerrors.Wrap(err, "Getting CloudRegion Information") } |