-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathutils.py
More file actions
41 lines (37 loc) · 1.07 KB
/
utils.py
File metadata and controls
41 lines (37 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import json
import pulumi
def generate_kube_config(eks_cluster):
kubeconfig = pulumi.Output.json_dumps({
"apiVersion": "v1",
"clusters": [{
"cluster": {
"server": eks_cluster.endpoint,
"certificate-authority-data": eks_cluster.certificate_authority.apply(lambda v: v.data)
},
"name": "kubernetes",
}],
"contexts": [{
"context": {
"cluster": "kubernetes",
"user": "aws",
},
"name": "aws",
}],
"current-context": "aws",
"kind": "Config",
"users": [{
"name": "aws",
"user": {
"exec": {
"apiVersion": "client.authentication.k8s.io/v1beta1",
"command": "aws-iam-authenticator",
"args": [
"token",
"-i",
eks_cluster.endpoint,
],
},
},
}],
})
return kubeconfig