Skip to content

Commit

Permalink
feature. seperate thanos-ruler-configmap file
Browse files Browse the repository at this point in the history
  • Loading branch information
ktkfree committed Apr 15, 2024
1 parent 40e5920 commit 0fa2d5f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions cmd/server/system_notification_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

const RULER_FILE_NAME = "ruler-user.yaml"

type RuleAnnotation struct {
CheckPoint string `yaml:"CheckPoint"`
Description string `yaml:"description"`
Expand Down Expand Up @@ -136,7 +138,7 @@ func processSystemNotificationRule() error {
}

var rulerConfig RulerConfig
err = yaml.Unmarshal([]byte(cm.Data["ruler.yml"]), &rulerConfig)
err = yaml.Unmarshal([]byte(cm.Data[RULER_FILE_NAME]), &rulerConfig)
if err != nil {
log.Error(context.TODO(), err)
continue
Expand All @@ -157,7 +159,7 @@ func processSystemNotificationRule() error {
log.Error(context.TODO(), err)
continue
}
cm.Data["ruler.yml"] = string(b)
cm.Data[RULER_FILE_NAME] = string(b)

_, err = clientset.CoreV1().ConfigMaps("lma").Update(context.TODO(), cm, metav1.UpdateOptions{})
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func (x *SystemNotificationAccessor) GetIncompletedRules() ([]SystemNotification
Joins("join clusters on clusters.id = organizations.primary_cluster_id AND clusters.status = ?", domain.ClusterStatus_RUNNING).
Joins("join app_groups on app_groups.cluster_id = clusters.id AND app_groups.status = ?", domain.AppGroupStatus_RUNNING).
Where("system_notification_rules.status = ?", domain.SystemNotificationRuleStatus_PENDING).
//Where("system_notification_rules.is_system = true"). // FOR TEST!!!!
//Where("system_notification_rules.is_system = false").
Order("system_notification_rules.organization_id").
Find(&rules)

Expand Down

0 comments on commit 0fa2d5f

Please sign in to comment.