diff options
author | Lukasz Rajewski <lukasz.rajewski@orange.com> | 2021-04-20 16:59:11 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2021-04-20 16:59:11 +0000 |
commit | 4ff7900c3c74fa6b497af6d1e36f81e08a193d83 (patch) | |
tree | d6ce5f3dffe6130fd8c20b853ba6dc2fce48c349 /src/k8splugin/plugins/namespace/plugin.go | |
parent | c7f90394d625a8e323e8095e711338ccc44c472b (diff) | |
parent | 1f60346da61383f18b7277037439711aef38a0fe (diff) |
Merge "Migrate to use Helm v3 libraries"
Diffstat (limited to 'src/k8splugin/plugins/namespace/plugin.go')
-rw-r--r-- | src/k8splugin/plugins/namespace/plugin.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/k8splugin/plugins/namespace/plugin.go b/src/k8splugin/plugins/namespace/plugin.go index cfc395bb..59defa36 100644 --- a/src/k8splugin/plugins/namespace/plugin.go +++ b/src/k8splugin/plugins/namespace/plugin.go @@ -14,6 +14,7 @@ limitations under the License. package main import ( + "context" "log" pkgerrors "github.com/pkg/errors" @@ -42,7 +43,7 @@ func (p namespacePlugin) Create(yamlFilePath string, namespace string, client pl Name: namespace, }, } - _, err := client.GetStandardClient().CoreV1().Namespaces().Create(namespaceObj) + _, err := client.GetStandardClient().CoreV1().Namespaces().Create(context.TODO(), namespaceObj, metaV1.CreateOptions{}) if err != nil { return "", pkgerrors.Wrap(err, "Create Namespace error") } @@ -54,7 +55,7 @@ func (p namespacePlugin) Create(yamlFilePath string, namespace string, client pl // Get an existing namespace hosted in a specific Kubernetes cluster func (p namespacePlugin) Get(resource helm.KubernetesResource, namespace string, client plugin.KubernetesConnector) (string, error) { opts := metaV1.GetOptions{} - ns, err := client.GetStandardClient().CoreV1().Namespaces().Get(resource.Name, opts) + ns, err := client.GetStandardClient().CoreV1().Namespaces().Get(context.TODO(), resource.Name, opts) if err != nil { return "", pkgerrors.Wrap(err, "Get Namespace error") } @@ -65,12 +66,12 @@ func (p namespacePlugin) Get(resource helm.KubernetesResource, namespace string, // Delete an existing namespace hosted in a specific Kubernetes cluster func (p namespacePlugin) Delete(resource helm.KubernetesResource, namespace string, client plugin.KubernetesConnector) error { deletePolicy := metaV1.DeletePropagationForeground - opts := &metaV1.DeleteOptions{ + opts := metaV1.DeleteOptions{ PropagationPolicy: &deletePolicy, } log.Println("Deleting namespace: " + resource.Name) - if err := client.GetStandardClient().CoreV1().Namespaces().Delete(resource.Name, opts); err != nil { + if err := client.GetStandardClient().CoreV1().Namespaces().Delete(context.TODO(), resource.Name, opts); err != nil { return pkgerrors.Wrap(err, "Delete namespace error") } @@ -84,7 +85,7 @@ func (p namespacePlugin) List(gvk schema.GroupVersionKind, namespace string, cli Limit: utils.ResourcesListLimit, } - list, err := client.GetStandardClient().CoreV1().Namespaces().List(opts) + list, err := client.GetStandardClient().CoreV1().Namespaces().List(context.TODO(), opts) if err != nil { return nil, pkgerrors.Wrap(err, "Get Namespace list error") } |