Skip to content

Commit 0d1c405

Browse files
Arta AsadiArta Asadi
authored andcommitted
fix: change discovery and integration info
1 parent 9f93076 commit 0d1c405

File tree

3 files changed

+716
-17
lines changed

3 files changed

+716
-17
lines changed

platform/healthcheck.go

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,12 @@ package main
22

33
import (
44
"github.com/opengovern/og-describer-kubernetes/global/constants"
5-
"k8s.io/client-go/kubernetes"
6-
"k8s.io/client-go/tools/clientcmd"
75
)
86

97
// Config represents the JSON input configuration
108
type Config struct {
119
}
1210

1311
func IntegrationHealthcheck(creds constants.IntegrationCredentials, cfg Config) (bool, error) {
14-
config, err := clientcmd.RESTConfigFromKubeConfig([]byte(creds.KubeConfig))
15-
if err != nil {
16-
return false, err
17-
}
18-
clientSet, err := kubernetes.NewForConfig(config)
19-
if err != nil {
20-
return false, err
21-
}
22-
23-
_, err = clientSet.ServerVersion()
24-
if err != nil {
25-
return false, err
26-
}
27-
28-
return true, nil
12+
return DoHealthcheck(creds.KubeConfig)
2913
}

platform/integration.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package main
22

33
import (
44
"encoding/json"
5+
"github.com/jackc/pgtype"
56
"github.com/opengovern/og-describer-kubernetes/global"
67
constants2 "github.com/opengovern/og-describer-kubernetes/global/constants"
78
"github.com/opengovern/og-describer-kubernetes/global/maps"
@@ -55,10 +56,21 @@ func (i *Integration) DiscoverIntegrations(jsonData []byte) ([]integration.Integ
5556
return nil, err
5657
}
5758

59+
info, err := DoDiscovery(credentials.KubeConfig)
60+
if err != nil {
61+
return nil, err
62+
}
63+
64+
var labels pgtype.JSONB
65+
if err := labels.Set(info); err != nil {
66+
return nil, err
67+
}
68+
5869
return []integration.Integration{
5970
{
6071
ProviderID: config.Host,
6172
Name: config.Host,
73+
Labels: labels,
6274
},
6375
}, nil
6476
}

0 commit comments

Comments
 (0)