diff --git a/pkg/iris/workloads/models/eventsEcst.go b/pkg/iris/workloads/models/eventsEcst.go index 976025c..4074379 100644 --- a/pkg/iris/workloads/models/eventsEcst.go +++ b/pkg/iris/workloads/models/eventsEcst.go @@ -146,8 +146,8 @@ func CreateEcstDiscoveryEvent(eventType string, changeAction string, data Data, func GenerateId(workspaceId string, configId string, data Data) string { scope := fmt.Sprintf(models.EventScopeFormat, workspaceId, configId) - // workspace/{workspaceId}/configuration/{configurationId}/discoveryItem/service/kubernetes/workload/{clusterName}/{workloadName} - idString := fmt.Sprintf("%s/%s/%s/%s", scope, models.EventClassWorkload, data.Workload.ClusterName, data.Workload.WorkloadName) + // workspace/{workspaceId}/configuration/{configurationId}/discoveryItem/service/kubernetes/workload/{clusterName}/{workloadType}/{workloadName} + idString := fmt.Sprintf("%s/%s/%s/%s/%s", scope, models.EventClassWorkload, data.Workload.ClusterName, data.Workload.WorkloadType, data.Workload.WorkloadName) sum := sha256.Sum256([]byte(idString)) id := hex.EncodeToString(sum[:]) return id diff --git a/pkg/iris/workloads/services/events/eventProducer_test.go b/pkg/iris/workloads/services/events/eventProducer_test.go index b991bea..15572c0 100644 --- a/pkg/iris/workloads/services/events/eventProducer_test.go +++ b/pkg/iris/workloads/services/events/eventProducer_test.go @@ -217,10 +217,11 @@ func Test_eventProducer_filter_updated_changed(t *testing.T) { func Test_eventProducer_createECSTEvents(t *testing.T) { mockApi := mocks.NewIrisApi(t) - id1 := sha256.Sum256([]byte(fmt.Sprintf("%s/%s/%s/%s", "workspace/testWorkspaceId/configuration/testConfigId", models.EventClassWorkload, "testCluster1", "testWorkload1"))) - id2 := sha256.Sum256([]byte(fmt.Sprintf("%s/%s/%s/%s", "workspace/testWorkspaceId/configuration/testConfigId", models.EventClassWorkload, "testCluster1", "testWorkload2"))) - id3 := sha256.Sum256([]byte(fmt.Sprintf("%s/%s/%s/%s", "workspace/testWorkspaceId/configuration/testConfigId", models.EventClassWorkload, "testCluster2", "testWorkload1"))) - id4 := sha256.Sum256([]byte(fmt.Sprintf("%s/%s/%s/%s", "workspace/testWorkspaceId/configuration/testConfigId", models.EventClassWorkload, "testCluster2", "testWorkload2"))) + id1 := sha256.Sum256([]byte(fmt.Sprintf("%s/%s/%s/%s/%s", "workspace/testWorkspaceId/configuration/testConfigId", models.EventClassWorkload, "testCluster1", "deployment", "testWorkload1"))) + //workspace/testWorkspaceId/configuration/testConfigId/discoveryItem/service/kubernetes/workload/testCluster1/deployment/testWorkload2 + id2 := sha256.Sum256([]byte(fmt.Sprintf("%s/%s/%s/%s/%s", "workspace/testWorkspaceId/configuration/testConfigId", models.EventClassWorkload, "testCluster1", "deployment", "testWorkload2"))) + id3 := sha256.Sum256([]byte(fmt.Sprintf("%s/%s/%s/%s/%s", "workspace/testWorkspaceId/configuration/testConfigId", models.EventClassWorkload, "testCluster2", "deployment", "testWorkload1"))) + id4 := sha256.Sum256([]byte(fmt.Sprintf("%s/%s/%s/%s/%s", "workspace/testWorkspaceId/configuration/testConfigId", models.EventClassWorkload, "testCluster2", "deployment", "testWorkload2"))) newData := []workload.Workload{ { ClusterName: "testCluster1",