Skip to content
This repository has been archived by the owner on Sep 30, 2020. It is now read-only.

Make the EventRateLimit alpha admission controller experimental and e… #1630

Merged
merged 1 commit into from
Jun 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions builtin/files/cluster.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -1385,6 +1385,21 @@ experimental:
enabled: false
OwnerReferencesPermissionEnforcement:
enabled: false
# eventRateLimit Note
# We recommend that you leave this admission controller on/enabled by default as it protects your cluster
# apiserver from becomming overloaded with events from failing deployments etc. Tweak the limits to your needs.
# The limits field is a 'string' representation of the yaml limits section defined here:-
# https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/#eventratelimit
eventRateLimit:
enabled: true
limits: |
- type: Namespace
qps: 250
burst: 500
cacheSize: 4096
- type: User
qps: 50
burst: 250

# Used to provide `/etc/environment` env vars with values from arbitrary CloudFormation refs
awsEnvironment:
Expand Down
16 changes: 7 additions & 9 deletions builtin/files/userdata/cloud-config-controller
Original file line number Diff line number Diff line change
Expand Up @@ -3348,8 +3348,10 @@ write_files:
{{- else }}
- --apiserver-count={{if .MinControllerCount}}{{ .MinControllerCount }}{{else}}{{ .Controller.Count }}{{end}}
{{- end }}
- --enable-admission-plugins=EventRateLimit,ExtendedResourceToleration,NodeRestriction,PodSecurityPolicy{{if .Experimental.Admission.AlwaysPullImages.Enabled}},AlwaysPullImages{{ end }}{{if .Experimental.Admission.Initializers.Enabled}},Initializers{{end}}
- --enable-admission-plugins=ExtendedResourceToleration,NodeRestriction,PodSecurityPolicy{{if .Experimental.Admission.AlwaysPullImages.Enabled}},AlwaysPullImages{{ end }}{{if .Experimental.Admission.Initializers.Enabled}},Initializers{{end}}{{ if .Experimental.Admission.EventRateLimit.Enabled }},EventRateLimit{{end}}
{{ if .Experimental.Admission.EventRateLimit.Enabled -}}
- --admission-control-config-file=/etc/kubernetes/auth/admission-control-config.yaml
{{ end -}}
- --bind-address=0.0.0.0
- --etcd-servers=#ETCD_ENDPOINTS#
- --etcd-cafile=/etc/kubernetes/ssl/etcd-trusted-ca.pem
Expand Down Expand Up @@ -3494,6 +3496,7 @@ write_files:
name: {{quote $v.Name}}
{{end}}

{{ if .Experimental.Admission.EventRateLimit.Enabled -}}
- path: /etc/kubernetes/auth/admission-control-config.yaml
content: |
kind: AdmissionConfiguration
Expand All @@ -3507,14 +3510,9 @@ write_files:
kind: Configuration
apiVersion: eventratelimit.admission.k8s.io/v1alpha1
limits:
- type: Namespace
qps: 250
burst: 500
cacheSize: 4096
- type: User
qps: 50
burst: 250

{{ .Experimental.Admission.EventRateLimit.Limits | indent 6 }}
{{- end }}

- path: /etc/kubernetes/manifests/kube-controller-manager.yaml
content: |
apiVersion: v1
Expand Down
10 changes: 10 additions & 0 deletions pkg/api/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ func NewDefaultCluster() *Cluster {
OwnerReferencesPermissionEnforcement{
Enabled: false,
},
EventRateLimit{
Enabled: true,
Limits: `- type: Namespace
qps: 250
burst: 500
cacheSize: 4096
- type: User
qps: 50
burst: 250`,
},
},
AuditLog: AuditLog{
Enabled: false,
Expand Down
6 changes: 6 additions & 0 deletions pkg/api/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ type Admission struct {
AlwaysPullImages AlwaysPullImages `yaml:"alwaysPullImages"`
Initializers Initializers `yaml:"initializers"`
OwnerReferencesPermissionEnforcement OwnerReferencesPermissionEnforcement `yaml:"ownerReferencesPermissionEnforcement"`
EventRateLimit EventRateLimit `yaml:"eventRateLimit"`
}

type AlwaysPullImages struct {
Expand All @@ -72,6 +73,11 @@ type PersistentVolumeClaimResize struct {
Enabled bool `yaml:"enabled"`
}

type EventRateLimit struct {
Enabled bool `yaml:"enabled"`
Limits string `yaml:"limits"`
}

type AuditLog struct {
Enabled bool `yaml:"enabled"`
LogPath string `yaml:"logPath"`
Expand Down
20 changes: 20 additions & 0 deletions test/integration/maincluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,16 @@ func TestMainClusterConfig(t *testing.T) {
AlwaysPullImages: api.AlwaysPullImages{
Enabled: false,
},
EventRateLimit: api.EventRateLimit{
Enabled: true,
Limits: `- type: Namespace
qps: 250
burst: 500
cacheSize: 4096
- type: User
qps: 50
burst: 250`,
},
},
AuditLog: api.AuditLog{
Enabled: false,
Expand Down Expand Up @@ -1300,6 +1310,16 @@ worker:
AlwaysPullImages: api.AlwaysPullImages{
Enabled: true,
},
EventRateLimit: api.EventRateLimit{
Enabled: true,
Limits: `- type: Namespace
qps: 250
burst: 500
cacheSize: 4096
- type: User
qps: 50
burst: 250`,
},
},
AuditLog: api.AuditLog{
Enabled: true,
Expand Down