@flowfuse/driver-kubernetes 2.22.1-d5adaf7-202509290744.0 → 2.22.2-212a69c-202510161205.0

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 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,11 @@ 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)
47
+ - `projectProbes` optional configuration for liveness, readiness and startup probes for project containers
48
+ - `projectProbes.livenessProbe` custom liveness probe configuration (default not set)
49
+ - `projectProbes.readinessProbe` custom readiness probe configuration (default not set)
50
+ - `projectProbes.startupProbe` custom startup probe configuration (default not set)
43
51
  - `cloudProvider` normally not set, but can be `aws` This triggers the adding of
44
52
  AWS EKS specific annotation for ALB Ingress. or `openshift` to allow running on OpenShift (Enterprise license only)
45
53
  - `privateCA` name of ConfigMap holding PEM CA Cert Bundle (file name `certs.pem`) Optional
package/kubernetes.js CHANGED
@@ -202,6 +202,27 @@ 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
+
216
+ if (this._app.config.driver.options?.projectProbes?.livenessProbe) {
217
+ localPod.spec.containers[0].livenessProbe = this._app.config.driver.options.projectProbes.livenessProbe
218
+ }
219
+ if (this._app.config.driver.options?.projectProbes?.readinessProbe) {
220
+ localPod.spec.containers[0].readinessProbe = this._app.config.driver.options.projectProbes.readinessProbe
221
+ }
222
+ if (this._app.config.driver.options?.projectProbes?.startupProbe) {
223
+ localPod.spec.containers[0].startupProbe = this._app.config.driver.options.projectProbes.startupProbe
224
+ }
225
+
205
226
  const ha = await project.getSetting('ha')
206
227
  if (ha?.replicas > 1) {
207
228
  localDeployment.spec.replicas = ha.replicas
@@ -225,6 +246,9 @@ const createService = async (project, options) => {
225
246
  throw new Error('Service type must be either NodePort or ClusterIP')
226
247
  }
227
248
  localService.spec.type = serviceType
249
+ if (this._app.config.driver.options?.projectLabels) {
250
+ localService.metadata.labels = this._app.config.driver.options.projectLabels
251
+ }
228
252
  return localService
229
253
  }
230
254
 
@@ -264,6 +288,10 @@ const createIngress = async (project, options) => {
264
288
  localIngress.metadata.annotations[key] = mustache(localIngress.metadata.annotations[key], exposedData)
265
289
  })
266
290
 
291
+ if (this._app.config.driver.options?.projectLabels) {
292
+ localIngress.metadata.labels = this._app.config.driver.options.projectLabels
293
+ }
294
+
267
295
  localIngress.metadata.name = project.safeName
268
296
  localIngress.spec.rules[0].host = url.host
269
297
  localIngress.spec.rules[0].http.paths[0].backend.service.name = `${prefix}${project.safeName}`
@@ -312,6 +340,10 @@ const createCustomIngress = async (project, hostname, options) => {
312
340
  customIngress.spec.ingressClassName = `${this._customHostname.ingressClass}`
313
341
  }
314
342
 
343
+ if (this._app.config.driver.options?.projectLabels) {
344
+ customIngress.metadata.labels = this._app.config.driver.options.projectLabels
345
+ }
346
+
315
347
  return customIngress
316
348
  }
317
349
 
@@ -337,6 +369,12 @@ const createPersistentVolumeClaim = async (project, options) => {
337
369
  'ff-project-id': project.id,
338
370
  'ff-project-name': project.safeName
339
371
  }
372
+ if (this._app.config.driver.options?.projectLabels) {
373
+ pvc.metadata.labels = {
374
+ ...pvc.metadata.labels,
375
+ ...this._app.config.driver.options.projectLabels
376
+ }
377
+ }
340
378
  console.log(`PVC: ${JSON.stringify(pvc, null, 2)}`)
341
379
  return pvc
342
380
  }
@@ -553,6 +591,16 @@ const createMQTTTopicAgent = async (broker) => {
553
591
  team: broker.Team.hashid,
554
592
  broker: agent ? 'team-broker' : broker.hashid
555
593
  }
594
+ if (this._app.config.driver.options?.projectLabels) {
595
+ localPod.metadata.labels = {
596
+ ...localPod.metadata.labels,
597
+ ...this._app.config.driver.options.projectLabels
598
+ }
599
+ localService.metadata.labels = {
600
+ ...localService.metadata.labels,
601
+ ...this._app.config.driver.options.projectLabels
602
+ }
603
+ }
556
604
  localService.spec.selector.name = `mqtt-schema-agent-${broker.Team.hashid.toLowerCase()}-${agent ? 'team-broker' : broker.hashid.toLowerCase()}`
557
605
 
558
606
  // TODO remove registry entry
@@ -739,8 +787,8 @@ module.exports = {
739
787
  },
740
788
  container: {
741
789
  label: 'Container Location',
742
- // taken from https://stackoverflow.com/a/62964157
743
- validate: '^(([a-z0-9]|[a-z0-9][a-z0-9\\-]*[a-z0-9])\\.)*([a-z0-9]|[a-z0-9][a-z0-9\\-]*[a-z0-9])(:[0-9]+\\/)?(?:[0-9a-z-]+[/@])(?:([0-9a-z-]+))[/@]?(?:([0-9a-z-]+))?(?::[a-z0-9\\.-]+)?$',
790
+ // taken from https://stackoverflow.com/a/74073589
791
+ validate: '^((?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])(?:(?:\\.(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]))+)?(?::[0-9]+)?/)?[a-z0-9]+(?:(?:(?:[._]|__|[-]*)[a-z0-9]+)+)?(?:(?:/[a-z0-9]+(?:(?:(?:[._]|__|[-]*)[a-z0-9]+)+)?)+)?)(?::([\\w][\\w.-]{0,127}))?(?:@([A-Za-z][A-Za-z0-9]*(?:[-_+.][A-Za-z][A-Za-z0-9]*)*[:][[:xdigit:]]{32,}))?$',
744
792
  invalidMessage: 'Invalid value - must be a Docker image',
745
793
  description: 'Container image location, can include a tag'
746
794
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowfuse/driver-kubernetes",
3
- "version": "2.22.1-d5adaf7-202509290744.0",
3
+ "version": "2.22.2-212a69c-202510161205.0",
4
4
  "description": "Kubernetes driver for FlowFuse",
5
5
  "main": "kubernetes.js",
6
6
  "scripts": {