Skip to content

Commit fe48e8f

Browse files
Merge pull request #2520 from tjungblu/CNTRLPLANE-1576
CNTRLPLANE-1576: add event-ttl configuration to kube-apiserver
2 parents 1f788b8 + 956fa8a commit fe48e8f

16 files changed

+2542
-2
lines changed

openapi/generated_openapi/zz_generated.openapi.go

Lines changed: 12 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: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30910,6 +30910,11 @@
3091030910
"forceRedeploymentReason"
3091130911
],
3091230912
"properties": {
30913+
"eventTTLMinutes": {
30914+
"description": "eventTTLMinutes specifies the amount of time that the events are stored before being deleted. The TTL is allowed between 5 minutes minimum up to a maximum of 180 minutes (3 hours).\n\nLowering this value will reduce the storage required in etcd. Note that this setting will only apply to new events being created and will not update existing events.\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).",
30915+
"type": "integer",
30916+
"format": "int32"
30917+
},
3091330918
"failedRevisionLimit": {
3091430919
"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)",
3091530920
"type": "integer",
@@ -31016,7 +31021,8 @@
3101631021
"items": {
3101731022
"default": {},
3101831023
"$ref": "#/definitions/com.github.openshift.api.operator.v1.ServiceAccountIssuerStatus"
31019-
}
31024+
},
31025+
"x-kubernetes-list-type": "atomic"
3102031026
},
3102131027
"version": {
3102231028
"description": "version is the level this availability applies to",
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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+
featureGates:
5+
- EventTTL
6+
tests:
7+
onCreate:
8+
- name: Should be able to create default omitted event ttl
9+
initial: |
10+
apiVersion: operator.openshift.io/v1
11+
kind: KubeAPIServer
12+
spec: {} # No spec is required for a KubeAPIServer
13+
expected: |
14+
apiVersion: operator.openshift.io/v1
15+
kind: KubeAPIServer
16+
spec:
17+
logLevel: Normal
18+
operatorLogLevel: Normal
19+
- name: Should be able to create a normal hour event ttl
20+
initial: |
21+
apiVersion: operator.openshift.io/v1
22+
kind: KubeAPIServer
23+
spec:
24+
eventTTLMinutes: 60
25+
expected: |
26+
apiVersion: operator.openshift.io/v1
27+
kind: KubeAPIServer
28+
spec:
29+
logLevel: Normal
30+
operatorLogLevel: Normal
31+
eventTTLMinutes: 60
32+
- name: Should not be able to create with less than 5 minutes
33+
initial: |
34+
apiVersion: operator.openshift.io/v1
35+
kind: KubeAPIServer
36+
metadata:
37+
name: gg1
38+
spec:
39+
eventTTLMinutes: 4
40+
expectedError: "Invalid value: 4: spec.eventTTLMinutes in body should be greater than or equal to 5"
41+
- name: Should not be able to create more than 360 minutes
42+
initial: |
43+
apiVersion: operator.openshift.io/v1
44+
kind: KubeAPIServer
45+
metadata:
46+
name: gg1
47+
spec:
48+
eventTTLMinutes: 181
49+
expectedError: "Invalid value: 181: spec.eventTTLMinutes in body should be less than or equal to 180"

operator/v1/types_kubeapiserver.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,21 @@ 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+
// The TTL is allowed between 5 minutes minimum up to a maximum of 180 minutes (3 hours).
41+
//
42+
// Lowering this value will reduce the storage required in etcd. Note that this setting will only apply
43+
// to new events being created and will not update existing events.
44+
//
45+
// When omitted this means no opinion, and the platform is left to choose a reasonable default, which is subject to change over time.
46+
// The current default value is 3h (180 minutes).
47+
//
48+
// +openshift:enable:FeatureGate=EventTTL
49+
// +kubebuilder:validation:Minimum=5
50+
// +kubebuilder:validation:Maximum=180
51+
// +optional
52+
EventTTLMinutes int32 `json:"eventTTLMinutes,omitempty"`
3853
}
3954

4055
type KubeAPIServerStatus struct {
@@ -46,6 +61,7 @@ type KubeAPIServerStatus struct {
4661
// The default expiration for the items is set by the platform and it defaults to 24h.
4762
// see: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#service-account-token-volume-projection
4863
// +optional
64+
// +listType=atomic
4965
ServiceAccountIssuers []ServiceAccountIssuerStatus `json:"serviceAccountIssuers,omitempty"`
5066
}
5167

0 commit comments

Comments
 (0)