Skip to content

Commit 942acbc

Browse files
authored
Merge branch 'master' into test_finalizers
2 parents 9d15d89 + 2a32c4f commit 942acbc

File tree

9 files changed

+83
-12
lines changed

9 files changed

+83
-12
lines changed

api/v1beta1/grafanaalertrulegroup_types.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@ type AlertRule struct {
8686
// +kubebuilder:validation:Enum=Alerting;NoData;OK;KeepLast
8787
NoDataState *string `json:"noDataState"`
8888

89+
// The number of missing series evaluations that must occur before the rule is considered to be resolved.
90+
MissingSeriesEvalsToResolve *int64 `json:"missingSeriesEvalsToResolve,omitempty"`
91+
92+
// +kubebuilder:validation:Type=string
93+
// +kubebuilder:validation:Format=duration
94+
// +kubebuilder:validation:Pattern="^([0-9]+(\\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$"
95+
KeepFiringFor *metav1.Duration `json:"keepFiringFor,omitempty"`
96+
8997
Record *Record `json:"record,omitempty"`
9098

9199
// +kubebuilder:validation:MinLength=1

api/v1beta1/zz_generated.deepcopy.go

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/grafana.integreatly.org_grafanaalertrulegroups.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,19 @@ spec:
199199
type: string
200200
isPaused:
201201
type: boolean
202+
keepFiringFor:
203+
format: duration
204+
pattern: ^([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$
205+
type: string
202206
labels:
203207
additionalProperties:
204208
type: string
205209
type: object
210+
missingSeriesEvalsToResolve:
211+
description: The number of missing series evaluations that must
212+
occur before the rule is considered to be resolved.
213+
format: int64
214+
type: integer
206215
noDataState:
207216
enum:
208217
- Alerting

controllers/alertrulegroup_controller.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,10 @@ func crToModel(cr *grafanav1beta1.GrafanaAlertRuleGroup, folderUID string) model
185185
}
186186
}
187187

188+
if r.MissingSeriesEvalsToResolve != nil {
189+
apiRule.MissingSeriesEvalsToResolve = *r.MissingSeriesEvalsToResolve
190+
}
191+
188192
for idx, q := range r.Data {
189193
apiRule.Data[idx] = &models.AlertQuery{
190194
DatasourceUID: q.DatasourceUID,
@@ -195,6 +199,10 @@ func crToModel(cr *grafanav1beta1.GrafanaAlertRuleGroup, folderUID string) model
195199
}
196200
}
197201

202+
if r.KeepFiringFor != nil {
203+
apiRule.KeepFiringFor = (strfmt.Duration)(r.KeepFiringFor.Duration)
204+
}
205+
198206
mRules = append(mRules, apiRule)
199207
}
200208

