krates 1.6.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.
Files changed (293) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +212 -0
  3. data/LOGO +10 -0
  4. data/VERSION +1 -0
  5. data/bin/krates +23 -0
  6. data/lib/kontena/autoload_core.rb +19 -0
  7. data/lib/kontena/callback.rb +60 -0
  8. data/lib/kontena/callbacks/.gitkeep +0 -0
  9. data/lib/kontena/callbacks/auth/01_list_and_select_grid_after_master_auth.rb +26 -0
  10. data/lib/kontena/callbacks/master/01_clear_current_master_after_terminate.rb +19 -0
  11. data/lib/kontena/callbacks/master/deploy/01_show_logo_before_deploy.rb +14 -0
  12. data/lib/kontena/callbacks/master/deploy/04_default_master_version.rb +18 -0
  13. data/lib/kontena/callbacks/master/deploy/05_before_deploy_configuration_wizard.rb +105 -0
  14. data/lib/kontena/callbacks/master/deploy/40_install_ssl_certificate_after_deploy.rb +32 -0
  15. data/lib/kontena/callbacks/master/deploy/50_authenticate_after_deploy.rb +66 -0
  16. data/lib/kontena/callbacks/master/deploy/55_create_initial_grid_after_deploy.rb +21 -0
  17. data/lib/kontena/callbacks/master/deploy/56_set_server_provider_after_deploy.rb +24 -0
  18. data/lib/kontena/callbacks/master/deploy/60_configure_auth_provider_after_deploy.rb +31 -0
  19. data/lib/kontena/callbacks/master/deploy/70_invite_self_after_deploy.rb +95 -0
  20. data/lib/kontena/callbacks/master/deploy/90_proptip_after_deploy.rb +33 -0
  21. data/lib/kontena/cli/browser_launcher.rb +61 -0
  22. data/lib/kontena/cli/bytes_helper.rb +40 -0
  23. data/lib/kontena/cli/certificate/authorize_command.rb +107 -0
  24. data/lib/kontena/cli/certificate/common.rb +16 -0
  25. data/lib/kontena/cli/certificate/domain_authorization/list_command.rb +24 -0
  26. data/lib/kontena/cli/certificate/domain_authorization/remove_authorization_command.rb +25 -0
  27. data/lib/kontena/cli/certificate/domain_authorize_command.rb +7 -0
  28. data/lib/kontena/cli/certificate/export_command.rb +28 -0
  29. data/lib/kontena/cli/certificate/get_command.rb +33 -0
  30. data/lib/kontena/cli/certificate/import_command.rb +61 -0
  31. data/lib/kontena/cli/certificate/list_command.rb +75 -0
  32. data/lib/kontena/cli/certificate/register_command.rb +30 -0
  33. data/lib/kontena/cli/certificate/remove_command.rb +23 -0
  34. data/lib/kontena/cli/certificate/request_command.rb +20 -0
  35. data/lib/kontena/cli/certificate/show_command.rb +22 -0
  36. data/lib/kontena/cli/certificate_command.rb +18 -0
  37. data/lib/kontena/cli/cloud/login_command.rb +186 -0
  38. data/lib/kontena/cli/cloud/logout_command.rb +14 -0
  39. data/lib/kontena/cli/cloud/master/add_command.rb +156 -0
  40. data/lib/kontena/cli/cloud/master/list_command.rb +35 -0
  41. data/lib/kontena/cli/cloud/master/remove_command.rb +68 -0
  42. data/lib/kontena/cli/cloud/master/show_command.rb +21 -0
  43. data/lib/kontena/cli/cloud/master/update_command.rb +52 -0
  44. data/lib/kontena/cli/cloud/master_command.rb +14 -0
  45. data/lib/kontena/cli/cloud_command.rb +13 -0
  46. data/lib/kontena/cli/common.rb +360 -0
  47. data/lib/kontena/cli/config.rb +662 -0
  48. data/lib/kontena/cli/container_command.rb +10 -0
  49. data/lib/kontena/cli/containers/exec_command.rb +31 -0
  50. data/lib/kontena/cli/containers/inspect_command.rb +16 -0
  51. data/lib/kontena/cli/containers/list_command.rb +51 -0
  52. data/lib/kontena/cli/containers/logs_command.rb +19 -0
  53. data/lib/kontena/cli/etcd/common.rb +8 -0
  54. data/lib/kontena/cli/etcd/get_command.rb +26 -0
  55. data/lib/kontena/cli/etcd/health_command.rb +53 -0
  56. data/lib/kontena/cli/etcd/list_command.rb +36 -0
  57. data/lib/kontena/cli/etcd/mkdir_command.rb +23 -0
  58. data/lib/kontena/cli/etcd/remove_command.rb +29 -0
  59. data/lib/kontena/cli/etcd/set_command.rb +24 -0
  60. data/lib/kontena/cli/etcd_command.rb +12 -0
  61. data/lib/kontena/cli/external_registries/add_command.rb +25 -0
  62. data/lib/kontena/cli/external_registries/list_command.rb +23 -0
  63. data/lib/kontena/cli/external_registries/remove_command.rb +17 -0
  64. data/lib/kontena/cli/external_registry_command.rb +9 -0
  65. data/lib/kontena/cli/grid_command.rb +21 -0
  66. data/lib/kontena/cli/grid_options.rb +12 -0
  67. data/lib/kontena/cli/grids/audit_log_command.rb +22 -0
  68. data/lib/kontena/cli/grids/cloud_config_command.rb +53 -0
  69. data/lib/kontena/cli/grids/common.rb +182 -0
  70. data/lib/kontena/cli/grids/create_command.rb +48 -0
  71. data/lib/kontena/cli/grids/current_command.rb +25 -0
  72. data/lib/kontena/cli/grids/env_command.rb +32 -0
  73. data/lib/kontena/cli/grids/events_command.rb +50 -0
  74. data/lib/kontena/cli/grids/health_command.rb +69 -0
  75. data/lib/kontena/cli/grids/list_command.rb +59 -0
  76. data/lib/kontena/cli/grids/logs_command.rb +35 -0
  77. data/lib/kontena/cli/grids/remove_command.rb +31 -0
  78. data/lib/kontena/cli/grids/show_command.rb +25 -0
  79. data/lib/kontena/cli/grids/trusted_subnet_command.rb +10 -0
  80. data/lib/kontena/cli/grids/trusted_subnets/add_command.rb +18 -0
  81. data/lib/kontena/cli/grids/trusted_subnets/list_command.rb +18 -0
  82. data/lib/kontena/cli/grids/trusted_subnets/remove_command.rb +26 -0
  83. data/lib/kontena/cli/grids/update_command.rb +35 -0
  84. data/lib/kontena/cli/grids/use_command.rb +26 -0
  85. data/lib/kontena/cli/grids/user_command.rb +9 -0
  86. data/lib/kontena/cli/grids/users/add_command.rb +18 -0
  87. data/lib/kontena/cli/grids/users/list_command.rb +20 -0
  88. data/lib/kontena/cli/grids/users/remove_command.rb +20 -0
  89. data/lib/kontena/cli/helpers/exec_helper.rb +209 -0
  90. data/lib/kontena/cli/helpers/health_helper.rb +65 -0
  91. data/lib/kontena/cli/helpers/log_helper.rb +113 -0
  92. data/lib/kontena/cli/helpers/time_helper.rb +29 -0
  93. data/lib/kontena/cli/localhost_web_server.rb +113 -0
  94. data/lib/kontena/cli/log_formatters/compact.rb +65 -0
  95. data/lib/kontena/cli/log_formatters/strip_color.rb +13 -0
  96. data/lib/kontena/cli/logout_command.rb +10 -0
  97. data/lib/kontena/cli/master/audit_log_command.rb +19 -0
  98. data/lib/kontena/cli/master/config/export_command.rb +46 -0
  99. data/lib/kontena/cli/master/config/get_command.rb +26 -0
  100. data/lib/kontena/cli/master/config/import_command.rb +67 -0
  101. data/lib/kontena/cli/master/config/set_command.rb +19 -0
  102. data/lib/kontena/cli/master/config/unset_command.rb +20 -0
  103. data/lib/kontena/cli/master/config_command.rb +17 -0
  104. data/lib/kontena/cli/master/create_command.rb +74 -0
  105. data/lib/kontena/cli/master/current_command.rb +25 -0
  106. data/lib/kontena/cli/master/init_cloud_command.rb +45 -0
  107. data/lib/kontena/cli/master/join_command.rb +22 -0
  108. data/lib/kontena/cli/master/list_command.rb +24 -0
  109. data/lib/kontena/cli/master/login_command.rb +331 -0
  110. data/lib/kontena/cli/master/logout_command.rb +25 -0
  111. data/lib/kontena/cli/master/remove_command.rb +55 -0
  112. data/lib/kontena/cli/master/ssh_command.rb +72 -0
  113. data/lib/kontena/cli/master/token/common.rb +29 -0
  114. data/lib/kontena/cli/master/token/create_command.rb +50 -0
  115. data/lib/kontena/cli/master/token/current_command.rb +45 -0
  116. data/lib/kontena/cli/master/token/list_command.rb +39 -0
  117. data/lib/kontena/cli/master/token/remove_command.rb +19 -0
  118. data/lib/kontena/cli/master/token/show_command.rb +34 -0
  119. data/lib/kontena/cli/master/token_command.rb +13 -0
  120. data/lib/kontena/cli/master/use_command.rb +31 -0
  121. data/lib/kontena/cli/master/user/invite_command.rb +51 -0
  122. data/lib/kontena/cli/master/user/list_command.rb +29 -0
  123. data/lib/kontena/cli/master/user/remove_command.rb +24 -0
  124. data/lib/kontena/cli/master/user/role/add_command.rb +29 -0
  125. data/lib/kontena/cli/master/user/role/remove_command.rb +27 -0
  126. data/lib/kontena/cli/master/user/role_command.rb +6 -0
  127. data/lib/kontena/cli/master/user_command.rb +9 -0
  128. data/lib/kontena/cli/master_command.rb +21 -0
  129. data/lib/kontena/cli/node_command.rb +17 -0
  130. data/lib/kontena/cli/nodes/create_command.rb +25 -0
  131. data/lib/kontena/cli/nodes/env_command.rb +37 -0
  132. data/lib/kontena/cli/nodes/health_command.rb +47 -0
  133. data/lib/kontena/cli/nodes/label_command.rb +10 -0
  134. data/lib/kontena/cli/nodes/labels/add_command.rb +18 -0
  135. data/lib/kontena/cli/nodes/labels/list_command.rb +19 -0
  136. data/lib/kontena/cli/nodes/labels/remove_command.rb +32 -0
  137. data/lib/kontena/cli/nodes/list_command.rb +97 -0
  138. data/lib/kontena/cli/nodes/remove_command.rb +34 -0
  139. data/lib/kontena/cli/nodes/reset_token_command.rb +34 -0
  140. data/lib/kontena/cli/nodes/show_command.rb +56 -0
  141. data/lib/kontena/cli/nodes/ssh_command.rb +63 -0
  142. data/lib/kontena/cli/nodes/update_command.rb +31 -0
  143. data/lib/kontena/cli/plugin_command.rb +12 -0
  144. data/lib/kontena/cli/plugins/common.rb +8 -0
  145. data/lib/kontena/cli/plugins/install_command.rb +42 -0
  146. data/lib/kontena/cli/plugins/list_command.rb +31 -0
  147. data/lib/kontena/cli/plugins/search_command.rb +25 -0
  148. data/lib/kontena/cli/plugins/show_command.rb +17 -0
  149. data/lib/kontena/cli/plugins/uninstall_command.rb +31 -0
  150. data/lib/kontena/cli/plugins/upgrade_command.rb +60 -0
  151. data/lib/kontena/cli/registry/create_command.rb +151 -0
  152. data/lib/kontena/cli/registry/remove_command.rb +21 -0
  153. data/lib/kontena/cli/registry_command.rb +8 -0
  154. data/lib/kontena/cli/service_command.rb +28 -0
  155. data/lib/kontena/cli/services/container_command.rb +8 -0
  156. data/lib/kontena/cli/services/containers_command.rb +39 -0
  157. data/lib/kontena/cli/services/create_command.rb +105 -0
  158. data/lib/kontena/cli/services/deploy_command.rb +25 -0
  159. data/lib/kontena/cli/services/env_command.rb +9 -0
  160. data/lib/kontena/cli/services/envs/add_command.rb +21 -0
  161. data/lib/kontena/cli/services/envs/list_command.rb +22 -0
  162. data/lib/kontena/cli/services/envs/remove_command.rb +22 -0
  163. data/lib/kontena/cli/services/events_command.rb +36 -0
  164. data/lib/kontena/cli/services/exec_command.rb +107 -0
  165. data/lib/kontena/cli/services/link_command.rb +35 -0
  166. data/lib/kontena/cli/services/list_command.rb +66 -0
  167. data/lib/kontena/cli/services/logs_command.rb +33 -0
  168. data/lib/kontena/cli/services/monitor_command.rb +58 -0
  169. data/lib/kontena/cli/services/remove_command.rb +60 -0
  170. data/lib/kontena/cli/services/restart_command.rb +19 -0
  171. data/lib/kontena/cli/services/scale_command.rb +21 -0
  172. data/lib/kontena/cli/services/secret_command.rb +8 -0
  173. data/lib/kontena/cli/services/secrets/link_command.rb +26 -0
  174. data/lib/kontena/cli/services/secrets/unlink_command.rb +28 -0
  175. data/lib/kontena/cli/services/services_helper.rb +579 -0
  176. data/lib/kontena/cli/services/show_command.rb +26 -0
  177. data/lib/kontena/cli/services/start_command.rb +21 -0
  178. data/lib/kontena/cli/services/stats_command.rb +87 -0
  179. data/lib/kontena/cli/services/stop_command.rb +21 -0
  180. data/lib/kontena/cli/services/unlink_command.rb +30 -0
  181. data/lib/kontena/cli/services/update_command.rb +94 -0
  182. data/lib/kontena/cli/spinner.rb +205 -0
  183. data/lib/kontena/cli/stack_command.rb +21 -0
  184. data/lib/kontena/cli/stacks/build_command.rb +125 -0
  185. data/lib/kontena/cli/stacks/common.rb +209 -0
  186. data/lib/kontena/cli/stacks/deploy_command.rb +37 -0
  187. data/lib/kontena/cli/stacks/events_command.rb +33 -0
  188. data/lib/kontena/cli/stacks/inspect_command.rb +17 -0
  189. data/lib/kontena/cli/stacks/install_command.rb +95 -0
  190. data/lib/kontena/cli/stacks/label_command.rb +10 -0
  191. data/lib/kontena/cli/stacks/labels/add_command.rb +21 -0
  192. data/lib/kontena/cli/stacks/labels/common.rb +19 -0
  193. data/lib/kontena/cli/stacks/labels/list_command.rb +21 -0
  194. data/lib/kontena/cli/stacks/labels/remove_command.rb +21 -0
  195. data/lib/kontena/cli/stacks/list_command.rb +154 -0
  196. data/lib/kontena/cli/stacks/logs_command.rb +35 -0
  197. data/lib/kontena/cli/stacks/monitor_command.rb +93 -0
  198. data/lib/kontena/cli/stacks/registry/create_command.rb +24 -0
  199. data/lib/kontena/cli/stacks/registry/make_private_command.rb +24 -0
  200. data/lib/kontena/cli/stacks/registry/make_public_command.rb +24 -0
  201. data/lib/kontena/cli/stacks/registry/pull_command.rb +28 -0
  202. data/lib/kontena/cli/stacks/registry/push_command.rb +40 -0
  203. data/lib/kontena/cli/stacks/registry/remove_command.rb +30 -0
  204. data/lib/kontena/cli/stacks/registry/search_command.rb +42 -0
  205. data/lib/kontena/cli/stacks/registry/show_command.rb +65 -0
  206. data/lib/kontena/cli/stacks/registry_command.rb +12 -0
  207. data/lib/kontena/cli/stacks/remove_command.rb +80 -0
  208. data/lib/kontena/cli/stacks/restart_command.rb +24 -0
  209. data/lib/kontena/cli/stacks/service_generator.rb +131 -0
  210. data/lib/kontena/cli/stacks/service_generator_v2.rb +27 -0
  211. data/lib/kontena/cli/stacks/show_command.rb +168 -0
  212. data/lib/kontena/cli/stacks/stack_name.rb +71 -0
  213. data/lib/kontena/cli/stacks/stacks_helper.rb +83 -0
  214. data/lib/kontena/cli/stacks/stop_command.rb +24 -0
  215. data/lib/kontena/cli/stacks/upgrade_command.rb +264 -0
  216. data/lib/kontena/cli/stacks/validate_command.rb +75 -0
  217. data/lib/kontena/cli/stacks/yaml/custom_validators/affinities_validator.rb +19 -0
  218. data/lib/kontena/cli/stacks/yaml/custom_validators/build_validator.rb +22 -0
  219. data/lib/kontena/cli/stacks/yaml/custom_validators/certificates_validator.rb +22 -0
  220. data/lib/kontena/cli/stacks/yaml/custom_validators/extends_validator.rb +22 -0
  221. data/lib/kontena/cli/stacks/yaml/custom_validators/hooks_validator.rb +102 -0
  222. data/lib/kontena/cli/stacks/yaml/custom_validators/secrets_validator.rb +22 -0
  223. data/lib/kontena/cli/stacks/yaml/opto/certificates_resolver.rb +37 -0
  224. data/lib/kontena/cli/stacks/yaml/opto/prompt_resolver.rb +78 -0
  225. data/lib/kontena/cli/stacks/yaml/opto/service_instances_resolver.rb +25 -0
  226. data/lib/kontena/cli/stacks/yaml/opto/service_link_resolver.rb +80 -0
  227. data/lib/kontena/cli/stacks/yaml/opto/vault_cert_prompt_resolver.rb +39 -0
  228. data/lib/kontena/cli/stacks/yaml/opto/vault_resolver.rb +13 -0
  229. data/lib/kontena/cli/stacks/yaml/opto/vault_setter.rb +12 -0
  230. data/lib/kontena/cli/stacks/yaml/opto.rb +16 -0
  231. data/lib/kontena/cli/stacks/yaml/reader.rb +525 -0
  232. data/lib/kontena/cli/stacks/yaml/service_extender.rb +65 -0
  233. data/lib/kontena/cli/stacks/yaml/stack_file_loader/file_loader.rb +41 -0
  234. data/lib/kontena/cli/stacks/yaml/stack_file_loader/registry_loader.rb +24 -0
  235. data/lib/kontena/cli/stacks/yaml/stack_file_loader/uri_loader.rb +23 -0
  236. data/lib/kontena/cli/stacks/yaml/stack_file_loader.rb +152 -0
  237. data/lib/kontena/cli/stacks/yaml/validations.rb +119 -0
  238. data/lib/kontena/cli/stacks/yaml/validator_v3.rb +164 -0
  239. data/lib/kontena/cli/subcommand_loader.rb +83 -0
  240. data/lib/kontena/cli/table_generator.rb +128 -0
  241. data/lib/kontena/cli/vault/export_command.rb +24 -0
  242. data/lib/kontena/cli/vault/import_command.rb +75 -0
  243. data/lib/kontena/cli/vault/list_command.rb +37 -0
  244. data/lib/kontena/cli/vault/read_command.rb +27 -0
  245. data/lib/kontena/cli/vault/remove_command.rb +23 -0
  246. data/lib/kontena/cli/vault/update_command.rb +24 -0
  247. data/lib/kontena/cli/vault/write_command.rb +23 -0
  248. data/lib/kontena/cli/vault_command.rb +13 -0
  249. data/lib/kontena/cli/version.rb +10 -0
  250. data/lib/kontena/cli/version_command.rb +20 -0
  251. data/lib/kontena/cli/volume_command.rb +9 -0
  252. data/lib/kontena/cli/volumes/create_command.rb +42 -0
  253. data/lib/kontena/cli/volumes/list_command.rb +29 -0
  254. data/lib/kontena/cli/volumes/remove_command.rb +29 -0
  255. data/lib/kontena/cli/volumes/show_command.rb +38 -0
  256. data/lib/kontena/cli/vpn/config_command.rb +27 -0
  257. data/lib/kontena/cli/vpn/create_command.rb +99 -0
  258. data/lib/kontena/cli/vpn/remove_command.rb +22 -0
  259. data/lib/kontena/cli/vpn_command.rb +9 -0
  260. data/lib/kontena/cli/whoami_command.rb +38 -0
  261. data/lib/kontena/client.rb +574 -0
  262. data/lib/kontena/command.rb +251 -0
  263. data/lib/kontena/debug_instrumentor.rb +80 -0
  264. data/lib/kontena/errors.rb +50 -0
  265. data/lib/kontena/light_prompt.rb +103 -0
  266. data/lib/kontena/machine/cert_helper.rb +43 -0
  267. data/lib/kontena/machine/cloud_config/cloudinit.yml +82 -0
  268. data/lib/kontena/machine/cloud_config/node_generator.rb +28 -0
  269. data/lib/kontena/machine/common.rb +17 -0
  270. data/lib/kontena/machine/random_name.rb +42 -0
  271. data/lib/kontena/main_command.rb +66 -0
  272. data/lib/kontena/plugin_manager/cleaner.rb +33 -0
  273. data/lib/kontena/plugin_manager/common.rb +89 -0
  274. data/lib/kontena/plugin_manager/installer.rb +78 -0
  275. data/lib/kontena/plugin_manager/loader.rb +93 -0
  276. data/lib/kontena/plugin_manager/rubygems_client.rb +59 -0
  277. data/lib/kontena/plugin_manager/uninstaller.rb +34 -0
  278. data/lib/kontena/plugin_manager.rb +26 -0
  279. data/lib/kontena/presets/github_auth_provider.yml +11 -0
  280. data/lib/kontena/presets/kontena_auth_provider.yml +11 -0
  281. data/lib/kontena/scripts/completer +9 -0
  282. data/lib/kontena/scripts/completer.rb +334 -0
  283. data/lib/kontena/scripts/init +18 -0
  284. data/lib/kontena/scripts/kontena.zsh +11 -0
  285. data/lib/kontena/scripts/krates.bash +8 -0
  286. data/lib/kontena/stacks/change_resolver.rb +118 -0
  287. data/lib/kontena/stacks/stack_data.rb +58 -0
  288. data/lib/kontena/stacks/stack_data_set.rb +51 -0
  289. data/lib/kontena/stacks_cache.rb +110 -0
  290. data/lib/kontena/stacks_client.rb +177 -0
  291. data/lib/kontena/util.rb +116 -0
  292. data/lib/kontena_cli.rb +190 -0
  293. metadata +518 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8e8bc171d1c93bb0ec08f8595999cb5761ff3d2185dc21f326e3fd9c51f929d0
