Skip to content

Commit

Permalink
Update docs/generated/checks.md
Browse files Browse the repository at this point in the history
Co-authored-by: Stephan Hesselmann <[email protected]>

Update pkg/templates/danglingservicemonitor/template.go

Co-authored-by: Stephan Hesselmann <[email protected]>

Update pkg/templates/danglingservicemonitor/template_test.go

Co-authored-by: Stephan Hesselmann <[email protected]>

Update template_test.go
  • Loading branch information
abrad3 committed Sep 28, 2023
1 parent 59ad13d commit ade864d
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/generated/checks.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ verbs:
**Enabled by default**: No
**Description**: Indicates when a service monitor's label selector doesn't match any pods. ServiceMonitors are a custom resource only used by the Prometheus operator (https://prometheus-operator.dev/docs/operator/design/#servicemonitor).
**Description**: Indicates when a service monitor's selectors don't match any service. ServiceMonitors are a custom resource only used by the Prometheus operator (https://prometheus-operator.dev/docs/operator/design/#servicemonitor).
**Remediation**: Check selectors and your services.
Expand Down
2 changes: 1 addition & 1 deletion pkg/templates/danglingservicemonitor/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func init() {
}

}
return []diagnostic.Diagnostic{{Message: fmt.Sprintf("no services found matching Service Monitor's labelSelector (%s) or namespace selector (%s)", labelSelector, nsSelector.MatchNames)}}
return []diagnostic.Diagnostic{{Message: fmt.Sprintf("no services found matching the service monitor's label selector (%s) and namespace selector (%s)", labelSelector, nsSelector.MatchNames)}}
}, nil
}),
})
Expand Down
2 changes: 0 additions & 2 deletions pkg/templates/danglingservicemonitor/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,13 @@ func (s *DanglingServiceMonitorTestSuite) AddServiceMonitorWithLabelSelector(nam
s.ctx.AddMockServiceMonitor(s.T(), name)
s.ctx.ModifyServiceMonitor(s.T(), name, func(servicemonitor *k8sMonitoring.ServiceMonitor) {
servicemonitor.Spec.Selector = labelSelector
fmt.Println(servicemonitor)
})
}

func (s *DanglingServiceMonitorTestSuite) AddServiceMonitorWithNamespaceSelector(name string, namespaceSelector k8sMonitoring.NamespaceSelector) {
s.ctx.AddMockServiceMonitor(s.T(), name)
s.ctx.ModifyServiceMonitor(s.T(), name, func(servicemonitor *k8sMonitoring.ServiceMonitor) {
servicemonitor.Spec.NamespaceSelector = namespaceSelector
fmt.Println(servicemonitor)
})
}

Expand Down

0 comments on commit ade864d

Please sign in to comment.