-
Notifications
You must be signed in to change notification settings - Fork 463
/
prometheusrules.go
81 lines (62 loc) · 2.42 KB
/
prometheusrules.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors
//
// SPDX-License-Identifier: Apache-2.0
package garden
import (
_ "embed"
monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
"k8s.io/apimachinery/pkg/runtime"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
monitoringutils "github.com/gardener/gardener/pkg/component/observability/monitoring/utils"
)
var (
//go:embed assets/prometheusrules/auditlog.yaml
auditLogYAML []byte
auditLog *monitoringv1.PrometheusRule
//go:embed assets/prometheusrules/etcd.yaml
etcdYAML []byte
etcd *monitoringv1.PrometheusRule
//go:embed assets/prometheusrules/garden.yaml
gardenYAML []byte
garden *monitoringv1.PrometheusRule
//go:embed assets/prometheusrules/metering-meta.yaml
meteringYAML []byte
metering *monitoringv1.PrometheusRule
//go:embed assets/prometheusrules/recording.yaml
recordingYAML []byte
recording *monitoringv1.PrometheusRule
//go:embed assets/prometheusrules/seed.yaml
seedYAML []byte
seed *monitoringv1.PrometheusRule
//go:embed assets/prometheusrules/shoot.yaml
shootYAML []byte
shoot *monitoringv1.PrometheusRule
)
func init() {
auditLog = &monitoringv1.PrometheusRule{}
utilruntime.Must(runtime.DecodeInto(monitoringutils.Decoder, auditLogYAML, auditLog))
etcd = &monitoringv1.PrometheusRule{}
utilruntime.Must(runtime.DecodeInto(monitoringutils.Decoder, etcdYAML, etcd))
garden = &monitoringv1.PrometheusRule{}
utilruntime.Must(runtime.DecodeInto(monitoringutils.Decoder, gardenYAML, garden))
metering = &monitoringv1.PrometheusRule{}
utilruntime.Must(runtime.DecodeInto(monitoringutils.Decoder, meteringYAML, metering))
recording = &monitoringv1.PrometheusRule{}
utilruntime.Must(runtime.DecodeInto(monitoringutils.Decoder, recordingYAML, recording))
seed = &monitoringv1.PrometheusRule{}
utilruntime.Must(runtime.DecodeInto(monitoringutils.Decoder, seedYAML, seed))
shoot = &monitoringv1.PrometheusRule{}
utilruntime.Must(runtime.DecodeInto(monitoringutils.Decoder, shootYAML, shoot))
}
// CentralPrometheusRules returns the central PrometheusRule resources for the garden prometheus.
func CentralPrometheusRules() []*monitoringv1.PrometheusRule {
return []*monitoringv1.PrometheusRule{
auditLog.DeepCopy(),
etcd.DeepCopy(),
garden.DeepCopy(),
metering.DeepCopy(),
recording.DeepCopy(),
seed.DeepCopy(),
shoot.DeepCopy(),
}
}