Skip to content

Commit 420f49e

Browse files
Arta AsadiArta Asadi
Arta Asadi
authored and
Arta Asadi
committed
fix: skip task type plugins to create discovery jobs
1 parent 0607514 commit 420f49e

File tree

6 files changed

+28
-4
lines changed

6 files changed

+28
-4
lines changed

assets/postgres-backup/dex.bak

-15.8 KB
Binary file not shown.

jobs/post-install-job/job/migration_list.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@ import (
2121

2222
// This map seems unchanged between branches in the non-conflicting part
2323
var migrations = map[string]types.Migration{
24+
"auth": auth.Migration{},
2425
"elasticsearch": elasticsearch.Migration{},
2526
"manifest": manifest.Migration{},
2627
}
2728

2829
// This order seems unchanged between branches in the non-conflicting part
2930
var Order = []string{
31+
"auth",
3032
"elasticsearch",
3133
"manifest",
3234
}

services/integration/api/integration-types/api.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,23 @@ func (a *API) GetResourceTypeFromTableName(c echo.Context) error {
158158
func (a *API) GetConfiguration(c echo.Context) error {
159159
integrationType := c.Param("integration_type")
160160

161+
plugin, err := a.database.GetPluginByID(integrationType)
162+
if err != nil {
163+
a.logger.Error("failed to get integration plugin", zap.String("integrationType", string(integrationType)), zap.Error(err))
164+
return echo.NewHTTPError(500, "failed to get integration plugin")
165+
}
166+
161167
rtMap := a.typeManager.GetIntegrationTypeMap()
162168
if value, ok := rtMap[a.typeManager.ParseType(integrationType)]; ok {
163169
conf, err := value.GetConfiguration()
164170
if err != nil {
165171
return echo.NewHTTPError(500, err.Error())
166172
}
167173

168-
return c.JSON(200, conf)
174+
return c.JSON(200, models.IntegrationTypeConfiguration{
175+
IntegrationConfiguration: conf,
176+
DiscoveryType: string(plugin.DiscoveryType),
177+
})
169178
} else {
170179
return echo.NewHTTPError(404, "integration type not found")
171180
}

services/integration/api/models/integration_type.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,8 @@ type GetResourceTypesByLabelsResponse struct {
5252
type ListTablesResponse struct {
5353
Tables map[string][]interfaces.CloudQLColumn `json:"tables"`
5454
}
55+
56+
type IntegrationTypeConfiguration struct {
57+
interfaces.IntegrationConfiguration
58+
DiscoveryType string `json:"discovery_type"`
59+
}

services/integration/client/integration.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type IntegrationServiceClient interface {
1616
GetResourceTypeFromTableName(ctx *httpclient.Context, integrationType string, tableName string) (string, error)
1717
GetResourceTypesByLabels(ctx *httpclient.Context, integrationType string, labels map[string]string, integrationID *string) ([]interfaces.ResourceTypeConfiguration, error)
1818
GetIntegrationTypeTables(ctx *httpclient.Context, integrationType string) (map[string][]interfaces.CloudQLColumn, error)
19-
GetIntegrationConfiguration(ctx *httpclient.Context, integrationType string) (interfaces.IntegrationConfiguration, error)
19+
GetIntegrationConfiguration(ctx *httpclient.Context, integrationType string) (models.IntegrationTypeConfiguration, error)
2020
GetIntegration(ctx *httpclient.Context, integrationID string) (*models.Integration, error)
2121
ListIntegrations(ctx *httpclient.Context, integrationTypes []string) (*models.ListIntegrationsResponse, error)
2222
ListIntegrationsByFilters(ctx *httpclient.Context, req models.ListIntegrationsRequest) (*models.ListIntegrationsResponse, error)
@@ -102,9 +102,9 @@ func (c *integrationClient) GetIntegrationTypeTables(ctx *httpclient.Context, in
102102
return response.Tables, nil
103103
}
104104

105-
func (c *integrationClient) GetIntegrationConfiguration(ctx *httpclient.Context, integrationType string) (interfaces.IntegrationConfiguration, error) {
105+
func (c *integrationClient) GetIntegrationConfiguration(ctx *httpclient.Context, integrationType string) (models.IntegrationTypeConfiguration, error) {
106106
url := fmt.Sprintf("%s/api/v1/integration-types/%s/configuration", c.baseURL, integrationType)
107-
var response interfaces.IntegrationConfiguration
107+
var response models.IntegrationTypeConfiguration
108108

109109
if statusCode, err := httpclient.DoRequest(ctx.Ctx, http.MethodGet, url, ctx.ToHeaders(), nil, &response); err != nil {
110110
if 400 <= statusCode && statusCode < 500 {

services/scheduler/scheduler_describe.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,14 @@ func (s *Scheduler) scheduleDescribeJob(ctx context.Context) {
206206
}
207207

208208
for _, integration := range integrations.Integrations {
209+
plugin, err := s.integrationClient.GetIntegrationConfiguration(&httpclient.Context{UserRole: apiAuth.AdminRole}, integration.IntegrationType.String())
210+
if err != nil {
211+
s.logger.Error("failed to get integration configuration", zap.String("spot", "GetIntegrationConfiguration"), zap.Error(err))
212+
continue
213+
}
214+
if plugin.DiscoveryType == "task" {
215+
continue
216+
}
209217
if integration.State == models.IntegrationStateSample || integration.State == models.IntegrationStateInactive {
210218
continue
211219
}

0 commit comments

Comments
 (0)