@flowfuse/driver-kubernetes 2.28.1-e0816fb-202603180927.0 → 2.28.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.
@@ -17,7 +17,7 @@ jobs:
17
17
  uses: 'flowfuse/github-actions-workflows/.github/workflows/build_node_package.yml@v0.52.0'
18
18
  with:
19
19
  node: '[
20
- {"version": "18", "tests": false, "lint": true},
20
+ {"version": "24", "tests": false, "lint": true},
21
21
  ]'
22
22
 
23
23
  publish:
@@ -36,10 +36,12 @@ jobs:
36
36
  steps:
37
37
  - name: Generate a token
38
38
  id: generate_token
39
- uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
39
+ uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0
40
40
  with:
41
41
  app-id: ${{ secrets.GH_BOT_APP_ID }}
42
42
  private-key: ${{ secrets.GH_BOT_APP_KEY }}
43
+ owner: ${{ github.repository_owner }}
44
+ repositories: helm
43
45
  - name: Trigger flowfuse container build
44
46
  uses: benc-uk/workflow-dispatch@7a027648b88c2413826b6ddd6c76114894dc5ec4 # v1.3.1
45
47
  with:
@@ -11,7 +11,7 @@ jobs:
11
11
  - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
12
12
  - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
13
13
  with:
14
- node-version: 18
14
+ node-version: 24
15
15
  - run: npm ci
16
16
  - uses: JS-DevTools/npm-publish@0fd2f4369c5d6bcfcde6091a7c527d810b9b5c3f # v4.1.5
17
17
  with:
package/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ #### 2.28.1: Release
2
+
3
+ - Bump actions/create-github-app-token from 2.2.1 to 3.0.0 (#321)
4
+ - ci: Use NodeJS v24 to build package (#334) @ppawlowski
5
+ - ci: Use NodeJS v24 as a default GitHub Actions runtime (#333) @ppawlowski
6
+ - Bump flatted from 3.3.3 to 3.4.2 (#330) @app/dependabot
7
+ - Fix order of delay and times in wrap function (#329) @hardillb
8
+ - fix: `createNamespacedPersistentVolumeClaim` method name (#328) @ppawlowski
9
+ - Wrapped standard K8s APIs with retry logix (#325) @hardillb
10
+ - ci: Fix repository parameter for token (#327) @ppawlowski
11
+ - ci: fix token permissions scope (#326) @ppawlowski
12
+ - fix: Attempt to remove a custom ingress only if it is configured (#323) @ppawlowski
13
+ - ci: replace `tibdex/github-app-token` with `actions/create-github-app-token` (#320) @ppawlowski
14
+ - ci: add concurrency to publish workflow (#319) @ppawlowski
15
+
1
16
  #### 2.28.0: Release
2
17
 
3
18
  - Bump actions/setup-node from 6.2.0 to 6.3.0 (#314)
package/kubernetes.js CHANGED
@@ -732,6 +732,25 @@ const waitForInstanceRunning = async (endpoint) => {
732
732
  })
733
733
  }
734
734
 
735
+ // functions to wrap k8s api functions in retry logic
736
+ const retry = (driver, api, func, args, delay, times) => {
737
+ return func.apply(api, args).catch(err => {
738
+ driver._app.log.error(`[k8s] API call to ${func.name} failed. attempt=${driver._k8sRetries - times + 1}/${driver._k8sRetries + 1} statusCode=${err.response?.statusCode || 'N/A'} ${err.toString()}`)
739
+ if (times > 0 && err.response && err.response.statusCode === 429) {
740
+ return new Promise(resolve => {
741
+ setTimeout(() => { resolve(retry(driver, api, func, args, delay * 2, times - 1)) }, delay)
742
+ })
743
+ }
744
+ return Promise.reject(err)
745
+ })
746
+ }
747
+ const wrapClient = (api, funcs, driver) => {
748
+ for (const f of funcs) {
749
+ const originalFunc = api[f.name]
750
+ api[f.name] = function () { return retry(driver, api, originalFunc, arguments, driver._k8sDelay, driver._k8sRetries) }
751
+ }
752
+ }
753
+
735
754
  module.exports = {
736
755
  /**
737
756
  * Initialises this driver
@@ -780,6 +799,25 @@ module.exports = {
780
799
  this._k8sAppApi = kc.makeApiClient(k8s.AppsV1Api)
781
800
  this._k8sNetApi = kc.makeApiClient(k8s.NetworkingV1Api)
782
801
 
802
+ // add retry logic to these functions
803
+ wrapClient(this._k8sApi, [
804
+ this._k8sApi.createNamespacedPersistentVolumeClaim,
805
+ this._k8sApi.createNamespacedService,
806
+ this._k8sApi.createNamespacedPod,
807
+ this._k8sApi.deleteNamespacedPod,
808
+ this._k8sApi.deleteNamespacedSecret,
809
+ this._k8sApi.deleteNamespacedService,
810
+ this._k8sApi.deleteNamespacedPersistentVolumeClaim
811
+ ], this)
812
+ wrapClient(this._k8sAppApi, [
813
+ this._k8sAppApi.createNamespacedDeployment,
814
+ this._k8sAppApi.deleteNamespacedDeployment
815
+ ], this)
816
+ wrapClient(this._k8sNetApi, [
817
+ this._k8sNetApi.createNamespacedIngress,
818
+ this._k8sNetApi.deleteNamespacedIngress
819
+ ], this)
820
+
783
821
  // Get a list of all projects - with the absolute minimum of fields returned
784
822
  const projects = await app.db.models.Project.findAll({
785
823
  attributes: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowfuse/driver-kubernetes",
3
- "version": "2.28.1-e0816fb-202603180927.0",
3
+ "version": "2.28.1",
4
4
  "description": "Kubernetes driver for FlowFuse",
5
5
  "main": "kubernetes.js",
6
6
  "scripts": {