mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-12-02 03:37:46 +08:00
fix: delete export serviceMonitor.yaml (#1493)
This commit is contained in:
parent
ce627d7769
commit
879f155c2e
@ -5,7 +5,6 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/goodrain/rainbond/db"
|
||||
"github.com/goodrain/rainbond/worker/appm/store"
|
||||
v1 "github.com/goodrain/rainbond/worker/appm/types/v1"
|
||||
"github.com/sirupsen/logrus"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
@ -339,30 +338,6 @@ func (s *exportController) exportOne(app v1.AppService, r *RainbondExport) error
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if crd, _ := s.manager.store.GetCrd(store.ServiceMonitor); crd != nil {
|
||||
if sms := app.GetServiceMonitors(true); len(sms) > 0 {
|
||||
smClient, err := s.manager.store.GetServiceMonitorClient()
|
||||
if err != nil {
|
||||
logrus.Errorf("create service monitor client failure %s", err.Error())
|
||||
}
|
||||
if smClient != nil {
|
||||
for _, sm := range sms {
|
||||
if len(sm.ResourceVersion) == 0 {
|
||||
sm.Kind = "ServiceMonitor"
|
||||
smBytes, err := yaml.Marshal(sm)
|
||||
if err != nil {
|
||||
return fmt.Errorf("sm to yaml failure %v", err)
|
||||
}
|
||||
err = s.write(path.Join(exportTemplatePath, "ServiceMonitor.yaml"), smBytes, "\n---\n")
|
||||
if err != nil {
|
||||
return fmt.Errorf("write sm yaml failure %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
logrus.Infof("Create all app yaml file success, will waiting app export")
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user