@flowfuse/driver-kubernetes 2.7.1-b27506f-202408071804.0 → 2.8.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 +7 -0
- package/kubernetes.js +64 -0
- package/lib/aws-efs.js +3 -2
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
#### 2.8.0: Release
|
|
2
|
+
|
|
3
|
+
- Remove extra console.log (#177) @hardillb
|
|
4
|
+
- First pass at file api for k8s (#175) @hardillb
|
|
5
|
+
- Ensure full count of EFS AccessPoints (#176) @hardillb
|
|
6
|
+
- Bump fast-xml-parser and @aws-sdk/client-efs (#174) @dependabot
|
|
7
|
+
|
|
1
8
|
#### 2.7.0: Release
|
|
2
9
|
|
|
3
10
|
- Bump tibdex/github-app-token from 1 to 2 (#155) @app/dependabot
|
package/kubernetes.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const got = require('got')
|
|
2
|
+
const FormData = require('form-data')
|
|
2
3
|
const k8s = require('@kubernetes/client-node')
|
|
3
4
|
const _ = require('lodash')
|
|
4
5
|
const awsEFS = require('./lib/aws-efs.js')
|
|
@@ -498,6 +499,11 @@ const getEndpoints = async (project) => {
|
|
|
498
499
|
}
|
|
499
500
|
}
|
|
500
501
|
|
|
502
|
+
const getStaticFileUrl = async (instance, filePath) => {
|
|
503
|
+
const prefix = instance.safeName.match(/^[0-9]/) ? 'srv-' : ''
|
|
504
|
+
return `http://${prefix}${instance.safeName}.${this._namespace}:2880/flowforge/files/_/${encodeURIComponent(filePath)}`
|
|
505
|
+
}
|
|
506
|
+
|
|
501
507
|
module.exports = {
|
|
502
508
|
/**
|
|
503
509
|
* Initialises this driver
|
|
@@ -1117,5 +1123,63 @@ module.exports = {
|
|
|
1117
1123
|
}
|
|
1118
1124
|
|
|
1119
1125
|
return properties
|
|
1126
|
+
},
|
|
1127
|
+
|
|
1128
|
+
// Static Assets API
|
|
1129
|
+
listFiles: async (instance, filePath) => {
|
|
1130
|
+
const fileUrl = await getStaticFileUrl(instance, filePath)
|
|
1131
|
+
try {
|
|
1132
|
+
return got.get(fileUrl).json()
|
|
1133
|
+
} catch (err) {
|
|
1134
|
+
console.log(err)
|
|
1135
|
+
err.statusCode = err.response.statusCode
|
|
1136
|
+
throw err
|
|
1137
|
+
}
|
|
1138
|
+
},
|
|
1139
|
+
|
|
1140
|
+
updateFile: async (instance, filePath, update) => {
|
|
1141
|
+
const fileUrl = await getStaticFileUrl(instance, filePath)
|
|
1142
|
+
try {
|
|
1143
|
+
return got.put(fileUrl, {
|
|
1144
|
+
json: update
|
|
1145
|
+
})
|
|
1146
|
+
} catch (err) {
|
|
1147
|
+
err.statusCode = err.response.statusCode
|
|
1148
|
+
throw err
|
|
1149
|
+
}
|
|
1150
|
+
},
|
|
1151
|
+
|
|
1152
|
+
deleteFile: async (instance, filePath) => {
|
|
1153
|
+
const fileUrl = await getStaticFileUrl(instance, filePath)
|
|
1154
|
+
try {
|
|
1155
|
+
return got.delete(fileUrl)
|
|
1156
|
+
} catch (err) {
|
|
1157
|
+
err.statusCode = err.response.statusCode
|
|
1158
|
+
throw err
|
|
1159
|
+
}
|
|
1160
|
+
},
|
|
1161
|
+
createDirectory: async (instance, filePath, directoryName) => {
|
|
1162
|
+
const fileUrl = await getStaticFileUrl(instance, filePath)
|
|
1163
|
+
try {
|
|
1164
|
+
return got.post(fileUrl, {
|
|
1165
|
+
json: { path: directoryName }
|
|
1166
|
+
})
|
|
1167
|
+
} catch (err) {
|
|
1168
|
+
err.statusCode = err.response.statusCode
|
|
1169
|
+
throw err
|
|
1170
|
+
}
|
|
1171
|
+
},
|
|
1172
|
+
uploadFile: async (instance, filePath, fileBuffer) => {
|
|
1173
|
+
const form = new FormData()
|
|
1174
|
+
form.append('file', fileBuffer, { filename: filePath })
|
|
1175
|
+
const fileUrl = await getStaticFileUrl(instance, filePath)
|
|
1176
|
+
try {
|
|
1177
|
+
return got.post(fileUrl, {
|
|
1178
|
+
body: form
|
|
1179
|
+
})
|
|
1180
|
+
} catch (err) {
|
|
1181
|
+
err.statusCode = err.response.statusCode
|
|
1182
|
+
throw err
|
|
1183
|
+
}
|
|
1120
1184
|
}
|
|
1121
1185
|
}
|
package/lib/aws-efs.js
CHANGED
|
@@ -31,7 +31,8 @@ async function lookupStorageClass (tagName) {
|
|
|
31
31
|
if (found) {
|
|
32
32
|
// console.log(storageClass)
|
|
33
33
|
const apParams = {
|
|
34
|
-
FileSystemId: fsList.FileSystems[i].FileSystemId
|
|
34
|
+
FileSystemId: fsList.FileSystems[i].FileSystemId,
|
|
35
|
+
MaxResults: 999
|
|
35
36
|
}
|
|
36
37
|
// console.log(apParams)
|
|
37
38
|
const apListCommand = new DescribeAccessPointsCommand(apParams)
|
|
@@ -51,4 +52,4 @@ async function lookupStorageClass (tagName) {
|
|
|
51
52
|
|
|
52
53
|
module.exports = {
|
|
53
54
|
lookupStorageClass
|
|
54
|
-
}
|
|
55
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowfuse/driver-kubernetes",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"description": "Kubernetes driver for FlowFuse",
|
|
5
5
|
"main": "kubernetes.js",
|
|
6
6
|
"scripts": {
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@aws-sdk/client-efs": "^3.600.0",
|
|
25
25
|
"@kubernetes/client-node": "^0.18.1",
|
|
26
|
+
"form-data": "^4.0.0",
|
|
26
27
|
"got": "^11.8.0",
|
|
27
28
|
"lodash": "^4.17.21"
|
|
28
29
|
},
|