@flowfuse/driver-kubernetes 2.22.1-d5adaf7-202509290744.0 → 2.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/README.md +4 -0
- package/kubernetes.js +38 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
#### 2.22.1: Release
|
|
2
|
+
|
|
3
|
+
- Bump JS-DevTools/npm-publish from 4.0.1 to 4.1.1 (#240)
|
|
4
|
+
- feat: add possibility to apply custom labels on project-related resources (#241) @ppawlowski
|
|
5
|
+
|
|
1
6
|
#### 2.22.0: Release
|
|
2
7
|
|
|
3
8
|
- Bump JS-DevTools/npm-publish from 4.0.0 to 4.0.1 (#236)
|
package/README.md
CHANGED
|
@@ -15,6 +15,9 @@ driver:
|
|
|
15
15
|
projectSelector:
|
|
16
16
|
role: projects
|
|
17
17
|
projectNamespace: flowforge
|
|
18
|
+
projectLabels:
|
|
19
|
+
environment: production
|
|
20
|
+
team: alpha
|
|
18
21
|
cloudProvider: aws
|
|
19
22
|
privateCA: ff-ca-certs
|
|
20
23
|
certManagerIssuer: lets-encrypt
|
|
@@ -40,6 +43,7 @@ driver:
|
|
|
40
43
|
- `projectNamespace` the namespace Project pods should run in
|
|
41
44
|
- `projectSelector` a list of labels that should be used to select which nodes Project Pods
|
|
42
45
|
should run on
|
|
46
|
+
- `projectLabels` a list of custom labels that should be applied to all resources created for Projects (Pods, Services, Ingresses, PVCs)
|
|
43
47
|
- `cloudProvider` normally not set, but can be `aws` This triggers the adding of
|
|
44
48
|
AWS EKS specific annotation for ALB Ingress. or `openshift` to allow running on OpenShift (Enterprise license only)
|
|
45
49
|
- `privateCA` name of ConfigMap holding PEM CA Cert Bundle (file name `certs.pem`) Optional
|
package/kubernetes.js
CHANGED
|
@@ -202,6 +202,17 @@ const createDeployment = async (project, options) => {
|
|
|
202
202
|
localPod.spec.containers[0].resources.limits.cpu = `${stack.cpu * 10}m`
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
+
if (this._app.config.driver.options?.projectLabels) {
|
|
206
|
+
localPod.metadata.labels = {
|
|
207
|
+
...localPod.metadata.labels,
|
|
208
|
+
...this._app.config.driver.options.projectLabels
|
|
209
|
+
}
|
|
210
|
+
localDeployment.metadata.labels = {
|
|
211
|
+
...localDeployment.metadata.labels,
|
|
212
|
+
...this._app.config.driver.options.projectLabels
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
205
216
|
const ha = await project.getSetting('ha')
|
|
206
217
|
if (ha?.replicas > 1) {
|
|
207
218
|
localDeployment.spec.replicas = ha.replicas
|
|
@@ -225,6 +236,9 @@ const createService = async (project, options) => {
|
|
|
225
236
|
throw new Error('Service type must be either NodePort or ClusterIP')
|
|
226
237
|
}
|
|
227
238
|
localService.spec.type = serviceType
|
|
239
|
+
if (this._app.config.driver.options?.projectLabels) {
|
|
240
|
+
localService.metadata.labels = this._app.config.driver.options.projectLabels
|
|
241
|
+
}
|
|
228
242
|
return localService
|
|
229
243
|
}
|
|
230
244
|
|
|
@@ -264,6 +278,10 @@ const createIngress = async (project, options) => {
|
|
|
264
278
|
localIngress.metadata.annotations[key] = mustache(localIngress.metadata.annotations[key], exposedData)
|
|
265
279
|
})
|
|
266
280
|
|
|
281
|
+
if (this._app.config.driver.options?.projectLabels) {
|
|
282
|
+
localIngress.metadata.labels = this._app.config.driver.options.projectLabels
|
|
283
|
+
}
|
|
284
|
+
|
|
267
285
|
localIngress.metadata.name = project.safeName
|
|
268
286
|
localIngress.spec.rules[0].host = url.host
|
|
269
287
|
localIngress.spec.rules[0].http.paths[0].backend.service.name = `${prefix}${project.safeName}`
|
|
@@ -312,6 +330,10 @@ const createCustomIngress = async (project, hostname, options) => {
|
|
|
312
330
|
customIngress.spec.ingressClassName = `${this._customHostname.ingressClass}`
|
|
313
331
|
}
|
|
314
332
|
|
|
333
|
+
if (this._app.config.driver.options?.projectLabels) {
|
|
334
|
+
customIngress.metadata.labels = this._app.config.driver.options.projectLabels
|
|
335
|
+
}
|
|
336
|
+
|
|
315
337
|
return customIngress
|
|
316
338
|
}
|
|
317
339
|
|
|
@@ -337,6 +359,12 @@ const createPersistentVolumeClaim = async (project, options) => {
|
|
|
337
359
|
'ff-project-id': project.id,
|
|
338
360
|
'ff-project-name': project.safeName
|
|
339
361
|
}
|
|
362
|
+
if (this._app.config.driver.options?.projectLabels) {
|
|
363
|
+
pvc.metadata.labels = {
|
|
364
|
+
...pvc.metadata.labels,
|
|
365
|
+
...this._app.config.driver.options.projectLabels
|
|
366
|
+
}
|
|
367
|
+
}
|
|
340
368
|
console.log(`PVC: ${JSON.stringify(pvc, null, 2)}`)
|
|
341
369
|
return pvc
|
|
342
370
|
}
|
|
@@ -553,6 +581,16 @@ const createMQTTTopicAgent = async (broker) => {
|
|
|
553
581
|
team: broker.Team.hashid,
|
|
554
582
|
broker: agent ? 'team-broker' : broker.hashid
|
|
555
583
|
}
|
|
584
|
+
if (this._app.config.driver.options?.projectLabels) {
|
|
585
|
+
localPod.metadata.labels = {
|
|
586
|
+
...localPod.metadata.labels,
|
|
587
|
+
...this._app.config.driver.options.projectLabels
|
|
588
|
+
}
|
|
589
|
+
localService.metadata.labels = {
|
|
590
|
+
...localService.metadata.labels,
|
|
591
|
+
...this._app.config.driver.options.projectLabels
|
|
592
|
+
}
|
|
593
|
+
}
|
|
556
594
|
localService.spec.selector.name = `mqtt-schema-agent-${broker.Team.hashid.toLowerCase()}-${agent ? 'team-broker' : broker.hashid.toLowerCase()}`
|
|
557
595
|
|
|
558
596
|
// TODO remove registry entry
|