diff options
author | Ritu Sood <ritu.sood@intel.com> | 2021-02-23 20:18:26 -0800 |
---|---|---|
committer | Lukasz Rajewski <lukasz.rajewski@orange.com> | 2021-05-06 13:39:08 +0000 |
commit | 97bd8a16fda3b7d0f176aa1b04d7fba5f1f56354 (patch) | |
tree | 9e583b52767264af616c697964b0e1cf7d3ff0b2 /src/k8splugin/plugins/generic | |
parent | 483f3324d67fb59e8e9e53ece22d1c3b2a32f7dd (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
(cherry picked from commit 1f60346da61383f18b7277037439711aef38a0fe)
Diffstat (limited to 'src/k8splugin/plugins/generic')
-rw-r--r-- | src/k8splugin/plugins/generic/plugin.go | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/k8splugin/plugins/generic/plugin.go b/src/k8splugin/plugins/generic/plugin.go index 8cbfcdf5..5f73ad22 100644 --- a/src/k8splugin/plugins/generic/plugin.go +++ b/src/k8splugin/plugins/generic/plugin.go @@ -14,6 +14,7 @@ limitations under the License. package main import ( + "context" pkgerrors "github.com/pkg/errors" "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -77,9 +78,9 @@ func (g genericPlugin) Create(yamlFilePath string, namespace string, client plug switch mapping.Scope.Name() { case meta.RESTScopeNameNamespace: - createdObj, err = dynClient.Resource(gvr).Namespace(namespace).Create(unstruct, metav1.CreateOptions{}) + createdObj, err = dynClient.Resource(gvr).Namespace(namespace).Create(context.TODO(), unstruct, metav1.CreateOptions{}) case meta.RESTScopeNameRoot: - createdObj, err = dynClient.Resource(gvr).Create(unstruct, metav1.CreateOptions{}) + createdObj, err = dynClient.Resource(gvr).Create(context.TODO(), unstruct, metav1.CreateOptions{}) default: return "", pkgerrors.New("Got an unknown RESTSCopeName for mapping: " + gvk.String()) } @@ -133,9 +134,9 @@ func (g genericPlugin) Update(yamlFilePath string, namespace string, client plug switch mapping.Scope.Name() { case meta.RESTScopeNameNamespace: - updatedObj, err = dynClient.Resource(gvr).Namespace(namespace).Update(unstruct, metav1.UpdateOptions{}) + updatedObj, err = dynClient.Resource(gvr).Namespace(namespace).Update(context.TODO(), unstruct, metav1.UpdateOptions{}) case meta.RESTScopeNameRoot: - updatedObj, err = dynClient.Resource(gvr).Update(unstruct, metav1.UpdateOptions{}) + updatedObj, err = dynClient.Resource(gvr).Update(context.TODO(), unstruct, metav1.UpdateOptions{}) default: return "", pkgerrors.New("Got an unknown RESTSCopeName for mapping: " + gvk.String()) } @@ -170,9 +171,9 @@ func (g genericPlugin) Get(resource helm.KubernetesResource, var unstruct *unstructured.Unstructured switch mapping.Scope.Name() { case meta.RESTScopeNameNamespace: - unstruct, err = dynClient.Resource(gvr).Namespace(namespace).Get(resource.Name, opts) + unstruct, err = dynClient.Resource(gvr).Namespace(namespace).Get(context.TODO(), resource.Name, opts) case meta.RESTScopeNameRoot: - unstruct, err = dynClient.Resource(gvr).Get(resource.Name, opts) + unstruct, err = dynClient.Resource(gvr).Get(context.TODO(), resource.Name, opts) default: return "", pkgerrors.New("Got an unknown RESTSCopeName for mapping: " + resource.GVK.String()) } @@ -212,15 +213,15 @@ func (g genericPlugin) Delete(resource helm.KubernetesResource, namespace string gvr := mapping.Resource deletePolicy := metav1.DeletePropagationForeground - opts := &metav1.DeleteOptions{ + opts := metav1.DeleteOptions{ PropagationPolicy: &deletePolicy, } switch mapping.Scope.Name() { case meta.RESTScopeNameNamespace: - err = dynClient.Resource(gvr).Namespace(namespace).Delete(resource.Name, opts) + err = dynClient.Resource(gvr).Namespace(namespace).Delete(context.TODO(), resource.Name, opts) case meta.RESTScopeNameRoot: - err = dynClient.Resource(gvr).Delete(resource.Name, opts) + err = dynClient.Resource(gvr).Delete(context.TODO(), resource.Name, opts) default: return pkgerrors.New("Got an unknown RESTSCopeName for mapping: " + resource.GVK.String()) } |