Skip to content

Commit 6054d58

Browse files
committed
CNTRLPLANE-1576: add event-ttl configuration to kube-apiserver
This adds a minute based configuration to configure the event ttl setting in kube-apiserver. Default will stay 3h, as currently defined in KAS-O. Signed-off-by: Thomas Jungblut <tjungblu@redhat.com>
1 parent 230d0e0 commit 6054d58

File tree

9 files changed

+120
-0
lines changed

9 files changed

+120
-0
lines changed

openapi/generated_openapi/zz_generated.openapi.go

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

openapi/openapi.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30290,6 +30290,11 @@
3029030290
"forceRedeploymentReason"
3029130291
],
3029230292
"properties": {
30293+
"eventTTLMinutes": {
30294+
"description": "eventTTLMinutes specifies the amount of time that the events are stored before being deleted. This setting is allowed between 30 minutes minimum up to 6h (360 minutes).\n\nWhen omitted this means no opinion, and the platform is left to choose a reasonable default, which is subject to change over time. The current default value is 3h (180 minutes).",
30295+
"type": "integer",
30296+
"format": "int32"
30297+
},
3029330298
"failedRevisionLimit": {
3029430299
"description": "failedRevisionLimit is the number of failed static pod installer revisions to keep on disk and in the api -1 = unlimited, 0 or unset = 5 (default)",
3029530300
"type": "integer",

operator/v1/tests/kubeapiservers.operator.openshift.io/AAA_ungated.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ tests:
1414
spec:
1515
logLevel: Normal
1616
operatorLogLevel: Normal
17+
eventTTLMinutes: 180
1718
onUpdate:
1819
- name: Should reject multiple nodes with nonzero target revisions
1920
initialCRDPatches:
@@ -140,6 +141,7 @@ tests:
140141
spec:
141142
logLevel: Normal
142143
operatorLogLevel: Normal
144+
eventTTLMinutes: 180
143145
status:
144146
nodeStatuses:
145147
- nodeName: a
@@ -166,6 +168,7 @@ tests:
166168
spec:
167169
logLevel: Normal
168170
operatorLogLevel: Normal
171+
eventTTLMinutes: 180
169172
status:
170173
nodeStatuses:
171174
- nodeName: a
@@ -192,6 +195,7 @@ tests:
192195
spec:
193196
logLevel: Normal
194197
operatorLogLevel: Normal
198+
eventTTLMinutes: 180
195199
status:
196200
nodeStatuses:
197201
- nodeName: a
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this
2+
name: "KubeAPIServer"
3+
crdName: kubeapiservers.operator.openshift.io
4+
tests:
5+
onCreate:
6+
- name: Should be able to create default event ttl
7+
initial: |
8+
apiVersion: operator.openshift.io/v1
9+
kind: KubeAPIServer
10+
spec: {} # No spec is required for a KubeAPIServer
11+
expected: |
12+
apiVersion: operator.openshift.io/v1
13+
kind: KubeAPIServer
14+
spec:
15+
logLevel: Normal
16+
operatorLogLevel: Normal
17+
eventTTLMinutes: 180
18+
- name: Should be able to create a normal hour event ttl
19+
initial: |
20+
apiVersion: operator.openshift.io/v1
21+
kind: KubeAPIServer
22+
spec:
23+
eventTTLMinutes: 60
24+
expected: |
25+
apiVersion: operator.openshift.io/v1
26+
kind: KubeAPIServer
27+
spec:
28+
logLevel: Normal
29+
operatorLogLevel: Normal
30+
eventTTLMinutes: 60
31+
- name: Should not be able to create with less than 30 minutes
32+
initial: |
33+
apiVersion: operator.openshift.io/v1
34+
kind: KubeAPIServer
35+
metadata:
36+
name: gg1
37+
spec:
38+
eventTTLMinutes: 29
39+
expectedError: "Invalid value: 29: spec.eventTTLMinutes in body should be greater than or equal to 30"
40+
- name: Should not be able to create more than 360 minutes
41+
initial: |
42+
apiVersion: operator.openshift.io/v1
43+
kind: KubeAPIServer
44+
metadata:
45+
name: gg1
46+
spec:
47+
eventTTLMinutes: 361
48+
expectedError: "Invalid value: 361: spec.eventTTLMinutes in body should be less than or equal to 360"

operator/v1/types_kubeapiserver.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,18 @@ type KubeAPIServer struct {
3535

3636
type KubeAPIServerSpec struct {
3737
StaticPodOperatorSpec `json:",inline"`
38+
39+
// eventTTLMinutes specifies the amount of time that the events are stored before being deleted.
40+
// This setting is allowed between 30 minutes minimum up to 6h (360 minutes).
41+
//
42+
// When omitted this means no opinion, and the platform is left to choose a reasonable default, which is subject to change over time.
43+
// The current default value is 3h (180 minutes).
44+
//
45+
// +kubebuilder:default:=180
46+
// +kubebuilder:validation:Minimum=30
47+
// +kubebuilder:validation:Maximum=360
48+
// +optional
49+
EventTTLMinutes int32 `json:"eventTTLMinutes,omitempty"`
3850
}
3951

4052
type KubeAPIServerStatus struct {

operator/v1/zz_generated.crd-manifests/0000_20_kube-apiserver_01_kubeapiservers.crd.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,18 @@ spec:
4747
description: spec is the specification of the desired behavior of the
4848
Kubernetes API Server
4949
properties:
50+
eventTTLMinutes:
51+
default: 180
52+
description: |-
53+
eventTTLMinutes specifies the amount of time that the events are stored before being deleted.
54+
This setting is allowed between 30 minutes minimum up to 6h (360 minutes).
55+
56+
When omitted this means no opinion, and the platform is left to choose a reasonable default, which is subject to change over time.
57+
The current default value is 3h (180 minutes).
58+
format: int32
59+
maximum: 360
60+
minimum: 30
61+
type: integer
5062
failedRevisionLimit:
5163
description: |-
5264
failedRevisionLimit is the number of failed static pod installer revisions to keep on disk and in the api

operator/v1/zz_generated.featuregated-crd-manifests/kubeapiservers.operator.openshift.io/AAA_ungated.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,18 @@ spec:
4848
description: spec is the specification of the desired behavior of the
4949
Kubernetes API Server
5050
properties:
51+
eventTTLMinutes:
52+
default: 180
53+
description: |-
54+
eventTTLMinutes specifies the amount of time that the events are stored before being deleted.
55+
This setting is allowed between 30 minutes minimum up to 6h (360 minutes).
56+
57+
When omitted this means no opinion, and the platform is left to choose a reasonable default, which is subject to change over time.
58+
The current default value is 3h (180 minutes).
59+
format: int32
60+
maximum: 360
61+
minimum: 30
62+
type: integer
5163
failedRevisionLimit:
5264
description: |-
5365
failedRevisionLimit is the number of failed static pod installer revisions to keep on disk and in the api

operator/v1/zz_generated.swagger_doc_generated.go

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

payload-manifests/crds/0000_20_kube-apiserver_01_kubeapiservers.crd.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,18 @@ spec:
4747
description: spec is the specification of the desired behavior of the
4848
Kubernetes API Server
4949
properties:
50+
eventTTLMinutes:
51+
default: 180
52+
description: |-
53+
eventTTLMinutes specifies the amount of time that the events are stored before being deleted.
54+
This setting is allowed between 30 minutes minimum up to 6h (360 minutes).
55+
56+
When omitted this means no opinion, and the platform is left to choose a reasonable default, which is subject to change over time.
57+
The current default value is 3h (180 minutes).
58+
format: int32
59+
maximum: 360
60+
minimum: 30
61+
type: integer
5062
failedRevisionLimit:
5163
description: |-
5264
failedRevisionLimit is the number of failed static pod installer revisions to keep on disk and in the api

0 commit comments

Comments
 (0)