deploy/helm/grafana-operator/crds/grafana.integreatly.org_grafanaalertrulegroups.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,19 @@ spec:
199199
type: string
200200
isPaused:
201201
type: boolean
202+
keepFiringFor:
203+
format: duration
204+
pattern: ^([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$
205+
type: string
202206
labels:
203207
additionalProperties:
204208
type: string
205209
type: object
210+
missingSeriesEvalsToResolve:
211+
description: The number of missing series evaluations that must
212+
occur before the rule is considered to be resolved.
213+
format: int64
214+
type: integer
206215
noDataState:
207216
enum:
208217
- Alerting

deploy/kustomize/base/crds.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,19 @@ spec:
198198
type: string
199199
isPaused:
200200
type: boolean
201+
keepFiringFor:
202+
format: duration
203+
pattern: ^([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$
204+
type: string
201205
labels:
202206
additionalProperties:
203207
type: string
204208
type: object
209+
missingSeriesEvalsToResolve:
210+
description: The number of missing series evaluations that must
211+
occur before the rule is considered to be resolved.
212+
format: int64
213+
type: integer
205214
noDataState:
206215
enum:
207216
- Alerting

docs/docs/api.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,13 +365,31 @@ AlertRule defines a specific rule to be evaluated. It is based on the upstream m
365365
<br/>
366366
</td>
367367
<td>false</td>
368+
</tr><tr>
369+
<td><b>keepFiringFor</b></td>
370+
<td>string</td>
371+
<td>
372+
<br/>
373+
<br/>
374+
<i>Format</i>: duration<br/>
375+
</td>
376+
<td>false</td>
368377
</tr><tr>
369378
<td><b>labels</b></td>
370379
<td>map[string]string</td>
371380
<td>
372381
<br/>
373382
</td>
374383
<td>false</td>
384+
</tr><tr>
385+
<td><b>missingSeriesEvalsToResolve</b></td>
386+
<td>integer</td>
387+
<td>
388+
The number of missing series evaluations that must occur before the rule is considered to be resolved.<br/>
389+
<br/>
390+
<i>Format</i>: int64<br/>
391+
</td>
392+
<td>false</td>
375393
</tr><tr>
376394
<td><b><a href="#grafanaalertrulegroupspecrulesindexnotificationsettings">notificationSettings</a></b></td>
377395
<td>object</td>

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ require (
1010
github.com/go-logr/logr v1.4.3
1111
github.com/go-openapi/strfmt v0.23.0
1212
github.com/google/go-jsonnet v0.21.0
13-
github.com/grafana/grafana-openapi-client-go v0.0.0-20250108132429-8d7e1f158f65
13+
github.com/grafana/grafana-openapi-client-go v0.0.0-20250617151817-c0f8cbb88d5c
1414
github.com/onsi/ginkgo/v2 v2.23.4
1515
github.com/onsi/gomega v1.38.0
1616
github.com/openshift/api v0.0.0-20190924102528-32369d4db2ad
@@ -46,7 +46,7 @@ require (
4646
github.com/go-logr/stdr v1.2.2 // indirect
4747
github.com/go-ole/go-ole v1.2.6 // indirect
4848
github.com/go-openapi/analysis v0.23.0 // indirect
49-
github.com/go-openapi/errors v0.22.0 // indirect
49+
github.com/go-openapi/errors v0.22.1 // indirect
5050
github.com/go-openapi/loads v0.22.0 // indirect
5151
github.com/go-openapi/runtime v0.28.0 // indirect
5252
github.com/go-openapi/spec v0.21.0 // indirect
@@ -102,13 +102,13 @@ require (
102102
github.com/go-logr/zapr v1.3.0 // indirect
103103
github.com/go-openapi/jsonpointer v0.21.0 // indirect
104104
github.com/go-openapi/jsonreference v0.21.0 // indirect
105-
github.com/go-openapi/swag v0.23.0 // indirect
105+
github.com/go-openapi/swag v0.23.1 // indirect
106106
github.com/gogo/protobuf v1.3.2 // indirect
107107
github.com/google/go-cmp v0.7.0 // indirect
108108
github.com/google/uuid v1.6.0 // indirect
109109
github.com/josharian/intern v1.0.0 // indirect
110110
github.com/json-iterator/go v1.1.12 // indirect
111-
github.com/mailru/easyjson v0.7.7 // indirect
111+
github.com/mailru/easyjson v0.9.0 // indirect
112112
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
113113
github.com/modern-go/reflect2 v1.0.2 // indirect
114114
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect

go.sum

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
6969
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
7070
github.com/go-openapi/analysis v0.23.0 h1:aGday7OWupfMs+LbmLZG4k0MYXIANxcuBTYUC03zFCU=
7171
github.com/go-openapi/analysis v0.23.0/go.mod h1:9mz9ZWaSlV8TvjQHLl2mUW2PbZtemkE8yA5v22ohupo=
72-
github.com/go-openapi/errors v0.22.0 h1:c4xY/OLxUBSTiepAg3j/MHuAv5mJhnf53LLMWFB+u/w=
73-
github.com/go-openapi/errors v0.22.0/go.mod h1:J3DmZScxCDufmIMsdOuDHxJbdOGC0xtUynjIx092vXE=
72+
github.com/go-openapi/errors v0.22.1 h1:kslMRRnK7NCb/CvR1q1VWuEQCEIsBGn5GgKD9e+HYhU=
73+
github.com/go-openapi/errors v0.22.1/go.mod h1:+n/5UdIqdVnLIJ6Q9Se8HNGUXYaY6CN8ImWzfi/Gzp0=
7474
github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ=
7575
github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY=
7676
github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF2+tg1TRrwQ=
@@ -83,8 +83,8 @@ github.com/go-openapi/spec v0.21.0 h1:LTVzPc3p/RzRnkQqLRndbAzjY0d0BCL72A6j3CdL9Z
8383
github.com/go-openapi/spec v0.21.0/go.mod h1:78u6VdPw81XU44qEWGhtr982gJ5BWg2c0I5XwVMotYk=
8484
github.com/go-openapi/strfmt v0.23.0 h1:nlUS6BCqcnAk0pyhi9Y+kdDVZdZMHfEKQiS4HaMgO/c=
8585
github.com/go-openapi/strfmt v0.23.0/go.mod h1:NrtIpfKtWIygRkKVsxh7XQMDQW5HKQl6S5ik2elW+K4=
86-
github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE=
87-
github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ=
86+
github.com/go-openapi/swag v0.23.1 h1:lpsStH0n2ittzTnbaSloVZLuB5+fvSY/+hnagBjSNZU=
87+
github.com/go-openapi/swag v0.23.1/go.mod h1:STZs8TbRvEQQKUA+JZNAm3EWlgaOBGpyFDqQnDHMef0=
8888
github.com/go-openapi/validate v0.24.0 h1:LdfDKwNbpB6Vn40xhTdNZAnfLECL81w+VX3BumrGD58=
8989
github.com/go-openapi/validate v0.24.0/go.mod h1:iyeX1sEufmv3nPbBdX3ieNviWnOZaJ1+zquzJEf2BAQ=
9090
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
@@ -108,8 +108,8 @@ github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 h1:BHT72Gu3keYf3ZEu2J
108108
github.com/google/pprof v0.0.0-20250403155104-27863c87afa6/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA=
109109
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
110110
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
111-
github.com/grafana/grafana-openapi-client-go v0.0.0-20250108132429-8d7e1f158f65 h1:AnfwjPE8TXJO8CX0Q5PvtzGta9Ls3iRASWVV4jHl4KA=
112-
github.com/grafana/grafana-openapi-client-go v0.0.0-20250108132429-8d7e1f158f65/go.mod h1:hiZnMmXc9KXNUlvkV2BKFsiWuIFF/fF4wGgYWEjBitI=
111+
github.com/grafana/grafana-openapi-client-go v0.0.0-20250617151817-c0f8cbb88d5c h1:jox7J0BnJmcZJp8lp631u4gjDEoIfpi6O3yrpiXNTtg=
112+
github.com/grafana/grafana-openapi-client-go v0.0.0-20250617151817-c0f8cbb88d5c/go.mod h1:AOzHLStinAJHJmcih1eEbIRImxpT6enYUsZLnnOvhbo=
113113
github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo=
114114
github.com/grpc-ecosystem/grpc-gateway/v2 v2.24.0 h1:TmHmbvxPmaegwhDubVz0lICL0J5Ka2vwTzhoePEXsGE=
115115
github.com/grpc-ecosystem/grpc-gateway/v2 v2.24.0/go.mod h1:qztMSjm835F2bXf+5HKAPIS5qsmQDqZna/PgVt4rWtI=
@@ -131,8 +131,8 @@ github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ
131131
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I=
132132
github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE=
133133
github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
134-
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
135-
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
134+
github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4=
135+
github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
136136
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
137137
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
138138
github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0=

0 commit comments

Comments
 (0)