@ydkn/pulumi-components 0.4.2 → 0.4.3

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.
Files changed (505) hide show
  1. package/.eslintrc.json +14 -0
  2. package/.gitlab-ci.yml +72 -0
  3. package/.prettierrc +3 -0
  4. package/{index.d.ts → index.ts} +46 -2
  5. package/lib/avahi/deployment.ts +171 -0
  6. package/lib/avahi/{index.d.ts → index.ts} +1 -1
  7. package/lib/avahi/service.ts +118 -0
  8. package/lib/aws/accessKey.ts +40 -0
  9. package/lib/aws/bucket.ts +71 -0
  10. package/lib/aws/{index.d.ts → index.ts} +1 -1
  11. package/lib/blocky/assets/dashboard.json +1777 -0
  12. package/lib/blocky/deployment.ts +134 -0
  13. package/lib/blocky/{index.d.ts → index.ts} +1 -1
  14. package/lib/certManager/assets/dashboard.json +1188 -0
  15. package/lib/certManager/certificate.ts +168 -0
  16. package/lib/certManager/index.ts +39 -0
  17. package/lib/certManager/issuer.ts +141 -0
  18. package/lib/certManager/operator.ts +244 -0
  19. package/lib/common/componentResource.ts +78 -0
  20. package/lib/common/{index.d.ts → index.ts} +2 -1
  21. package/lib/common/types.ts +3 -0
  22. package/lib/cups/avahiService.ts +66 -0
  23. package/lib/cups/deployment.ts +199 -0
  24. package/lib/cups/index.ts +4 -0
  25. package/lib/devcontainer/assets/init.sh +44 -0
  26. package/lib/devcontainer/deployment.ts +253 -0
  27. package/lib/devcontainer/index.ts +3 -0
  28. package/lib/dhcpd/deployment.ts +164 -0
  29. package/lib/dhcpd/index.ts +3 -0
  30. package/lib/externalDns/dnsEndpoint.ts +70 -0
  31. package/lib/externalDns/index.ts +18 -0
  32. package/lib/externalDns/operator.ts +165 -0
  33. package/lib/fcos/assets/rpm-opstree-install.sh +0 -0
  34. package/lib/fcos/config.ts +237 -0
  35. package/lib/fcos/host.ts +91 -0
  36. package/lib/fcos/index.ts +27 -0
  37. package/lib/freeradius/deployment.ts +244 -0
  38. package/lib/freeradius/{index.d.ts → index.ts} +1 -1
  39. package/lib/gitlab/{index.d.ts → index.ts} +13 -2
  40. package/lib/gitlab/project.ts +148 -0
  41. package/lib/gitlab/renovate.ts +98 -0
  42. package/lib/gitlab/runners/cleanup.ts +104 -0
  43. package/lib/gitlab/runners/{index.d.ts → index.ts} +1 -1
  44. package/lib/gitlab/runners/runner.ts +122 -0
  45. package/lib/gitlab/runners/runners.ts +49 -0
  46. package/lib/grafana/agent.ts +449 -0
  47. package/lib/grafana/dashboard.ts +38 -0
  48. package/lib/grafana/datasource.ts +59 -0
  49. package/lib/grafana/deployment.ts +78 -0
  50. package/lib/grafana/index.ts +17 -0
  51. package/lib/hcloud/assets/fcos-install.sh +0 -0
  52. package/lib/hcloud/cluster.ts +533 -0
  53. package/lib/hcloud/{index.d.ts → index.ts} +1 -1
  54. package/lib/hcloud/kubernetes.ts +249 -0
  55. package/lib/hcloud/wireguard.ts +164 -0
  56. package/lib/k0s/cluster.ts +264 -0
  57. package/lib/k0s/{index.d.ts → index.ts} +1 -1
  58. package/lib/kubeStateMetrics/deployment.ts +60 -0
  59. package/lib/kubeStateMetrics/{index.d.ts → index.ts} +1 -1
  60. package/lib/kubernetes/helm/{index.d.ts → index.ts} +1 -1
  61. package/lib/kubernetes/helm/v3/chart.ts +79 -0
  62. package/lib/kubernetes/helm/v3/helpers.ts +32 -0
  63. package/lib/kubernetes/helm/v3/{index.d.ts → index.ts} +1 -1
  64. package/lib/kubernetes/helm/v3/release.ts +17 -0
  65. package/lib/kubernetes/{index.d.ts → index.ts} +1 -1
  66. package/lib/kubernetes/transformations/filter.ts +43 -0
  67. package/lib/kubernetes/transformations/{index.d.ts → index.ts} +1 -1
  68. package/lib/kubernetes/transformations/metadataNamespace.ts +25 -0
  69. package/lib/kubernetes/transformations/removeCrdDescriptions.ts +78 -0
  70. package/lib/kubernetes/transformations/v1beta1Deprecations.ts +60 -0
  71. package/lib/kubernetes/v1/{index.d.ts → index.ts} +12 -2
  72. package/lib/kubernetes/v1/nfsVolume.ts +145 -0
  73. package/lib/kubernetes/v1/pullSecret.ts +37 -0
  74. package/lib/kubernetes/v1/service.ts +58 -0
  75. package/lib/localPathProvisioner/deployment.ts +88 -0
  76. package/lib/localPathProvisioner/index.ts +3 -0
  77. package/lib/loki/deployment.ts +122 -0
  78. package/lib/loki/index.ts +3 -0
  79. package/lib/metallb/controller.ts +96 -0
  80. package/lib/metallb/{index.d.ts → index.ts} +11 -2
  81. package/lib/metallb/ipAddressPool.ts +33 -0
  82. package/lib/metallb/l2Advertisement.ts +34 -0
  83. package/lib/node/{index.d.ts → index.ts} +1 -1
  84. package/lib/node/kubernetes.ts +129 -0
  85. package/lib/node/node.ts +17 -0
  86. package/lib/openldap/deployment.ts +226 -0
  87. package/lib/openldap/{index.d.ts → index.ts} +1 -1
  88. package/lib/plex/{index.d.ts → index.ts} +1 -1
  89. package/lib/plex/mediaServer.ts +265 -0
  90. package/lib/plex/playlists.ts +123 -0
  91. package/lib/postgresql/cluster.ts +61 -0
  92. package/lib/postgresql/index.ts +4 -0
  93. package/lib/postgresql/operator.ts +70 -0
  94. package/lib/prometheus/index.ts +23 -0
  95. package/lib/prometheus/monitor.ts +13 -0
  96. package/lib/prometheus/operator.ts +264 -0
  97. package/lib/prometheus/podMonitor.ts +32 -0
  98. package/lib/prometheus/serviceMonitor.ts +43 -0
  99. package/lib/raspberrypi/cluster.ts +279 -0
  100. package/lib/raspberrypi/{index.d.ts → index.ts} +1 -1
  101. package/lib/rethinkdb/deployment.ts +424 -0
  102. package/lib/rethinkdb/{index.d.ts → index.ts} +1 -1
  103. package/lib/rook/assets/dashboard.json +4871 -0
  104. package/lib/rook/blockPool.ts +80 -0
  105. package/lib/rook/cluster.ts +168 -0
  106. package/lib/rook/filesystem.ts +140 -0
  107. package/lib/rook/{index.d.ts → index.ts} +15 -2
  108. package/lib/rook/operator.ts +175 -0
  109. package/lib/samba/avahiService.ts +44 -0
  110. package/lib/samba/deployment.ts +305 -0
  111. package/lib/samba/index.ts +5 -0
  112. package/lib/samba/volumes.ts +70 -0
  113. package/lib/ssh/exec.ts +162 -0
  114. package/lib/ssh/file.ts +165 -0
  115. package/lib/ssh/{index.d.ts → index.ts} +1 -1
  116. package/lib/ssh/types.ts +20 -0
  117. package/lib/torproxy/deployment.ts +165 -0
  118. package/lib/torproxy/{index.d.ts → index.ts} +1 -1
  119. package/lib/traefik/assets/dashboard.json +759 -0
  120. package/lib/traefik/controller.ts +207 -0
  121. package/lib/traefik/{index.d.ts → index.ts} +1 -1
  122. package/lib/traefik/middleware.ts +37 -0
  123. package/lib/traefik/secureIngress.ts +81 -0
  124. package/lib/ubuntu/assets/init.sh +0 -0
  125. package/lib/ubuntu/deployment.ts +275 -0
  126. package/lib/ubuntu/{index.d.ts → index.ts} +1 -1
  127. package/lib/unifi/controller.ts +234 -0
  128. package/lib/unifi/{index.d.ts → index.ts} +1 -1
  129. package/lib/velero/{index.d.ts → index.ts} +1 -1
  130. package/lib/velero/operator.ts +182 -0
  131. package/lib/wireguard/deployment.ts +168 -0
  132. package/lib/wireguard/{index.d.ts → index.ts} +1 -1
  133. package/package.json +62 -62
  134. package/renovate.json +4 -0
  135. package/tsconfig.json +21 -0
  136. package/index.d.ts.map +0 -1
  137. package/index.js +0 -64
  138. package/index.js.map +0 -1
  139. package/lib/avahi/deployment.d.ts +0 -36
  140. package/lib/avahi/deployment.d.ts.map +0 -1
  141. package/lib/avahi/deployment.js +0 -164
  142. package/lib/avahi/deployment.js.map +0 -1
  143. package/lib/avahi/index.d.ts.map +0 -1
  144. package/lib/avahi/index.js +0 -8
  145. package/lib/avahi/index.js.map +0 -1
  146. package/lib/avahi/service.d.ts +0 -51
  147. package/lib/avahi/service.d.ts.map +0 -1
  148. package/lib/avahi/service.js +0 -57
  149. package/lib/avahi/service.js.map +0 -1
  150. package/lib/aws/accessKey.d.ts +0 -22
  151. package/lib/aws/accessKey.d.ts.map +0 -1
  152. package/lib/aws/accessKey.js +0 -27
  153. package/lib/aws/accessKey.js.map +0 -1
  154. package/lib/aws/bucket.d.ts +0 -28
  155. package/lib/aws/bucket.d.ts.map +0 -1
  156. package/lib/aws/bucket.js +0 -49
  157. package/lib/aws/bucket.js.map +0 -1
  158. package/lib/aws/index.d.ts.map +0 -1
  159. package/lib/aws/index.js +0 -8
  160. package/lib/aws/index.js.map +0 -1
  161. package/lib/blocky/deployment.d.ts +0 -39
  162. package/lib/blocky/deployment.d.ts.map +0 -1
  163. package/lib/blocky/deployment.js +0 -97
  164. package/lib/blocky/deployment.js.map +0 -1
  165. package/lib/blocky/index.d.ts.map +0 -1
  166. package/lib/blocky/index.js +0 -6
  167. package/lib/blocky/index.js.map +0 -1
  168. package/lib/certManager/certificate.d.ts +0 -126
  169. package/lib/certManager/certificate.d.ts.map +0 -1
  170. package/lib/certManager/certificate.js +0 -42
  171. package/lib/certManager/certificate.js.map +0 -1
  172. package/lib/certManager/index.d.ts +0 -5
  173. package/lib/certManager/index.d.ts.map +0 -1
  174. package/lib/certManager/index.js +0 -11
  175. package/lib/certManager/index.js.map +0 -1
  176. package/lib/certManager/issuer.d.ts +0 -109
  177. package/lib/certManager/issuer.d.ts.map +0 -1
  178. package/lib/certManager/issuer.js +0 -39
  179. package/lib/certManager/issuer.js.map +0 -1
  180. package/lib/certManager/operator.d.ts +0 -43
  181. package/lib/certManager/operator.d.ts.map +0 -1
  182. package/lib/certManager/operator.js +0 -177
  183. package/lib/certManager/operator.js.map +0 -1
  184. package/lib/common/componentResource.d.ts +0 -20
  185. package/lib/common/componentResource.d.ts.map +0 -1
  186. package/lib/common/componentResource.js +0 -62
  187. package/lib/common/componentResource.js.map +0 -1
  188. package/lib/common/index.d.ts.map +0 -1
  189. package/lib/common/index.js +0 -6
  190. package/lib/common/index.js.map +0 -1
  191. package/lib/common/types.d.ts +0 -3
  192. package/lib/common/types.d.ts.map +0 -1
  193. package/lib/common/types.js +0 -3
  194. package/lib/common/types.js.map +0 -1
  195. package/lib/externalDns/dnsEndpoint.d.ts +0 -66
  196. package/lib/externalDns/dnsEndpoint.d.ts.map +0 -1
  197. package/lib/externalDns/dnsEndpoint.js +0 -17
  198. package/lib/externalDns/dnsEndpoint.js.map +0 -1
  199. package/lib/externalDns/index.d.ts +0 -4
  200. package/lib/externalDns/index.d.ts.map +0 -1
  201. package/lib/externalDns/index.js +0 -8
  202. package/lib/externalDns/index.js.map +0 -1
  203. package/lib/externalDns/operator.d.ts +0 -45
  204. package/lib/externalDns/operator.d.ts.map +0 -1
  205. package/lib/externalDns/operator.js +0 -112
  206. package/lib/externalDns/operator.js.map +0 -1
  207. package/lib/fcos/config.d.ts +0 -156
  208. package/lib/fcos/config.d.ts.map +0 -1
  209. package/lib/fcos/config.js +0 -168
  210. package/lib/fcos/config.js.map +0 -1
  211. package/lib/fcos/host.d.ts +0 -34
  212. package/lib/fcos/host.d.ts.map +0 -1
  213. package/lib/fcos/host.js +0 -57
  214. package/lib/fcos/host.js.map +0 -1
  215. package/lib/fcos/index.d.ts +0 -4
  216. package/lib/fcos/index.d.ts.map +0 -1
  217. package/lib/fcos/index.js +0 -8
  218. package/lib/fcos/index.js.map +0 -1
  219. package/lib/freeradius/deployment.d.ts +0 -74
  220. package/lib/freeradius/deployment.d.ts.map +0 -1
  221. package/lib/freeradius/deployment.js +0 -216
  222. package/lib/freeradius/deployment.js.map +0 -1
  223. package/lib/freeradius/index.d.ts.map +0 -1
  224. package/lib/freeradius/index.js +0 -6
  225. package/lib/freeradius/index.js.map +0 -1
  226. package/lib/gitlab/index.d.ts.map +0 -1
  227. package/lib/gitlab/index.js +0 -12
  228. package/lib/gitlab/index.js.map +0 -1
  229. package/lib/gitlab/project.d.ts +0 -18
  230. package/lib/gitlab/project.d.ts.map +0 -1
  231. package/lib/gitlab/project.js +0 -116
  232. package/lib/gitlab/project.js.map +0 -1
  233. package/lib/gitlab/renovate.d.ts +0 -23
  234. package/lib/gitlab/renovate.d.ts.map +0 -1
  235. package/lib/gitlab/renovate.js +0 -77
  236. package/lib/gitlab/renovate.js.map +0 -1
  237. package/lib/gitlab/runners/cleanup.d.ts +0 -20
  238. package/lib/gitlab/runners/cleanup.d.ts.map +0 -1
  239. package/lib/gitlab/runners/cleanup.js +0 -86
  240. package/lib/gitlab/runners/cleanup.js.map +0 -1
  241. package/lib/gitlab/runners/index.d.ts.map +0 -1
  242. package/lib/gitlab/runners/index.js +0 -10
  243. package/lib/gitlab/runners/index.js.map +0 -1
  244. package/lib/gitlab/runners/runner.d.ts +0 -30
  245. package/lib/gitlab/runners/runner.d.ts.map +0 -1
  246. package/lib/gitlab/runners/runner.js +0 -89
  247. package/lib/gitlab/runners/runner.js.map +0 -1
  248. package/lib/gitlab/runners/runners.d.ts +0 -21
  249. package/lib/gitlab/runners/runners.d.ts.map +0 -1
  250. package/lib/gitlab/runners/runners.js +0 -36
  251. package/lib/gitlab/runners/runners.js.map +0 -1
  252. package/lib/grafana/agent.d.ts +0 -43
  253. package/lib/grafana/agent.d.ts.map +0 -1
  254. package/lib/grafana/agent.js +0 -417
  255. package/lib/grafana/agent.js.map +0 -1
  256. package/lib/grafana/index.d.ts +0 -3
  257. package/lib/grafana/index.d.ts.map +0 -1
  258. package/lib/grafana/index.js +0 -6
  259. package/lib/grafana/index.js.map +0 -1
  260. package/lib/hcloud/cluster.d.ts +0 -96
  261. package/lib/hcloud/cluster.d.ts.map +0 -1
  262. package/lib/hcloud/cluster.js +0 -323
  263. package/lib/hcloud/cluster.js.map +0 -1
  264. package/lib/hcloud/index.d.ts.map +0 -1
  265. package/lib/hcloud/index.js +0 -10
  266. package/lib/hcloud/index.js.map +0 -1
  267. package/lib/hcloud/kubernetes.d.ts +0 -39
  268. package/lib/hcloud/kubernetes.d.ts.map +0 -1
  269. package/lib/hcloud/kubernetes.js +0 -188
  270. package/lib/hcloud/kubernetes.js.map +0 -1
  271. package/lib/hcloud/wireguard.d.ts +0 -33
  272. package/lib/hcloud/wireguard.d.ts.map +0 -1
  273. package/lib/hcloud/wireguard.js +0 -103
  274. package/lib/hcloud/wireguard.js.map +0 -1
  275. package/lib/k0s/cluster.d.ts +0 -51
  276. package/lib/k0s/cluster.d.ts.map +0 -1
  277. package/lib/k0s/cluster.js +0 -183
  278. package/lib/k0s/cluster.js.map +0 -1
  279. package/lib/k0s/index.d.ts.map +0 -1
  280. package/lib/k0s/index.js +0 -6
  281. package/lib/k0s/index.js.map +0 -1
  282. package/lib/kubeStateMetrics/deployment.d.ts +0 -20
  283. package/lib/kubeStateMetrics/deployment.d.ts.map +0 -1
  284. package/lib/kubeStateMetrics/deployment.js +0 -47
  285. package/lib/kubeStateMetrics/deployment.js.map +0 -1
  286. package/lib/kubeStateMetrics/index.d.ts.map +0 -1
  287. package/lib/kubeStateMetrics/index.js +0 -6
  288. package/lib/kubeStateMetrics/index.js.map +0 -1
  289. package/lib/kubernetes/helm/index.d.ts.map +0 -1
  290. package/lib/kubernetes/helm/index.js +0 -6
  291. package/lib/kubernetes/helm/index.js.map +0 -1
  292. package/lib/kubernetes/helm/v3/chart.d.ts +0 -37
  293. package/lib/kubernetes/helm/v3/chart.d.ts.map +0 -1
  294. package/lib/kubernetes/helm/v3/chart.js +0 -46
  295. package/lib/kubernetes/helm/v3/chart.js.map +0 -1
  296. package/lib/kubernetes/helm/v3/helpers.d.ts +0 -3
  297. package/lib/kubernetes/helm/v3/helpers.d.ts.map +0 -1
  298. package/lib/kubernetes/helm/v3/helpers.js +0 -29
  299. package/lib/kubernetes/helm/v3/helpers.js.map +0 -1
  300. package/lib/kubernetes/helm/v3/index.d.ts.map +0 -1
  301. package/lib/kubernetes/helm/v3/index.js +0 -10
  302. package/lib/kubernetes/helm/v3/index.js.map +0 -1
  303. package/lib/kubernetes/helm/v3/release.d.ts +0 -15
  304. package/lib/kubernetes/helm/v3/release.d.ts.map +0 -1
  305. package/lib/kubernetes/helm/v3/release.js +0 -18
  306. package/lib/kubernetes/helm/v3/release.js.map +0 -1
  307. package/lib/kubernetes/index.d.ts.map +0 -1
  308. package/lib/kubernetes/index.js +0 -10
  309. package/lib/kubernetes/index.js.map +0 -1
  310. package/lib/kubernetes/transformations/filter.d.ts +0 -13
  311. package/lib/kubernetes/transformations/filter.d.ts.map +0 -1
  312. package/lib/kubernetes/transformations/filter.js +0 -32
  313. package/lib/kubernetes/transformations/filter.js.map +0 -1
  314. package/lib/kubernetes/transformations/index.d.ts.map +0 -1
  315. package/lib/kubernetes/transformations/index.js +0 -12
  316. package/lib/kubernetes/transformations/index.js.map +0 -1
  317. package/lib/kubernetes/transformations/metadataNamespace.d.ts +0 -3
  318. package/lib/kubernetes/transformations/metadataNamespace.d.ts.map +0 -1
  319. package/lib/kubernetes/transformations/metadataNamespace.js +0 -27
  320. package/lib/kubernetes/transformations/metadataNamespace.js.map +0 -1
  321. package/lib/kubernetes/transformations/removeCrdDescriptions.d.ts +0 -3
  322. package/lib/kubernetes/transformations/removeCrdDescriptions.d.ts.map +0 -1
  323. package/lib/kubernetes/transformations/removeCrdDescriptions.js +0 -61
  324. package/lib/kubernetes/transformations/removeCrdDescriptions.js.map +0 -1
  325. package/lib/kubernetes/transformations/v1beta1Deprecations.d.ts +0 -3
  326. package/lib/kubernetes/transformations/v1beta1Deprecations.d.ts.map +0 -1
  327. package/lib/kubernetes/transformations/v1beta1Deprecations.js +0 -55
  328. package/lib/kubernetes/transformations/v1beta1Deprecations.js.map +0 -1
  329. package/lib/kubernetes/v1/index.d.ts.map +0 -1
  330. package/lib/kubernetes/v1/index.js +0 -10
  331. package/lib/kubernetes/v1/index.js.map +0 -1
  332. package/lib/kubernetes/v1/nfsVolume.d.ts +0 -92
  333. package/lib/kubernetes/v1/nfsVolume.d.ts.map +0 -1
  334. package/lib/kubernetes/v1/nfsVolume.js +0 -97
  335. package/lib/kubernetes/v1/nfsVolume.js.map +0 -1
  336. package/lib/kubernetes/v1/pullSecret.d.ts +0 -31
  337. package/lib/kubernetes/v1/pullSecret.d.ts.map +0 -1
  338. package/lib/kubernetes/v1/pullSecret.js +0 -27
  339. package/lib/kubernetes/v1/pullSecret.js.map +0 -1
  340. package/lib/kubernetes/v1/service.d.ts +0 -31
  341. package/lib/kubernetes/v1/service.d.ts.map +0 -1
  342. package/lib/kubernetes/v1/service.js +0 -43
  343. package/lib/kubernetes/v1/service.js.map +0 -1
  344. package/lib/metallb/controller.d.ts +0 -17
  345. package/lib/metallb/controller.d.ts.map +0 -1
  346. package/lib/metallb/controller.js +0 -87
  347. package/lib/metallb/controller.js.map +0 -1
  348. package/lib/metallb/index.d.ts.map +0 -1
  349. package/lib/metallb/index.js +0 -10
  350. package/lib/metallb/index.js.map +0 -1
  351. package/lib/metallb/ipAddressPool.d.ts +0 -20
  352. package/lib/metallb/ipAddressPool.d.ts.map +0 -1
  353. package/lib/metallb/ipAddressPool.js +0 -22
  354. package/lib/metallb/ipAddressPool.js.map +0 -1
  355. package/lib/metallb/l2Advertisement.d.ts +0 -21
  356. package/lib/metallb/l2Advertisement.d.ts.map +0 -1
  357. package/lib/metallb/l2Advertisement.js +0 -22
  358. package/lib/metallb/l2Advertisement.js.map +0 -1
  359. package/lib/node/index.d.ts.map +0 -1
  360. package/lib/node/index.js +0 -6
  361. package/lib/node/index.js.map +0 -1
  362. package/lib/node/kubernetes.d.ts +0 -38
  363. package/lib/node/kubernetes.d.ts.map +0 -1
  364. package/lib/node/kubernetes.js +0 -89
  365. package/lib/node/kubernetes.js.map +0 -1
  366. package/lib/node/node.d.ts +0 -21
  367. package/lib/node/node.d.ts.map +0 -1
  368. package/lib/node/node.js +0 -3
  369. package/lib/node/node.js.map +0 -1
  370. package/lib/openldap/deployment.d.ts +0 -58
  371. package/lib/openldap/deployment.d.ts.map +0 -1
  372. package/lib/openldap/deployment.js +0 -217
  373. package/lib/openldap/deployment.js.map +0 -1
  374. package/lib/openldap/index.d.ts.map +0 -1
  375. package/lib/openldap/index.js +0 -6
  376. package/lib/openldap/index.js.map +0 -1
  377. package/lib/plex/index.d.ts.map +0 -1
  378. package/lib/plex/index.js +0 -8
  379. package/lib/plex/index.js.map +0 -1
  380. package/lib/plex/mediaServer.d.ts +0 -46
  381. package/lib/plex/mediaServer.d.ts.map +0 -1
  382. package/lib/plex/mediaServer.js +0 -234
  383. package/lib/plex/mediaServer.js.map +0 -1
  384. package/lib/plex/playlists.d.ts +0 -62
  385. package/lib/plex/playlists.d.ts.map +0 -1
  386. package/lib/plex/playlists.js +0 -129
  387. package/lib/plex/playlists.js.map +0 -1
  388. package/lib/prometheus/index.d.ts +0 -4
  389. package/lib/prometheus/index.d.ts.map +0 -1
  390. package/lib/prometheus/index.js +0 -8
  391. package/lib/prometheus/index.js.map +0 -1
  392. package/lib/prometheus/podMonitor.d.ts +0 -42
  393. package/lib/prometheus/podMonitor.d.ts.map +0 -1
  394. package/lib/prometheus/podMonitor.js +0 -17
  395. package/lib/prometheus/podMonitor.js.map +0 -1
  396. package/lib/prometheus/serviceMonitor.d.ts +0 -46
  397. package/lib/prometheus/serviceMonitor.d.ts.map +0 -1
  398. package/lib/prometheus/serviceMonitor.js +0 -17
  399. package/lib/prometheus/serviceMonitor.js.map +0 -1
  400. package/lib/raspberrypi/cluster.d.ts +0 -41
  401. package/lib/raspberrypi/cluster.d.ts.map +0 -1
  402. package/lib/raspberrypi/cluster.js +0 -194
  403. package/lib/raspberrypi/cluster.js.map +0 -1
  404. package/lib/raspberrypi/index.d.ts.map +0 -1
  405. package/lib/raspberrypi/index.js +0 -6
  406. package/lib/raspberrypi/index.js.map +0 -1
  407. package/lib/rethinkdb/deployment.d.ts +0 -61
  408. package/lib/rethinkdb/deployment.d.ts.map +0 -1
  409. package/lib/rethinkdb/deployment.js +0 -350
  410. package/lib/rethinkdb/deployment.js.map +0 -1
  411. package/lib/rethinkdb/index.d.ts.map +0 -1
  412. package/lib/rethinkdb/index.js +0 -6
  413. package/lib/rethinkdb/index.js.map +0 -1
  414. package/lib/rook/blockPool.d.ts +0 -28
  415. package/lib/rook/blockPool.d.ts.map +0 -1
  416. package/lib/rook/blockPool.js +0 -56
  417. package/lib/rook/blockPool.js.map +0 -1
  418. package/lib/rook/cluster.d.ts +0 -54
  419. package/lib/rook/cluster.d.ts.map +0 -1
  420. package/lib/rook/cluster.js +0 -100
  421. package/lib/rook/cluster.js.map +0 -1
  422. package/lib/rook/filesystem.d.ts +0 -29
  423. package/lib/rook/filesystem.d.ts.map +0 -1
  424. package/lib/rook/filesystem.js +0 -110
  425. package/lib/rook/filesystem.js.map +0 -1
  426. package/lib/rook/index.d.ts.map +0 -1
  427. package/lib/rook/index.js +0 -12
  428. package/lib/rook/index.js.map +0 -1
  429. package/lib/rook/operator.d.ts +0 -19
  430. package/lib/rook/operator.d.ts.map +0 -1
  431. package/lib/rook/operator.js +0 -162
  432. package/lib/rook/operator.js.map +0 -1
  433. package/lib/samba/deployment.d.ts +0 -79
  434. package/lib/samba/deployment.d.ts.map +0 -1
  435. package/lib/samba/deployment.js +0 -238
  436. package/lib/samba/deployment.js.map +0 -1
  437. package/lib/samba/index.d.ts +0 -3
  438. package/lib/samba/index.d.ts.map +0 -1
  439. package/lib/samba/index.js +0 -6
  440. package/lib/samba/index.js.map +0 -1
  441. package/lib/ssh/exec.d.ts +0 -33
  442. package/lib/ssh/exec.d.ts.map +0 -1
  443. package/lib/ssh/exec.js +0 -116
  444. package/lib/ssh/exec.js.map +0 -1
  445. package/lib/ssh/file.d.ts +0 -43
  446. package/lib/ssh/file.d.ts.map +0 -1
  447. package/lib/ssh/file.js +0 -110
  448. package/lib/ssh/file.js.map +0 -1
  449. package/lib/ssh/index.d.ts.map +0 -1
  450. package/lib/ssh/index.js +0 -8
  451. package/lib/ssh/index.js.map +0 -1
  452. package/lib/ssh/types.d.ts +0 -19
  453. package/lib/ssh/types.d.ts.map +0 -1
  454. package/lib/ssh/types.js +0 -3
  455. package/lib/ssh/types.js.map +0 -1
  456. package/lib/torproxy/deployment.d.ts +0 -31
  457. package/lib/torproxy/deployment.d.ts.map +0 -1
  458. package/lib/torproxy/deployment.js +0 -131
  459. package/lib/torproxy/deployment.js.map +0 -1
  460. package/lib/torproxy/index.d.ts.map +0 -1
  461. package/lib/torproxy/index.js +0 -6
  462. package/lib/torproxy/index.js.map +0 -1
  463. package/lib/traefik/controller.d.ts +0 -50
  464. package/lib/traefik/controller.d.ts.map +0 -1
  465. package/lib/traefik/controller.js +0 -166
  466. package/lib/traefik/controller.js.map +0 -1
  467. package/lib/traefik/index.d.ts.map +0 -1
  468. package/lib/traefik/index.js +0 -10
  469. package/lib/traefik/index.js.map +0 -1
  470. package/lib/traefik/middleware.d.ts +0 -27
  471. package/lib/traefik/middleware.d.ts.map +0 -1
  472. package/lib/traefik/middleware.js +0 -22
  473. package/lib/traefik/middleware.js.map +0 -1
  474. package/lib/traefik/secureIngress.d.ts +0 -32
  475. package/lib/traefik/secureIngress.d.ts.map +0 -1
  476. package/lib/traefik/secureIngress.js +0 -58
  477. package/lib/traefik/secureIngress.js.map +0 -1
  478. package/lib/ubuntu/deployment.d.ts +0 -67
  479. package/lib/ubuntu/deployment.d.ts.map +0 -1
  480. package/lib/ubuntu/deployment.js +0 -230
  481. package/lib/ubuntu/deployment.js.map +0 -1
  482. package/lib/ubuntu/index.d.ts.map +0 -1
  483. package/lib/ubuntu/index.js +0 -6
  484. package/lib/ubuntu/index.js.map +0 -1
  485. package/lib/unifi/controller.d.ts +0 -52
  486. package/lib/unifi/controller.d.ts.map +0 -1
  487. package/lib/unifi/controller.js +0 -232
  488. package/lib/unifi/controller.js.map +0 -1
  489. package/lib/unifi/index.d.ts.map +0 -1
  490. package/lib/unifi/index.js +0 -6
  491. package/lib/unifi/index.js.map +0 -1
  492. package/lib/velero/index.d.ts.map +0 -1
  493. package/lib/velero/index.js +0 -6
  494. package/lib/velero/index.js.map +0 -1
  495. package/lib/velero/operator.d.ts +0 -31
  496. package/lib/velero/operator.d.ts.map +0 -1
  497. package/lib/velero/operator.js +0 -148
  498. package/lib/velero/operator.js.map +0 -1
  499. package/lib/wireguard/deployment.d.ts +0 -82
  500. package/lib/wireguard/deployment.d.ts.map +0 -1
  501. package/lib/wireguard/deployment.js +0 -161
  502. package/lib/wireguard/deployment.js.map +0 -1
  503. package/lib/wireguard/index.d.ts.map +0 -1
  504. package/lib/wireguard/index.js +0 -6
  505. package/lib/wireguard/index.js.map +0 -1
