diff --git a/models/generators/monitoring/monitoring.go b/models/generators/monitoring/monitoring.go index edaa6f0..ad607d4 100644 --- a/models/generators/monitoring/monitoring.go +++ b/models/generators/monitoring/monitoring.go @@ -45,8 +45,14 @@ func (g *MonitoringModule) Generate(_ context.Context, request *module.Generator if err != nil { return nil, err } + patcher := &v1.Patcher{ + Labels: map[string]string{ + "kusion_monitoring_appname": request.App, + }, + } return &module.GeneratorResponse{ Resources: []v1.Resource{*resource}, + Patchers: []v1.Patcher{*patcher}, }, nil } else if g.MonitorType == PodMonitorType { // Create PodMonitor if MonitorType is Pod @@ -59,8 +65,14 @@ func (g *MonitoringModule) Generate(_ context.Context, request *module.Generator if err != nil { return nil, err } + patcher := &v1.Patcher{ + Labels: map[string]string{ + "kusion_monitoring_appname": request.App, + }, + } return &module.GeneratorResponse{ Resources: []v1.Resource{*resource}, + Patchers: []v1.Patcher{*patcher}, }, nil } else { return nil, fmt.Errorf("MonitorType should either be service or pod %s", g.MonitorType) diff --git a/models/schema/v1/app_configuration.k b/models/schema/v1/app_configuration.k index 388aa28..81243b8 100644 --- a/models/schema/v1/app_configuration.k +++ b/models/schema/v1/app_configuration.k @@ -1,8 +1,4 @@ import models.schema.v1.workload as wl -import models.schema.v1.trait as t -import models.schema.v1.monitoring as m -import models.schema.v1.accessories.mysql -import models.schema.v1.accessories.postgres schema AppConfiguration: """ AppConfiguration is a developer-centric definition that describes how to run an Application.