aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kud/deployment_infra/playbooks/configure-virtlet.yml2
-rw-r--r--src/k8splugin/plugins/generic/plugin.go23
2 files changed, 21 insertions, 4 deletions
diff --git a/kud/deployment_infra/playbooks/configure-virtlet.yml b/kud/deployment_infra/playbooks/configure-virtlet.yml
index 753e487e..aba849a4 100644
--- a/kud/deployment_infra/playbooks/configure-virtlet.yml
+++ b/kud/deployment_infra/playbooks/configure-virtlet.yml
@@ -42,7 +42,7 @@
- regexp: 'centos/(\d+)-(\d+)'
url: 'https://cloud.centos.org/centos/$1/images/CentOS-$1-x86_64-GenericCloud-$2.qcow2'
- name: fedora
- url: https://download.fedoraproject.org/pub/fedora/linux/releases/27/CloudImages/x86_64/images/Fedora-Cloud-Base-27-1.6.x86_64.qcow2
+ url: https://dl.fedoraproject.org/pub/fedora/linux/releases/29/Cloud/x86_64/images/Fedora-Cloud-Base-29-1.2.x86_64.qcow2
{% if lookup('env','http_proxy') != "" %}
transports:
"":
diff --git a/src/k8splugin/plugins/generic/plugin.go b/src/k8splugin/plugins/generic/plugin.go
index 9073535c..f3b2798a 100644
--- a/src/k8splugin/plugins/generic/plugin.go
+++ b/src/k8splugin/plugins/generic/plugin.go
@@ -17,6 +17,7 @@ import (
"log"
pkgerrors "github.com/pkg/errors"
+ "k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime/schema"
@@ -59,8 +60,17 @@ func (g genericPlugin) Create(yamlFilePath string, namespace string, client *app
}
gvr := mapping.Resource
+ var createdObj *unstructured.Unstructured
+
+ switch mapping.Scope.Name() {
+ case meta.RESTScopeNameNamespace:
+ createdObj, err = dynClient.Resource(gvr).Namespace(namespace).Create(unstruct, metav1.CreateOptions{})
+ case meta.RESTScopeNameRoot:
+ createdObj, err = dynClient.Resource(gvr).Create(unstruct, metav1.CreateOptions{})
+ default:
+ return "", pkgerrors.New("Got an unknown RESTSCopeName for mapping: " + gvk.String())
+ }
- createdObj, err := dynClient.Resource(gvr).Namespace(namespace).Create(unstruct, metav1.CreateOptions{})
if err != nil {
return "", pkgerrors.Wrap(err, "Create object error")
}
@@ -93,11 +103,18 @@ func (g genericPlugin) Delete(resource helm.KubernetesResource, namespace string
gvr := mapping.Resource
log.Printf("Using gvr: %s, %s, %s", gvr.Group, gvr.Version, gvr.Resource)
- err = dynClient.Resource(gvr).Namespace(namespace).Delete(resource.Name, opts)
+ switch mapping.Scope.Name() {
+ case meta.RESTScopeNameNamespace:
+ err = dynClient.Resource(gvr).Namespace(namespace).Delete(resource.Name, opts)
+ case meta.RESTScopeNameRoot:
+ err = dynClient.Resource(gvr).Delete(resource.Name, opts)
+ default:
+ return pkgerrors.New("Got an unknown RESTSCopeName for mapping: " + resource.GVK.String())
+ }
+
if err != nil {
return pkgerrors.Wrap(err, "Delete object error")
}
-
return nil
}