diff options
author | Ritu Sood <ritu.sood@intel.com> | 2021-02-23 20:18:26 -0800 |
---|---|---|
committer | Konrad Bańka <k.banka@samsung.com> | 2021-04-12 09:52:04 +0200 |
commit | 1f60346da61383f18b7277037439711aef38a0fe (patch) | |
tree | 620201bbf61283c8db54da8f15d6340bbb813988 /src/k8splugin/plugins/service/plugin.go | |
parent | 120019529489b5cbcf82d77eec228283fb12d43a (diff) |
Migrate to use Helm v3 libraries
Moving to Helm v3. Updated unit tests.
Reworked Healthcheck Execution to align
with v3 design.
Helm v3 requires newer version for K8s
libraries. Moved to use version 0.19.4.
Issue-ID: MULTICLOUD-1295
Signed-off-by: Ritu Sood <ritu.sood@intel.com>
Signed-off-by: Konrad Bańka <k.banka@samsung.com>
Change-Id: I091b75d69841dde56ad2c294cca2d5a0291ffa8f
Diffstat (limited to 'src/k8splugin/plugins/service/plugin.go')
-rw-r--r-- | src/k8splugin/plugins/service/plugin.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/k8splugin/plugins/service/plugin.go b/src/k8splugin/plugins/service/plugin.go index 28191767..06f4b1d5 100644 --- a/src/k8splugin/plugins/service/plugin.go +++ b/src/k8splugin/plugins/service/plugin.go @@ -14,6 +14,7 @@ limitations under the License. package main import ( + "context" "log" pkgerrors "github.com/pkg/errors" @@ -61,7 +62,7 @@ func (p servicePlugin) Create(yamlFilePath string, namespace string, client plug labels[config.GetConfiguration().KubernetesLabelName] = client.GetInstanceID() service.SetLabels(labels) - result, err := client.GetStandardClient().CoreV1().Services(namespace).Create(service) + result, err := client.GetStandardClient().CoreV1().Services(namespace).Create(context.TODO(), service, metaV1.CreateOptions{}) if err != nil { return "", pkgerrors.Wrap(err, "Create Service error") } @@ -80,7 +81,7 @@ func (p servicePlugin) List(gvk schema.GroupVersionKind, namespace string, clien Limit: utils.ResourcesListLimit, } - list, err := client.GetStandardClient().CoreV1().Services(namespace).List(opts) + list, err := client.GetStandardClient().CoreV1().Services(namespace).List(context.TODO(), opts) if err != nil { return nil, pkgerrors.Wrap(err, "Get Service list error") } @@ -111,12 +112,12 @@ func (p servicePlugin) Delete(resource helm.KubernetesResource, namespace string } deletePolicy := metaV1.DeletePropagationForeground - opts := &metaV1.DeleteOptions{ + opts := metaV1.DeleteOptions{ PropagationPolicy: &deletePolicy, } log.Println("Deleting service: " + resource.Name) - if err := client.GetStandardClient().CoreV1().Services(namespace).Delete(resource.Name, opts); err != nil { + if err := client.GetStandardClient().CoreV1().Services(namespace).Delete(context.TODO(), resource.Name, opts); err != nil { return pkgerrors.Wrap(err, "Delete service error") } @@ -130,7 +131,7 @@ func (p servicePlugin) Get(resource helm.KubernetesResource, namespace string, c } opts := metaV1.GetOptions{} - service, err := client.GetStandardClient().CoreV1().Services(namespace).Get(resource.Name, opts) + service, err := client.GetStandardClient().CoreV1().Services(namespace).Get(context.TODO(), resource.Name, opts) if err != nil { return "", pkgerrors.Wrap(err, "Get Service error") } |