-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmutate-semaphore-xds-clients-env.yaml
115 lines (115 loc) · 4.39 KB
/
mutate-semaphore-xds-clients-env.yaml
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: mutate-semaphore-xds-bootstrap-config
annotations:
policies.kyverno.io/title: Mutate Sempaphore-xDS Bootstrap Config
policies.kyverno.io/category: xDS
policies.kyverno.io/subject: Pod
policies.kyverno.io/description: >-
This policy ensures that pods labelled as clients of semaphore-xDS server
will have the needed xDS bootstrap configuration available as an
environment variable.
spec:
background: false
mutateExistingOnPolicyUpdate: false
rules:
- name: xds-clients-inject-env
match:
resources:
kinds:
- Pod
operations:
- CREATE
selector:
matchLabels:
xds.semaphore.uw.systems/client: "true"
mutate:
patchStrategicMerge:
spec:
initContainers:
- (name): "*"
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: GRPC_XDS_BOOTSTRAP_CONFIG
value: >-
{
"xds_servers": [{
"server_uri": "semaphore-xds.sys-semaphore.svc.cluster.local:18000",
"channel_creds": [{"type": "insecure"}],
"server_features": ["xds_v3"]}
],
"node":{
"id":"{{request.object.metadata.namespace}}/\$(POD_NAME)",
"locality":{}
},
"authorities": {
"aws": {
"xds_servers": [{
"server_uri": "semaphore-xds.sys-semaphore.svc.cluster.aws:18000",
"channel_creds": [{"type": "insecure"}],
"server_features": ["xds_v3"]}
]
},
"gcp": {
"xds_servers": [{
"server_uri": "semaphore-xds.sys-semaphore.svc.cluster.gcp:18000",
"channel_creds": [{"type": "insecure"}],
"server_features": ["xds_v3"]}
]
},
"merit": {
"xds_servers": [{
"server_uri": "semaphore-xds.sys-semaphore.svc.cluster.merit:18000",
"channel_creds": [{"type": "insecure"}],
"server_features": ["xds_v3"]}
]
}
}
}
containers:
- (name): "*"
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: GRPC_XDS_BOOTSTRAP_CONFIG
value: >-
{
"xds_servers": [{
"server_uri": "semaphore-xds.sys-semaphore.svc.cluster.local:18000",
"channel_creds": [{"type": "insecure"}],
"server_features": ["xds_v3"]}
],
"node":{
"id":"{{request.object.metadata.namespace}}/\$(POD_NAME)",
"locality":{}
},
"authorities": {
"aws": {
"xds_servers": [{
"server_uri": "semaphore-xds.sys-semaphore.svc.cluster.aws:18000",
"channel_creds": [{"type": "insecure"}],
"server_features": ["xds_v3"]}
]
},
"gcp": {
"xds_servers": [{
"server_uri": "semaphore-xds.sys-semaphore.svc.cluster.gcp:18000",
"channel_creds": [{"type": "insecure"}],
"server_features": ["xds_v3"]}
]
},
"merit": {
"xds_servers": [{
"server_uri": "semaphore-xds.sys-semaphore.svc.cluster.merit:18000",
"channel_creds": [{"type": "insecure"}],
"server_features": ["xds_v3"]}
]
}
}
}