Skip to content

Commit

Permalink
add resource patching in operator mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ffforest committed Mar 21, 2024
1 parent 11714e3 commit 506b18f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
12 changes: 12 additions & 0 deletions models/generators/monitoring/monitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
4 changes: 0 additions & 4 deletions models/schema/v1/app_configuration.k
Original file line number Diff line number Diff line change
@@ -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.
Expand Down

0 comments on commit 506b18f

Please sign in to comment.