summaryrefslogtreecommitdiffstats
path: root/src/k8splugin/internal/app
diff options
context:
space:
mode:
authorMichal Chabiera <michal.chabiera@orange.com>2021-08-17 11:43:31 +0200
committerMichal Chabiera <michal.chabiera@orange.com>2021-08-17 11:43:31 +0200
commit11278377a06429401ac00bad7536f843790466c3 (patch)
treee80fbe9b7c9d480dfe2dbcb4f758767f36efe36b /src/k8splugin/internal/app
parent9a671e0a51e3cde71b601585e6abbbdd3b84e13a (diff)
Fix Status API resolution
Fix Status API resolution Issue-ID: MULTICLOUD-1372 Signed-off-by: Michal Chabiera <michal.chabiera@orange.com> Change-Id: I4cc2c95dfe0e8be718e2083fcc328b1e2951f27d
Diffstat (limited to 'src/k8splugin/internal/app')
-rw-r--r--src/k8splugin/internal/app/instance.go38
1 files changed, 20 insertions, 18 deletions
diff --git a/src/k8splugin/internal/app/instance.go b/src/k8splugin/internal/app/instance.go
index 1c9c81a9..5aa60882 100644
--- a/src/k8splugin/internal/app/instance.go
+++ b/src/k8splugin/internal/app/instance.go
@@ -545,24 +545,6 @@ func (v *InstanceClient) checkRssStatus(rss helm.KubernetesResource, k8sClient K
apiVersion, kind := rss.GVK.ToAPIVersionAndKind()
log.Printf("apiVersion: %s, Kind: %s", apiVersion, kind)
- restClient, err := k8sClient.getRestApi(apiVersion)
- if err != nil {
- return false, err
- }
- mapper := k8sClient.GetMapper()
- mapping, err := mapper.RESTMapping(schema.GroupKind{
- Group: rss.GVK.Group,
- Kind: rss.GVK.Kind,
- }, rss.GVK.Version)
- resourceInfo := resource.Info{
- Client: restClient,
- Mapping: mapping,
- Namespace: namespace,
- Name: rss.Name,
- Source: "",
- Object: nil,
- ResourceVersion: "",
- }
var parsedRes runtime.Object
//TODO: Should we care about different api version for a same kind?
@@ -591,6 +573,26 @@ func (v *InstanceClient) checkRssStatus(rss helm.KubernetesResource, k8sClient K
//For not listed resource, consider ready
return true, nil
}
+
+ restClient, err := k8sClient.getRestApi(apiVersion)
+ if err != nil {
+ return false, err
+ }
+ mapper := k8sClient.GetMapper()
+ mapping, err := mapper.RESTMapping(schema.GroupKind{
+ Group: rss.GVK.Group,
+ Kind: rss.GVK.Kind,
+ }, rss.GVK.Version)
+ resourceInfo := resource.Info{
+ Client: restClient,
+ Mapping: mapping,
+ Namespace: namespace,
+ Name: rss.Name,
+ Source: "",
+ Object: nil,
+ ResourceVersion: "",
+ }
+
err = runtime.DefaultUnstructuredConverter.FromUnstructured(status.Status.Object, parsedRes)
if err != nil {
return false, err