@@ -142,6 +142,69 @@ defined in the spec and so will be deleted shortly after the jobs have run.
142
142
143
143
# Advanced topics
144
144
145
+ ## Custom Annotations, Environment Variables and Labels
146
+
147
+ There are times when it is desirable for custom annotations, environment
148
+ variables and labels should be added to an installation.
149
+
150
+ ### Installer Config
151
+
152
+ This can be added to the root of the ` gitpod.config.yaml ` . If nothing is passed in,
153
+ no custom parameters are added in.
154
+
155
+ Annotations are structured in the format ` components.annotations.<kind>.<name> ` . The
156
+ ` kind ` is the given Kubernetes "Kind", all converted to lowercase (eg, ` service ` ,
157
+ ` daemonset ` ). The ` name ` is the given name of the Kubernetes resource (eg, ` ws-daemon ` ,
158
+ ` server ` ).
159
+
160
+ Environment variables are only injected into resources that support environment variables
161
+ (ie, pods).
162
+
163
+ In both cases, these may override the annotations/envvars set by the system so these
164
+ should be used with caution.
165
+
166
+ ``` yaml
167
+ components :
168
+ annotations :
169
+ ' * ' :
170
+ ' * ' :
171
+ key1 : value1 # annotation added to all components
172
+ service :
173
+ ' * ' :
174
+ key2 : value2 # annotation added to all service components
175
+ ' * ' :
176
+ server :
177
+ key3 : value3 # annotation added to all components called "server"
178
+ service :
179
+ proxy :
180
+ key4 : value4 # annotation added to proxy service
181
+ envvars :
182
+ ' * ' :
183
+ env1 : value1 # envvar added to all pods
184
+ ws-daemon :
185
+ env2 : value2 # envvar added to the "ws-daemon" pods
186
+ labels : {} # Definition as-per "annotations"
187
+ ` ` `
188
+
189
+ In the event of a conflict, they will be overridden in order of precedence from least
190
+ to most specific - eg, ` service.ws-manager.key` would override `*.ws-manager.key`,
191
+ and that would override `*.*.key`.
192
+
193
+ This will also allow for overriding of keys that we set. Whilst this may seem strange,
194
+ it's plausible that a customer may wish to remove an annotation that we set - it's
195
+ unlikely, but a Gitpod-specified annotation may conflict for a customer's implementation.
196
+
197
+ If an empty value is given (eg, `key : " " ` ), this will delete any key set from what's passed
198
+ into the ` annotations/envvars/labels`.
199
+
200
+ In the event that a Kubernetes resource has multiple annotations (eg, a `Deployment` has
201
+ it on the `Deployment` spec and the `Pod` spec), the same annotation will be applied
202
+ for both and can be overridden with the parent kind (in this example, `deployment`). Only
203
+ Gitpod-generated annotations (eg, `gitpod.io/checksum_config`) will be applied to the
204
+ spec that they're required on.
205
+
206
+ Labels will be identical to `annotations`, but with the key `labels`
207
+
145
208
# # Post-processing the YAML
146
209
147
210
> Here be dragons.
0 commit comments