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

Commit 8fe74d9

Browse files
authored
Merge pull request #92 from gianrubio/rbac-auth-plugin
Add experimental feature to enable rbac authorization plugin
2 parents a246742 + 935babb commit 8fe74d9

File tree

3 files changed

+42
-1
lines changed

3 files changed

+42
-1
lines changed

config/config.go

+26
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ const (
3131

3232
func NewDefaultCluster() *Cluster {
3333
experimental := Experimental{
34+
AuditLog{
35+
Enabled: false,
36+
MaxAge: 30,
37+
LogPath: "/dev/stdout",
38+
},
3439
AwsEnvironment{
3540
Enabled: false,
3641
},
@@ -48,6 +53,11 @@ func NewDefaultCluster() *Cluster {
4853
NodeLabel{
4954
Enabled: false,
5055
},
56+
Plugins{
57+
Rbac{
58+
Enabled: false,
59+
},
60+
},
5161
WaitSignal{
5262
Enabled: false,
5363
MaxBatchSize: 1,
@@ -273,11 +283,13 @@ type Subnet struct {
273283
}
274284

275285
type Experimental struct {
286+
AuditLog AuditLog `yaml:"auditLog"`
276287
AwsEnvironment AwsEnvironment `yaml:"awsEnvironment"`
277288
EphemeralImageStorage EphemeralImageStorage `yaml:"ephemeralImageStorage"`
278289
LoadBalancer LoadBalancer `yaml:"loadBalancer"`
279290
NodeDrainer NodeDrainer `yaml:"nodeDrainer"`
280291
NodeLabel NodeLabel `yaml:"nodeLabel"`
292+
Plugins Plugins `yaml:"plugins"`
281293
WaitSignal WaitSignal `yaml:"waitSignal"`
282294
}
283295

@@ -286,6 +298,12 @@ type AwsEnvironment struct {
286298
Environment map[string]string `yaml:"environment"`
287299
}
288300

301+
type AuditLog struct {
302+
Enabled bool `yaml:"enabled"`
303+
MaxAge int `yaml:"maxage"`
304+
LogPath string `yaml:"logpath"`
305+
}
306+
289307
type EphemeralImageStorage struct {
290308
Enabled bool `yaml:"enabled"`
291309
Disk string `yaml:"disk"`
@@ -306,6 +324,14 @@ type LoadBalancer struct {
306324
SecurityGroupIds []string `yaml:"securityGroupIds"`
307325
}
308326

327+
type Plugins struct {
328+
Rbac Rbac `yaml:"rbac"`
329+
}
330+
331+
type Rbac struct {
332+
Enabled bool `yaml:"enabled"`
333+
}
334+
309335
type WaitSignal struct {
310336
Enabled bool `yaml:"enabled"`
311337
MaxBatchSize int `yaml:"maxBatchSize"`

config/templates/cloud-config-controller

+9-1
Original file line numberDiff line numberDiff line change
@@ -490,13 +490,21 @@ write_files:
490490
- --allow-privileged=true
491491
- --service-cluster-ip-range={{.ServiceCIDR}}
492492
- --secure-port=443
493+
{{if .Experimental.AuditLog.Enabled}}
494+
- --audit-log-maxage={{.Experimental.AuditLog.MaxAge}}
495+
- --audit-log-path={{.Experimental.AuditLog.LogPath}}
496+
{{ end }}
497+
{{if .Experimental.Plugins.Rbac.Enabled}}
498+
- --authorization-mode=RBAC
499+
- --authorization-rbac-super-user=kube-admin
500+
{{ end }}
493501
- --advertise-address=$private_ipv4
494502
- --admission-control=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,ResourceQuota
495503
- --tls-cert-file=/etc/kubernetes/ssl/apiserver.pem
496504
- --tls-private-key-file=/etc/kubernetes/ssl/apiserver-key.pem
497505
- --client-ca-file=/etc/kubernetes/ssl/ca.pem
498506
- --service-account-key-file=/etc/kubernetes/ssl/apiserver-key.pem
499-
- --runtime-config=extensions/v1beta1/networkpolicies=true,batch/v2alpha1
507+
- --runtime-config=extensions/v1beta1/networkpolicies=true,batch/v2alpha1{{if .Experimental.Plugins.Rbac.Enabled}},rbac.authorization.k8s.io/v1alpha1=true{{ end }}
500508
- --cloud-provider=aws
501509
livenessProbe:
502510
httpGet:

config/templates/cluster.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,13 @@ kmsKeyArn: "{{.KMSKeyARN}}"
187187
# enabled: true
188188
# environment:
189189
# CFNSTACK: '{ "Ref" : "AWS::StackId" }'
190+
# plugins:
191+
# rbac:
192+
# enabled: true
193+
# auditLog:
194+
# enabled: true
195+
# maxage: 30
196+
# logpath: /dev/stdout
190197
# waitSignal:
191198
# enabled: true
192199
# # This option has not yet been tested with rkt as container runtime

0 commit comments

Comments
 (0)