@@ -0,0 +1,305 @@
1
+ import * as pulumi from "@pulumi/pulumi";
2
+ import * as k8s from "@pulumi/kubernetes";
3
+ import * as crypto from "crypto";
4
+ import { ComponentResource } from "../common";
5
+ import * as kubernetes from "../kubernetes";
6
+ import { AvahiService } from "./avahiService";
7
+
8
+ export interface User {
9
+ name: string;
10
+ uid: number;
11
+ }
12
+
13
+ export interface SambaArgs {
14
+ namespace?: pulumi.Input<string>;
15
+ serverName: pulumi.Input<string>;
16
+ workgroup: pulumi.Input<string>;
17
+ deviceModel: pulumi.Input<string>;
18
+ hostname: pulumi.Input<string>;
19
+ users: pulumi.Input<pulumi.Input<User>[]>;
20
+ volumes?: { [key: string]: pulumi.Input<string> };
21
+ serviceType?: pulumi.Input<string>;
22
+ avahiLabelName?: pulumi.Input<string>;
23
+ storageClassName?: pulumi.Input<string>;
24
+ protect?: boolean;
25
+ }
26
+
27
+ export class Samba extends ComponentResource {
28
+ private static readonly vetoFiles = [
29
+ ".apdisk",
30
+ ".DS_Store",
31
+ "._.DS_Store",
32
+ ".TemporaryItems",
33
+ "._.TemporaryItems",
34
+ ".Trashes",
35
+ "desktop.ini",
36
+ "ehthumbs.db",
37
+ "Network Trash Folder",
38
+ "Temporary Items",
39
+ "Thumbs.db",
40
+ ];
41
+
42
+ private readonly settings: k8s.core.v1.ConfigMap;
43
+ private readonly dataVolumeClaim: k8s.core.v1.PersistentVolumeClaim;
44
+ private readonly deployment: k8s.apps.v1.Deployment;
45
+ private readonly podDisruptionBudget: k8s.policy.v1.PodDisruptionBudget;
46
+ private readonly service: k8s.core.v1.Service;
47
+ private readonly avahiService?: AvahiService;
48
+ public readonly namespace: pulumi.Output<string>;
49
+ public readonly hostname: pulumi.Output<string>;
50
+
51
+ /**
52
+ * Create a new Samba resource.
53
+ * @param name The name of the Samba resource.
54
+ * @param args A bag of arguments to control the Samba creation.
55
+ * @param opts A bag of options that control this resource's behavior.
56
+ */
57
+ constructor(name: string, args: SambaArgs, opts?: pulumi.ComponentResourceOptions) {
58
+ super("samba", name, args, opts);
59
+
60
+ if (args.serviceType === undefined) {
61
+ args.serviceType = "LoadBalancer";
62
+ }
63
+
64
+ opts = this.opts(k8s.Provider);
65
+
66
+ this.hostname = pulumi.output(args.hostname);
67
+
68
+ this.namespace = args.namespace
69
+ ? pulumi.output(args.namespace)
70
+ : new k8s.core.v1.Namespace(name, { metadata: { name } }, opts).metadata.name;
71
+
72
+ const metadata = {
73
+ name,
74
+ namespace: this.namespace,
75
+ labels: {
76
+ "app.kubernetes.io/name": "samba",
77
+ "app.kubernetes.io/component": "samba",
78
+ "app.kubernetes.io/instance": name,
79
+ },
80
+ };
81
+
82
+ const sambaConfig = [
83
+ "[global]",
84
+ `workgroup = ${args.workgroup}`,
85
+ `server string = ${args.serverName}`,
86
+ `netbios name = ${args.serverName}`,
87
+ "server role = standalone server",
88
+ "log file = /dev/stdout",
89
+ "max log size = 50",
90
+ "dns proxy = no",
91
+ "map to guest = bad user",
92
+ "usershare allow guests = no",
93
+ "client ipc min protocol = SMB2",
94
+ "client ipc max protocol = SMB3",
95
+ "client min protocol = SMB2",
96
+ "client max protocol = SMB3",
97
+ "server min protocol = SMB2",
98
+ "server max protocol = SMB3",
99
+ "follow symlinks = yes",
100
+ "load printers = no",
101
+ "printing = bsd",
102
+ "printcap name = /dev/null",
103
+ "disable spoolss = yes",
104
+ "aio read size = 0",
105
+ "aio write size = 0",
106
+ "posix locking = no",
107
+ "strict locking = no",
108
+ "follow symlinks = yes",
109
+ "unix extensions = yes",
110
+ "wide links = no",
111
+ "mangled names = no",
112
+ "unix charset = UTF-8",
113
+ "acl allow execute always = yes",
114
+ "vfs objects = catia fruit",
115
+ "fruit:aapl = yes",
116
+ "fruit:delete_empty_adfiles = yes",
117
+ "fruit:time machine = yes",
118
+ "fruit:veto_appledouble = yes",
119
+ "fruit:wipe_intentionally_left_blank_rfork = yes",
120
+ `fruit:model = ${args.deviceModel}`,
121
+ "fruit:locking = none",
122
+ "ea support = no",
123
+ "kernel oplocks = no",
124
+ "oplocks = no",
125
+ "level2 oplocks = no",
126
+ ];
127
+
128
+ const shareVolumes: any[] = [];
129
+ const shareVolumeMounts: any[] = [];
130
+
131
+ if (args.volumes !== undefined) {
132
+ for (const shareName in args.volumes) {
133
+ // eslint-disable-next-line security/detect-object-injection
134
+ const volume = args.volumes[shareName];
135
+
136
+ const shasum = crypto.createHash("sha1");
137
+ shasum.update(shareName);
138
+ const volumeName = shasum.digest("hex");
139
+
140
+ shareVolumes.push(
141
+ pulumi.all([volume]).apply((o) => {
142
+ return { name: volumeName, persistentVolumeClaim: { claimName: o[0] } };
143
+ })
144
+ );
145
+
146
+ const mountPath = `/shares/${volumeName}`;
147
+
148
+ shareVolumeMounts.push({ name: volumeName, mountPath });
149
+
150
+ sambaConfig.push(
151
+ `[${shareName}]`,
152
+ `comment = ${shareName}`,
153
+ `path = ${mountPath}`,
154
+ "browseable = yes",
155
+ "read only = no",
156
+ "guest ok = no",
157
+ `veto files = /${Samba.vetoFiles.join("/")}/`,
158
+ "delete veto files = yes"
159
+ );
160
+ }
161
+ }
162
+
163
+ const containerArgs = pulumi.all([args.users]).apply((o) => {
164
+ const cmds = ["mkdir -p /var/lib/samba/private"];
165
+
166
+ for (const user of o[0]) {
167
+ cmds.push(`adduser -s /bin/false -D -u ${user.uid} "${user.name}"`);
168
+ }
169
+
170
+ cmds.push("/usr/bin/samba.sh -n");
171
+
172
+ return ["-c", cmds.join(" && ")];
173
+ });
174
+
175
+ this.settings = new k8s.core.v1.ConfigMap(
176
+ `${name}-config`,
177
+ {
178
+ metadata: { ...metadata, name: pulumi.interpolate`${name}-config` },
179
+ data: {
180
+ "smb.conf": sambaConfig.join("\n"),
181
+ },
182
+ },
183
+ opts
184
+ );
185
+
186
+ const dataVolumeClaimName = pulumi.interpolate`${name}-data`;
187
+
188
+ this.dataVolumeClaim = new k8s.core.v1.PersistentVolumeClaim(
189
+ `${name}-data`,
190
+ {
191
+ metadata: { ...metadata, name: dataVolumeClaimName },
192
+ spec: {
193
+ storageClassName: args.storageClassName,
194
+ accessModes: ["ReadWriteOnce"],
195
+ resources: { requests: { storage: "128Mi" } },
196
+ },
197
+ },
198
+ { ...opts, protect: args.protect }
199
+ );
200
+
201
+ this.deployment = new k8s.apps.v1.Deployment(
202
+ name,
203
+ {
204
+ metadata,
205
+ spec: {
206
+ selector: { matchLabels: metadata.labels },
207
+ strategy: { type: "Recreate" },
208
+ replicas: 1,
209
+ template: {
210
+ metadata: {
211
+ labels: metadata.labels,
212
+ annotations: { "backup.velero.io/backup-volumes": "data" },
213
+ },
214
+ spec: {
215
+ containers: [
216
+ {
217
+ name: "samba",
218
+ image: "dperson/samba:latest",
219
+ imagePullPolicy: "Always",
220
+ command: ["/bin/sh"],
221
+ args: containerArgs,
222
+ ports: [
223
+ { containerPort: 137, protocol: "UDP", name: "netbios-ns" },
224
+ { containerPort: 138, protocol: "UDP", name: "netbios-dgm" },
225
+ { containerPort: 139, protocol: "TCP", name: "netbios-ssn" },
226
+ { containerPort: 445, protocol: "TCP", name: "microsoft-ds" },
227
+ ],
228
+ readinessProbe: {
229
+ exec: { command: ["smbclient", "-L", "\\\\localhost", "-U", "%", "-m", "SMB3"] },
230
+ periodSeconds: 20,
231
+ failureThreshold: 3,
232
+ successThreshold: 1,
233
+ timeoutSeconds: 10,
234
+ },
235
+ livenessProbe: {
236
+ exec: { command: ["smbclient", "-L", "\\\\localhost", "-U", "%", "-m", "SMB3"] },
237
+ periodSeconds: 20,
238
+ failureThreshold: 3,
239
+ successThreshold: 1,
240
+ timeoutSeconds: 10,
241
+ },
242
+ resources: {
243
+ requests: { memory: "256Mi" },
244
+ limits: { memory: "512Mi" },
245
+ },
246
+ volumeMounts: [
247
+ { name: "config", mountPath: "/etc/samba" },
248
+ { name: "data", mountPath: "/var/lib/samba" },
249
+ ].concat(shareVolumeMounts),
250
+ },
251
+ ],
252
+ volumes: [
253
+ { name: "config", configMap: { name: this.settings.metadata.name } },
254
+ { name: "data", persistentVolumeClaim: { claimName: dataVolumeClaimName } },
255
+ ].concat(shareVolumes),
256
+ },
257
+ },
258
+ },
259
+ },
260
+ opts
261
+ );
262
+
263
+ this.podDisruptionBudget = new k8s.policy.v1.PodDisruptionBudget(
264
+ name,
265
+ {
266
+ metadata,
267
+ spec: {
268
+ minAvailable: 1,
269
+ selector: { matchLabels: metadata.labels },
270
+ },
271
+ },
272
+ opts
273
+ );
274
+
275
+ this.service = new kubernetes.v1.Service(
276
+ name,
277
+ {
278
+ metadata,
279
+ spec: {
280
+ type: args.serviceType,
281
+ selector: metadata.labels,
282
+ ports: [{ name: "microsoft-ds", protocol: "TCP", port: 445, targetPort: "microsoft-ds" }],
283
+ },
284
+ hostnames: [args.hostname],
285
+ },
286
+ { ...opts, dependsOn: [this.deployment] }
287
+ );
288
+
289
+ if (args.avahiLabelName !== undefined) {
290
+ this.avahiService = new AvahiService(
291
+ name,
292
+ {
293
+ labelName: args.avahiLabelName,
294
+ metadata,
295
+ serverName: args.serverName,
296
+ hostname: args.hostname,
297
+ deviceModel: args.deviceModel,
298
+ },
299
+ opts
300
+ );
301
+ }
302
+
303
+ this.registerOutputs();
304
+ }
305
+ }
@@ -0,0 +1,5 @@
1
+ import { User, SambaArgs, Samba } from "./deployment";
2
+ import { AvahiServiceArgs, AvahiService } from "./avahiService";
3
+ import { localPathVolumesFromConfig, nfsVolumesFromConfig } from "./volumes";
4
+
5
+ export { User, SambaArgs, Samba, AvahiServiceArgs, AvahiService, localPathVolumesFromConfig, nfsVolumesFromConfig };
@@ -0,0 +1,70 @@
1
+ import * as pulumi from "@pulumi/pulumi";
2
+ import * as k8s from "@pulumi/kubernetes";
3
+ import * as kubernetes from "../kubernetes";
4
+
5
+ export interface Volumes {
6
+ [key: string]: pulumi.Output<string>;
7
+ }
8
+
9
+ export interface LocalPathVolumesArgs {
10
+ name: string;
11
+ }
12
+
13
+ export interface LocalPathArgs {
14
+ metadata: pulumi.Input<k8s.types.input.meta.v1.ObjectMeta>;
15
+ volumes: { [key: string]: LocalPathVolumesArgs };
16
+ storageClassName?: pulumi.Input<string>;
17
+ }
18
+
19
+ export function localPathVolumesFromConfig(args: LocalPathArgs, opts?: pulumi.CustomResourceOptions): Volumes {
20
+ const volumes: Volumes = {};
21
+
22
+ for (const name in args.volumes) {
23
+ // eslint-disable-next-line security/detect-object-injection
24
+ const config = args.volumes[name];
25
+
26
+ // eslint-disable-next-line no-unused-vars
27
+ const pvc = new k8s.core.v1.PersistentVolumeClaim(
28
+ name,
29
+ {
30
+ metadata: { ...args.metadata, name },
31
+ spec: {
32
+ storageClassName: args.storageClassName ?? "local-path",
33
+ accessModes: ["ReadWriteOnce"],
34
+ resources: { requests: { storage: "1Gi" } },
35
+ },
36
+ },
37
+ opts
38
+ );
39
+
40
+ volumes[config.name] = pulumi.output(name);
41
+ }
42
+
43
+ return volumes;
44
+ }
45
+
46
+ export interface NfsVolumeArgs extends kubernetes.v1.NfsVolumeConfig {
47
+ name: string;
48
+ }
49
+
50
+ export interface NfsArgs {
51
+ metadata: pulumi.Input<k8s.types.input.meta.v1.ObjectMeta>;
52
+ volumes: { [key: string]: NfsVolumeArgs };
53
+ storageClassName?: pulumi.Input<string>;
54
+ }
55
+
56
+ export function nfsVolumesFromConfig(args: NfsArgs, opts?: pulumi.CustomResourceOptions): Volumes {
57
+ const volumes: Volumes = {};
58
+
59
+ for (const name in args.volumes) {
60
+ // eslint-disable-next-line security/detect-object-injection
61
+ const config = args.volumes[name];
62
+
63
+ // eslint-disable-next-line no-unused-vars
64
+ const pvc = kubernetes.v1.NfsVolume.fromConfig(name, { metadata: { ...args.metadata, name }, config }, opts);
65
+
66
+ volumes[config.name] = pulumi.output(name);
67
+ }
68
+
69
+ return volumes;
70
+ }
@@ -0,0 +1,162 @@
1
+ import * as pulumi from "@pulumi/pulumi";
2
+ import * as ssh from "ssh2";
3
+ import { ConnectionArgs, ConnectionArgsInternal } from "./types";
4
+
5
+ interface ExecResult {
6
+ exitCode: number;
7
+ stdout: string;
8
+ stderr: string;
9
+ }
10
+
11
+ function sshCommand(connection: pulumi.Unwrap<ConnectionArgs>, cmd: string, finishDelay?: number): Promise<ExecResult> {
12
+ const connectionRetryFactor = connection.retryBackoffFactor || 1.2;
13
+ const initialDelay = connection.initialDelay || 0;
14
+ let connectionFailCount = connection.retries || 10;
15
+ let connectionRetryDelay = connection.retryIntialBackoff || 500;
16
+
17
+ return new Promise((resolve, reject) => {
18
+ const sshConnection = new ssh.Client();
19
+
20
+ function retryFunc() {
21
+ sshConnection
22
+ .on("ready", () => {
23
+ sshConnection.exec(cmd, (err, stream) => {
24
+ if (err) {
25
+ reject(err);
26
+
27
+ return;
28
+ }
29
+
30
+ let stdout = "";
31
+ let stderr = "";
32
+
33
+ stream
34
+ .on("close", (exitCode: number, signal: any) => {
35
+ sshConnection.end();
36
+
37
+ if (exitCode) {
38
+ reject(new Error("Command exited with " + exitCode));
39
+ } else {
40
+ setTimeout(function () {
41
+ resolve({ exitCode, stdout, stderr });
42
+ }, finishDelay || 0);
43
+ }
44
+ })
45
+ .on("data", (data: any) => {
46
+ stdout += data.toString("utf8");
47
+ })
48
+ .stderr.on("data", (data) => {
49
+ stderr += data.toString("utf8");
50
+ });
51
+ });
52
+ })
53
+ .on("error", (err) => {
54
+ connectionFailCount--;
55
+ connectionRetryDelay *= connectionRetryFactor;
56
+
57
+ if (connectionFailCount < 0) {
58
+ reject(err);
59
+ } else {
60
+ setTimeout(retryFunc, Math.round(connectionRetryDelay));
61
+ }
62
+ })
63
+ .connect({
64
+ host: connection.host,
65
+ port: connection.port ?? 22,
66
+ username: connection.username,
67
+ password: connection.password,
68
+ privateKey: connection.privateKey,
69
+ passphrase: connection.privateKeyPassphrase,
70
+ });
71
+ }
72
+
73
+ setTimeout(retryFunc, initialDelay);
74
+ });
75
+ }
76
+
77
+ export interface ExecArgs {
78
+ /**
79
+ * SSH connection details
80
+ */
81
+ connection: pulumi.Input<ConnectionArgs>;
82
+ /**
83
+ * Command to run
84
+ */
85
+ command: pulumi.Input<string>;
86
+ /**
87
+ * Optional: Change token
88
+ */
89
+ changeToken?: pulumi.Input<string>;
90
+ /**
91
+ * Optional: Finish delay
92
+ */
93
+ finishDelay?: pulumi.Input<number>;
94
+ }
95
+
96
+ interface ProviderInputs {
97
+ connection: ConnectionArgsInternal;
98
+ command: string;
99
+ changeToken?: string;
100
+ finishDelay?: number;
101
+ }
102
+
103
+ export class Exec extends pulumi.dynamic.Resource {
104
+ public readonly exitCode!: pulumi.Output<number>;
105
+ public readonly stdout!: pulumi.Output<string>;
106
+ public readonly stderr!: pulumi.Output<string>;
107
+
108
+ /**
109
+ * Create a new SSH exec resource.
110
+ * @param name The name of the SSH exec resource.
111
+ * @param args A bag of arguments to control the SSH exec creation.
112
+ * @param opts A bag of options that control this resource's behavior.
113
+ */
114
+ constructor(name: string, args: ExecArgs, opts?: pulumi.ComponentResourceOptions) {
115
+ const provider: pulumi.dynamic.ResourceProvider = {
116
+ async diff(id: pulumi.ID, olds: ProviderInputs, news: ProviderInputs): Promise<pulumi.dynamic.DiffResult> {
117
+ const replaces = [];
118
+
119
+ for (const [nKey, nValue] of Object.entries(news)) {
120
+ if (nKey === "__provider") {
121
+ continue;
122
+ }
123
+
124
+ let keyFound = false;
125
+
126
+ for (const [oKey, oValue] of Object.entries(olds)) {
127
+ if (oKey === "__provider") {
128
+ continue;
129
+ }
130
+
131
+ if (nKey === oKey) {
132
+ keyFound = true;
133
+
134
+ if (JSON.stringify(nValue) !== JSON.stringify(oValue)) {
135
+ replaces.push(nKey);
136
+ }
137
+ }
138
+ }
139
+
140
+ if (!keyFound) {
141
+ replaces.push(nKey);
142
+ }
143
+ }
144
+
145
+ return { changes: replaces.length > 0, replaces, deleteBeforeReplace: true };
146
+ },
147
+ async create(inputs: ProviderInputs): Promise<pulumi.dynamic.CreateResult> {
148
+ return sshCommand(inputs.connection, inputs.command, inputs.finishDelay).then((r) => {
149
+ return {
150
+ id: require("uuid").v4(),
151
+ outs:
152
+ r.exitCode === 0
153
+ ? { exitCode: r.exitCode, stdout: "", stderr: "", ...inputs }
154
+ : { exitCode: r.exitCode, stdout: r.stdout, stderr: r.stderr, ...inputs },
155
+ };
156
+ });
157
+ },
158
+ };
159
+
160
+ super(provider, name, { exitCode: undefined, stdout: undefined, stderr: undefined, ...args }, opts);
161
+ }
162
+ }
@@ -0,0 +1,165 @@
1
+ import * as pulumi from "@pulumi/pulumi";
2
+ import * as Sftp from "ssh2-sftp-client";
3
+ import * as crypto from "crypto";
4
+ import * as fs from "fs";
5
+ import { ConnectionArgs, ConnectionArgsInternal } from "./types";
6
+
7
+ function sshFileCreate(
8
+ connection: pulumi.Unwrap<ConnectionArgs>,
9
+ dst: string,
10
+ srcFile?: string,
11
+ srcData?: string | Buffer
12
+ ): Promise<boolean> {
13
+ const connectionRetryFactor = connection.retryBackoffFactor || 1.2;
14
+ const initialDelay = connection.initialDelay || 0;
15
+ let connectionFailCount = connection.retries || 10;
16
+ let connectionRetryDelay = connection.retryIntialBackoff || 500;
17
+
18
+ return new Promise((resolve, reject) => {
19
+ function retryFunc() {
20
+ if (srcFile === undefined && srcData === undefined) {
21
+ reject(new Error("Must provide either srcFile or srcData"));
22
+ }
23
+
24
+ const client = new Sftp();
25
+
26
+ client
27
+ .connect({
28
+ host: connection.host,
29
+ port: connection.port ?? 22,
30
+ username: connection.username,
31
+ password: connection.password,
32
+ privateKey: connection.privateKey,
33
+ passphrase: connection.privateKeyPassphrase,
34
+ })
35
+ .then(() => {
36
+ if (srcFile !== undefined) {
37
+ return client.put(srcFile, dst);
38
+ } else {
39
+ if (srcData instanceof Buffer) {
40
+ return client.put(srcData, dst);
41
+ }
42
+
43
+ return client.put(Buffer.from(srcData as string), dst);
44
+ }
45
+ })
46
+ .then(() => {
47
+ client.end();
48
+
49
+ resolve(true);
50
+ })
51
+ .catch((err) => {
52
+ connectionFailCount--;
53
+ connectionRetryDelay *= connectionRetryFactor;
54
+
55
+ if (connectionFailCount < 0) {
56
+ reject(err);
57
+ } else {
58
+ setTimeout(retryFunc, Math.round(connectionRetryDelay));
59
+ }
60
+ });
61
+ }
62
+
63
+ setTimeout(retryFunc, initialDelay);
64
+ });
65
+ }
66
+
67
+ export interface FileSourceArgs {
68
+ /**
69
+ * Source file
70
+ */
71
+ file?: pulumi.Input<string>;
72
+ /**
73
+ * Source data
74
+ */
75
+ data?: pulumi.Input<string | Buffer>;
76
+ }
77
+
78
+ export interface FileArgs {
79
+ /**
80
+ * SSH connection details
81
+ */
82
+ connection: pulumi.Input<ConnectionArgs>;
83
+ /**
84
+ * Source
85
+ */
86
+ src: pulumi.Input<FileSourceArgs>;
87
+ /**
88
+ * Destination file
89
+ */
90
+ dst: pulumi.Input<string>;
91
+ /**
92
+ * Optional: Change token
93
+ */
94
+ changeToken?: pulumi.Input<string>;
95
+ }
96
+
97
+ interface ProviderInputs {
98
+ connection: ConnectionArgsInternal;
99
+ src: { file?: string; data?: string | Buffer };
100
+ dst: string;
101
+ changeToken?: string;
102
+ }
103
+
104
+ export class File extends pulumi.dynamic.Resource {
105
+ /**
106
+ * Create a new SSH file resource.
107
+ * @param name The name of the SSH file resource.
108
+ * @param args A bag of arguments to control the SSH file creation.
109
+ * @param opts A bag of options that control this resource's behavior.
110
+ */
111
+ constructor(name: string, args: FileArgs, opts?: pulumi.ComponentResourceOptions) {
112
+ const provider: pulumi.dynamic.ResourceProvider = {
113
+ async diff(id: pulumi.ID, olds: ProviderInputs, news: ProviderInputs): Promise<pulumi.dynamic.DiffResult> {
114
+ const replaces = [];
115
+
116
+ for (const [nKey, nValue] of Object.entries(news)) {
117
+ if (nKey === "__provider") {
118
+ continue;
119
+ }
120
+
121
+ let keyFound = false;
122
+
123
+ for (const [oKey, oValue] of Object.entries(olds)) {
124
+ if (oKey === "__provider") {
125
+ continue;
126
+ }
127
+
128
+ if (nKey === oKey) {
129
+ keyFound = true;
130
+
131
+ if (JSON.stringify(nValue) !== JSON.stringify(oValue)) {
132
+ replaces.push(nKey);
133
+ }
134
+ }
135
+ }
136
+
137
+ if (!keyFound) {
138
+ replaces.push(nKey);
139
+ }
140
+ }
141
+
142
+ return { changes: replaces.length > 0, replaces, deleteBeforeReplace: true };
143
+ },
144
+ async create(inputs: ProviderInputs): Promise<pulumi.dynamic.CreateResult> {
145
+ return sshFileCreate(inputs.connection, inputs.dst, inputs.src.file, inputs.src.data).then((r) => {
146
+ return {
147
+ id: require("uuid").v4(),
148
+ outs: inputs,
149
+ };
150
+ });
151
+ },
152
+ };
153
+
154
+ super(provider, name, args, opts);
155
+ }
156
+
157
+ public static changeToken(str: string): string {
158
+ return crypto.createHash("sha1").update(str, "utf8").digest("hex");
159
+ }
160
+
161
+ public static fileChangeToken(filename: string): string {
162
+ // eslint-disable-next-line security/detect-non-literal-fs-filename
163
+ return this.changeToken(fs.readFileSync(filename, "utf-8"));
164
+ }
165
+ }