4
+ data.tar.gz: 1884955e83397cfe4674e8bf1d8441e4adbf9c6242575e040cdb23cff6b81366
5
+ SHA512:
6
+ metadata.gz: 4cd007b5ed4aed94d0ab348c158b50595d07253e4ecd05a0bf62d21e48b81eaec4dc6fb51f66e4788d8a9405b124b89a622d74fdaa60e7575b14f450aefdcccc
7
+ data.tar.gz: 0b1975eb8b6051f7c244ca3463e8896253cda64c35197e9a890fb8b9f86d57a9c238fecf5a5d9d34a239ff512788117106c25eb0d28ae5b8df9550db6c349fba
data/LICENSE ADDED
@@ -0,0 +1,212 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Pavel Tsurbeleu
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ Apache License
24
+ Version 2.0, January 2004
25
+ http://www.apache.org/licenses/
26
+
27
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
28
+
29
+ 1. Definitions.
30
+
31
+ "License" shall mean the terms and conditions for use, reproduction,
32
+ and distribution as defined by Sections 1 through 9 of this document.
33
+
34
+ "Licensor" shall mean the copyright owner or entity authorized by
35
+ the copyright owner that is granting the License.
36
+
37
+ "Legal Entity" shall mean the union of the acting entity and all
38
+ other entities that control, are controlled by, or are under common
39
+ control with that entity. For the purposes of this definition,
40
+ "control" means (i) the power, direct or indirect, to cause the
41
+ direction or management of such entity, whether by contract or
42
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
43
+ outstanding shares, or (iii) beneficial ownership of such entity.
44
+
45
+ "You" (or "Your") shall mean an individual or Legal Entity
46
+ exercising permissions granted by this License.
47
+
48
+ "Source" form shall mean the preferred form for making modifications,
49
+ including but not limited to software source code, documentation
50
+ source, and configuration files.
51
+
52
+ "Object" form shall mean any form resulting from mechanical
53
+ transformation or translation of a Source form, including but
54
+ not limited to compiled object code, generated documentation,
55
+ and conversions to other media types.
56
+
57
+ "Work" shall mean the work of authorship, whether in Source or
58
+ Object form, made available under the License, as indicated by a
59
+ copyright notice that is included in or attached to the work
60
+ (an example is provided in the Appendix below).
61
+
62
+ "Derivative Works" shall mean any work, whether in Source or Object
63
+ form, that is based on (or derived from) the Work and for which the
64
+ editorial revisions, annotations, elaborations, or other modifications
65
+ represent, as a whole, an original work of authorship. For the purposes
66
+ of this License, Derivative Works shall not include works that remain
67
+ separable from, or merely link (or bind by name) to the interfaces of,
68
+ the Work and Derivative Works thereof.
69
+
70
+ "Contribution" shall mean any work of authorship, including
71
+ the original version of the Work and any modifications or additions
72
+ to that Work or Derivative Works thereof, that is intentionally
73
+ submitted to Licensor for inclusion in the Work by the copyright owner
74
+ or by an individual or Legal Entity authorized to submit on behalf of
75
+ the copyright owner. For the purposes of this definition, "submitted"
76
+ means any form of electronic, verbal, or written communication sent
77
+ to the Licensor or its representatives, including but not limited to
78
+ communication on electronic mailing lists, source code control systems,
79
+ and issue tracking systems that are managed by, or on behalf of, the
80
+ Licensor for the purpose of discussing and improving the Work, but
81
+ excluding communication that is conspicuously marked or otherwise
82
+ designated in writing by the copyright owner as "Not a Contribution."
83
+
84
+ "Contributor" shall mean Licensor and any individual or Legal Entity
85
+ on behalf of whom a Contribution has been received by Licensor and
86
+ subsequently incorporated within the Work.
87
+
88
+ 2. Grant of Copyright License. Subject to the terms and conditions of
89
+ this License, each Contributor hereby grants to You a perpetual,
90
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
91
+ copyright license to reproduce, prepare Derivative Works of,
92
+ publicly display, publicly perform, sublicense, and distribute the
93
+ Work and such Derivative Works in Source or Object form.
94
+
95
+ 3. Grant of Patent License. Subject to the terms and conditions of
96
+ this License, each Contributor hereby grants to You a perpetual,
97
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
98
+ (except as stated in this section) patent license to make, have made,
99
+ use, offer to sell, sell, import, and otherwise transfer the Work,
100
+ where such license applies only to those patent claims licensable
101
+ by such Contributor that are necessarily infringed by their
102
+ Contribution(s) alone or by combination of their Contribution(s)
103
+ with the Work to which such Contribution(s) was submitted. If You
104
+ institute patent litigation against any entity (including a
105
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
106
+ or a Contribution incorporated within the Work constitutes direct
107
+ or contributory patent infringement, then any patent licenses
108
+ granted to You under this License for that Work shall terminate
109
+ as of the date such litigation is filed.
110
+
111
+ 4. Redistribution. You may reproduce and distribute copies of the
112
+ Work or Derivative Works thereof in any medium, with or without
113
+ modifications, and in Source or Object form, provided that You
114
+ meet the following conditions:
115
+
116
+ (a) You must give any other recipients of the Work or
117
+ Derivative Works a copy of this License; and
118
+
119
+ (b) You must cause any modified files to carry prominent notices
120
+ stating that You changed the files; and
121
+
122
+ (c) You must retain, in the Source form of any Derivative Works
123
+ that You distribute, all copyright, patent, trademark, and
124
+ attribution notices from the Source form of the Work,
125
+ excluding those notices that do not pertain to any part of
126
+ the Derivative Works; and
127
+
128
+ (d) If the Work includes a "NOTICE" text file as part of its
129
+ distribution, then any Derivative Works that You distribute must
130
+ include a readable copy of the attribution notices contained
131
+ within such NOTICE file, excluding those notices that do not
132
+ pertain to any part of the Derivative Works, in at least one
133
+ of the following places: within a NOTICE text file distributed
134
+ as part of the Derivative Works; within the Source form or
135
+ documentation, if provided along with the Derivative Works; or,
136
+ within a display generated by the Derivative Works, if and
137
+ wherever such third-party notices normally appear. The contents
138
+ of the NOTICE file are for informational purposes only and
139
+ do not modify the License. You may add Your own attribution
140
+ notices within Derivative Works that You distribute, alongside
141
+ or as an addendum to the NOTICE text from the Work, provided
142
+ that such additional attribution notices cannot be construed
143
+ as modifying the License.
144
+
145
+ You may add Your own copyright statement to Your modifications and
146
+ may provide additional or different license terms and conditions
147
+ for use, reproduction, or distribution of Your modifications, or
148
+ for any such Derivative Works as a whole, provided Your use,
149
+ reproduction, and distribution of the Work otherwise complies with
150
+ the conditions stated in this License.
151
+
152
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
153
+ any Contribution intentionally submitted for inclusion in the Work
154
+ by You to the Licensor shall be under the terms and conditions of
155
+ this License, without any additional terms or conditions.
156
+ Notwithstanding the above, nothing herein shall supersede or modify
157
+ the terms of any separate license agreement you may have executed
158
+ with Licensor regarding such Contributions.
159
+
160
+ 6. Trademarks. This License does not grant permission to use the trade
161
+ names, trademarks, service marks, or product names of the Licensor,
162
+ except as required for reasonable and customary use in describing the
163
+ origin of the Work and reproducing the content of the NOTICE file.
164
+
165
+ 7. Disclaimer of Warranty. Unless required by applicable law or
166
+ agreed to in writing, Licensor provides the Work (and each
167
+ Contributor provides its Contributions) on an "AS IS" BASIS,
168
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
169
+ implied, including, without limitation, any warranties or conditions
170
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
171
+ PARTICULAR PURPOSE. You are solely responsible for determining the
172
+ appropriateness of using or redistributing the Work and assume any
173
+ risks associated with Your exercise of permissions under this License.
174
+
175
+ 8. Limitation of Liability. In no event and under no legal theory,
176
+ whether in tort (including negligence), contract, or otherwise,
177
+ unless required by applicable law (such as deliberate and grossly
178
+ negligent acts) or agreed to in writing, shall any Contributor be
179
+ liable to You for damages, including any direct, indirect, special,
180
+ incidental, or consequential damages of any character arising as a
181
+ result of this License or out of the use or inability to use the
182
+ Work (including but not limited to damages for loss of goodwill,
183
+ work stoppage, computer failure or malfunction, or any and all
184
+ other commercial damages or losses), even if such Contributor
185
+ has been advised of the possibility of such damages.
186
+
187
+ 9. Accepting Warranty or Additional Liability. While redistributing
188
+ the Work or Derivative Works thereof, You may choose to offer,
189
+ and charge a fee for, acceptance of support, warranty, indemnity,
190
+ or other liability obligations and/or rights consistent with this
191
+ License. However, in accepting such obligations, You may act only
192
+ on Your own behalf and on Your sole responsibility, not on behalf
193
+ of any other Contributor, and only if You agree to indemnify,
194
+ defend, and hold each Contributor harmless for any liability
195
+ incurred by, or claims asserted against, such Contributor by reason
196
+ of your accepting any such warranty or additional liability.
197
+
198
+ END OF TERMS AND CONDITIONS
199
+
200
+ Copyright 2015 Kontena, Inc.
201
+
202
+ Licensed under the Apache License, Version 2.0 (the "License");
203
+ you may not use this file except in compliance with the License.
204
+ You may obtain a copy of the License at
205
+
206
+ http://www.apache.org/licenses/LICENSE-2.0
207
+
208
+ Unless required by applicable law or agreed to in writing, software
209
+ distributed under the License is distributed on an "AS IS" BASIS,
210
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
211
+ See the License for the specific language governing permissions and
212
+ limitations under the License.
data/LOGO ADDED
@@ -0,0 +1,10 @@
1
+ ___ __ ________ ________ _________ _______ ________
2
+ |\ \|\ \ |\ __ \|\ __ \|\___ ___\\ ___ \ |\ ____\
3
+ \ \ \/ /|\ \ \|\ \ \ \|\ \|___ \ \_\ \ __/|\ \ \___|_
4
+ \ \ ___ \ \ _ _\ \ __ \ \ \ \ \ \ \_|/_\ \_____ \
5
+ \ \ \\ \ \ \ \\ \\ \ \ \ \ \ \ \ \ \ \_|\ \|____|\ \
6
+ \ \__\\ \__\ \__\\ _\\ \__\ \__\ \ \__\ \ \_______\____\_\ \
7
+ \|__| \|__|\|__|\|__|\|__|\|__| \|__| \|_______|\_________\
8
+ \|_________|
9
+ -------------------------------------------------------------------
10
+ Krates (c) 2019 Pavel Tsurbeleu
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.6.0
data/bin/krates ADDED
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: UTF-8
3
+
4
+ # add lib to libpath (only needed when running from the sources)
5
+ require 'pathname'
6
+ lib_path = File.expand_path('../../lib', Pathname.new(__FILE__).realpath)
7
+ $:.unshift lib_path unless $:.include?(lib_path)
8
+
9
+ STDOUT.sync = true
10
+
11
+ if ARGV[0] == 'complete'
12
+ ARGV.delete_at(0)
13
+ $VERSION_WARNING_ADDED=true
14
+ require 'kontena/scripts/completer'
15
+ else
16
+
17
+ arg_end_idx = ARGV.index('--') || ARGV.size
18
+ ENV['DEBUG'] = "true" if ARGV[0..arg_end_idx].any? { |arg| arg == '-D' || arg == '--debug'}
19
+ ENV['DEBUG'] = "false" if ARGV[0..arg_end_idx].any? { |arg| arg == '--no-debug' }
20
+ require 'kontena_cli'
21
+ Kontena::PluginManager.init unless ENV['NO_PLUGINS']
22
+ Kontena::MainCommand.run
23
+ end
@@ -0,0 +1,19 @@
1
+ # stdlib
2
+ autoload :JSON, 'json'
3
+ autoload :YAML, 'yaml'
4
+ autoload :URI, 'uri'
5
+ autoload :Logger, 'logger'
6
+ autoload :FileUtils, 'fileutils'
7
+ autoload :Forwardable, 'forwardable'
8
+ autoload :Singleton, 'singleton'
9
+ autoload :Observable, 'observer'
10
+ autoload :Pathname, 'pathname'
11
+ autoload :DateTime, 'date'
12
+ autoload :Date, 'date'
13
+ autoload :Base64, 'base64'
14
+ autoload :SecureRandom, 'securerandom'
15
+ autoload :StringIO, 'stringio'
16
+
17
+ # dependencies
18
+ autoload :Excon, 'excon'
19
+ autoload :Opto, 'opto'
@@ -0,0 +1,60 @@
1
+ class Kontena::Callback
2
+
3
+ attr_reader :command
4
+
5
+ def initialize(command)
6
+ @command = command
7
+ end
8
+
9
+ # Register callback for command types it is supposed to run with.
10
+ def self.matches_commands(*commands)
11
+ cmd_types = {}
12
+
13
+ commands.each do |cmd|
14
+ cmd_class, cmd_type = cmd.split(' ', 2)
15
+
16
+ if cmd_class == '*'
17
+ cmd_class = :all
18
+ end
19
+
20
+ if cmd_type.nil? || cmd_type == '*'
21
+ cmd_type = :all
22
+ else
23
+ cmd_type = cmd_type.to_sym
24
+ end
25
+ cmd_types[cmd_class.to_sym] ||= []
26
+ cmd_types[cmd_class.to_sym] << cmd_type
27
+ end
28
+
29
+ # Finally it should be normalized into a hash that looks like :cmd_class => :cmd_type, :app => :init, :grid => :all
30
+ cmd_types.each do |cmd_class, cmd_types|
31
+ cmd_types.each do |cmd_type|
32
+ Kontena::Callback.callbacks[cmd_class] ||= {}
33
+ Kontena::Callback.callbacks[cmd_class][cmd_type] ||= []
34
+ Kontena::Callback.callbacks[cmd_class][cmd_type] << self
35
+ end
36
+ end
37
+ end
38
+
39
+ def self.callbacks
40
+ @@callbacks ||= {}
41
+ end
42
+
43
+ def self.run_callbacks(cmd_type, state, obj)
44
+ [cmd_type.last, :all].compact.uniq.each do |cmdtype|
45
+ [cmd_type.first, :all].compact.uniq.each do |cmdclass|
46
+ callbacks.fetch(cmdclass, {}).fetch(cmdtype, []).each do |klass|
47
+ if klass.instance_methods.include?(state)
48
+ cb = klass.new(obj)
49
+ if cb.send(state).kind_of?(FalseClass)
50
+ Kontena.logger.debug { "Execution aborted by #{klass}" }
51
+ exit 1
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
59
+
60
+ Dir[File.expand_path('../callbacks/**/*.rb', __FILE__)].sort_by{ |file| File.basename(file) }.each { |file| require file }
File without changes
@@ -0,0 +1,26 @@
1
+ module Kontena
2
+ module Callbacks
3
+ class ListAndSelectGrid < Kontena::Callback
4
+
5
+ matches_commands 'master login'
6
+
7
+ def after_load
8
+ command.class_eval do
9
+ option ['--skip-grid-auto-select'], :flag, 'Do not auto select grid'
10
+ end
11
+ end
12
+
13
+ # Runs kontena grids list --use which will auto join the first available
14
+ # grid
15
+ def after
16
+ extend Kontena::Cli::Common
17
+ return if command.skip_grid_auto_select?
18
+ return unless current_master
19
+ return unless command.exit_code == 0
20
+ return unless current_master.grid.nil?
21
+
22
+ Kontena.run(%w(grid list --use --verbose))
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,19 @@
1
+ module Kontena
2
+ module Callbacks
3
+ class ClearCurrentMasterAfterTerminate < Kontena::Callback
4
+
5
+ matches_commands 'master terminate'
6
+
7
+ def after
8
+ extend Kontena::Cli::Common
9
+ return unless command.exit_code == 0
10
+ return unless config.current_master
11
+
12
+ logger.debug { "Removing current master from config" }
13
+ config.servers.delete_at(config.find_server_index(config.current_master.name))
14
+ config.current_server = nil
15
+ config.write
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,14 @@
1
+ module Kontena
2
+ module Callbacks
3
+ class DisplayLogoBeforeMasterDeploy < Kontena::Callback
4
+
5
+ matches_commands 'master create'
6
+
7
+ def before
8
+ extend Kontena::Cli::Common
9
+ display_logo
10
+ end
11
+ end
12
+ end
13
+ end
14
+
@@ -0,0 +1,18 @@
1
+ module Kontena
2
+ module Callbacks
3
+ class DefaultMasterVersion < Kontena::Callback
4
+
5
+ matches_commands 'master create'
6
+
7
+ def after_load
8
+ # Only run this for prerelease cli
9
+ return unless Kontena::Cli::VERSION =~ /\d\.(?:pre|rc|beta|edge)/
10
+ version_switch = command.recognised_options.find {|opt| opt.switches.include?('--version')}
11
+ if version_switch
12
+ version_switch.instance_variable_set(:@default_value, 'edge')
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+
@@ -0,0 +1,105 @@
1
+ module Kontena
2
+ module Callbacks
3
+ class BeforeDeployConfigurationWizard < Kontena::Callback
4
+
5
+ matches_commands 'master create'
6
+
7
+ def after_load
8
+ extend Kontena::Cli::Common
9
+
10
+ command.class_eval do
11
+ option ['--no-prompt'], :flag, "Don't ask questions"
12
+ option ['--skip-auth-provider'], :flag, "Skip auth provider configuration (single user mode)"
13
+ option ['--use-kontena-cloud'], :flag, "Use Kontena Cloud as authentication provider"
14
+ option ['--cloud-master-id'], '[ID]', "Use Kontena Cloud Master ID for auth provider configuration"
15
+ end
16
+ end
17
+
18
+ def unless_param(param, &block)
19
+ return if command.respond_to?(param) && !command.send(param).nil?
20
+ return if command.respond_to?("#{param}?".to_sym) && command.send("#{param}?".to_sym)
21
+ yield
22
+ end
23
+
24
+ # Scans config server names and returns default-2 if default exists,
25
+ # default-3 if default-2 exists, etc.
26
+ def next_default_name
27
+ last_default = config.servers.map(&:name).select{ |n| n =~ /kontena\-master(?:\-\d+)?$/ }.sort.last
28
+ return "kontena-master" unless last_default
29
+ unless last_default =~ /\d$/
30
+ last_default << "-1"
31
+ end
32
+ last_default.succ
33
+ end
34
+
35
+ def login_to_kontena
36
+ if cloud_auth?
37
+ return true if cloud_client.authentication_ok?(kontena_account.userinfo_endpoint)
38
+ end
39
+ puts
40
+ puts "You don't seem to be logged in to Kontena Cloud"
41
+ puts
42
+ Kontena.run!(%w(cloud login --verbose))
43
+ config.reset_instance
44
+ reset_cloud_client
45
+ result = false
46
+ Retriable.retriable do
47
+ result = cloud_client.authentication_ok?(kontena_account.userinfo_endpoint)
48
+ end
49
+ result
50
+ end
51
+
52
+ def before
53
+ extend Kontena::Cli::Common
54
+ unless_param(:name) do
55
+ if command.cloud_master_id
56
+ response = spinner "Receiving Master information from Kontena Cloud" do
57
+ cloud_client.get("user/masters/#{command.cloud_master_id}")
58
+ end
59
+ if response.kind_of?(Hash) && response.has_key?('data')
60
+ command.name = response['data']['attributes']['name']
61
+ else
62
+ exit_with_error "Unable to receive Master information using id"
63
+ end
64
+ elsif command.no_prompt?
65
+ command.name = next_default_name
66
+ else
67
+ command.name = prompt.ask("Enter a name for this Kontena Master: ", default: next_default_name, required: true) do |q|
68
+ q.validate /^[a-z0-9\_\-\.]+$/, 'Name should only include lower case letters, numbers and -._, example: "master-4"'
69
+ end
70
+ end
71
+ end
72
+
73
+ unless_param(:skip_auth_provider) do
74
+ unless command.no_prompt? || command.use_kontena_cloud? || command.cloud_master_id
75
+ answer = prompt.select("Select OAuth2 authentication provider: ") do |menu|
76
+ menu.choice 'Kontena Cloud (recommended)', :kontena_new
77
+ menu.choice 'Custom', :custom
78
+ menu.choice 'None (single user mode)', :none
79
+ end
80
+ case answer
81
+ when :kontena_new
82
+ login_to_kontena || abort('You must login to Kontena Cloud')
83
+ command.skip_auth_provider = false
84
+ when :custom
85
+ puts
86
+ puts 'Learn how to configure custom user authentication provider after installation at: www.kontena.io/docs/advanced/authentication'
87
+ puts
88
+ command.cloud_master_id = nil
89
+ command.skip_auth_provider = true
90
+ when :none
91
+ puts
92
+ puts "You have selected to use Kontena Master in single user mode. You can configure an authentication provider later. For more information, see here: www.kontena.io/docs/advanced/authentication"
93
+ puts
94
+ command.cloud_master_id = nil
95
+ command.skip_auth_provider = true
96
+ else
97
+ abort 'Should never be here'
98
+ end
99
+ end
100
+ end
101
+ true
102
+ end
103
+ end
104
+ end
105
+ end
@@ -0,0 +1,32 @@
1
+ module Kontena
2
+ module Callbacks
3
+ class InstallSslCertificateAfterDeploy < Kontena::Callback
4
+
5
+ matches_commands 'master create'
6
+
7
+ def after
8
+ extend Kontena::Cli::Common
9
+
10
+ return unless command.exit_code == 0
11
+ return unless command.result.kind_of?(Hash)
12
+ return unless command.result.has_key?(:ssl_certificate)
13
+ return unless command.result.has_key?(:public_ip)
14
+
15
+ cert_dir = File.join(Dir.home, '.kontena/certs')
16
+ unless File.directory?(cert_dir)
17
+ require 'fileutils'
18
+ FileUtils.mkdir_p(cert_dir)
19
+ end
20
+
21
+ cert_file = File.join(cert_dir, "#{command.result[:public_ip]}.pem")
22
+
23
+ spinner "Installing SSL certificate to #{cert_file}" do
24
+ File.unlink(cert_file) if File.exist?(cert_file)
25
+ File.write(cert_file, command.result[:ssl_certificate])
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+
32
+
@@ -0,0 +1,66 @@
1
+ module Kontena
2
+ module Callbacks
3
+ class AuthenticateAfterDeploy < Kontena::Callback
4
+
5
+ matches_commands 'master create'
6
+
7
+ def after
8
+ extend Kontena::Cli::Common
9
+
10
+ require 'securerandom'
11
+ extend Kontena::Cli::Common
12
+ logger.debug { "Command result: #{command.result.inspect}" }
13
+ logger.debug { "Command exit code: #{command.exit_code.inspect}" }
14
+ return unless command.exit_code == 0
15
+ return unless command.result.kind_of?(Hash)
16
+ return unless command.result.has_key?(:public_ip)
17
+ return unless command.result.has_key?(:code)
18
+ return unless command.result.has_key?(:name)
19
+
20
+ # If plugins generate self-signed cert, most of the upcoming callbacks will
21
+ # fail without this. This can be made bit more clever once all the plugins
22
+ # return the generated self-signed certificate.
23
+ ENV['SSL_IGNORE_ERRORS'] = 'true'
24
+
25
+ # In case there already is a server with the same name add random characters to name
26
+ if config.find_server(command.result[:name])
27
+ command.result[:name] = "#{command.result[:name]}-#{SecureRandom.hex(2)}"
28
+ end
29
+
30
+ new_master = Kontena::Cli::Config::Server.new(
31
+ url: "https://#{command.result[:public_ip]}",
32
+ name: command.result[:name]
33
+ )
34
+
35
+ retried = false
36
+
37
+ # Figure out if HTTPS works, if not, try HTTP
38
+ begin
39
+ logger.debug { "Trying to request / from #{new_master.url}" }
40
+ client = Kontena::Client.new(new_master.url, nil, ignore_ssl_errors: true)
41
+ client.get('/')
42
+ rescue => ex
43
+ logger.debug { "HTTPS test failed: #{ex.class.name} #{ex.message}" }
44
+ unless retried
45
+ new_master.url = "http://#{command.result[:public_ip]}"
46
+ retried = true
47
+ retry
48
+ end
49
+ return
50
+ end
51
+
52
+ require 'shellwords'
53
+ cmd = [
54
+ 'master', 'login', '--no-login-info' ,'--skip-grid-auto-select', '--verbose',
55
+ '--name', command.result[:name],
56
+ '--code', command.result[:code],
57
+ new_master.url
58
+ ]
59
+ Retriable.retriable do
60
+ logger.debug { "Running: #{cmd}" }
61
+ Kontena.run!(cmd)
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,21 @@
1
+ module Kontena
2
+ module Callbacks
3
+ class CreateInitialGridAfterDeploy < Kontena::Callback
4
+
5
+ matches_commands 'master create'
6
+
7
+ def after
8
+ extend Kontena::Cli::Common
9
+
10
+ return unless command.exit_code == 0
11
+ return unless config.current_master
12
+ return unless config.current_master.name == command.result[:name]
13
+
14
+ cmd = %w(grid create --silent test)
15
+ Retriable.retriable do
16
+ Kontena.run!(cmd)
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end