kubes 0.1.0 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (384) hide show
  1. checksums.yaml +5 -5
  2. data/.dockerignore +4 -0
  3. data/.gitignore +15 -7
  4. data/.rspec +3 -0
  5. data/CHANGELOG.md +22 -0
  6. data/Dockerfile +14 -0
  7. data/Gemfile +3 -1
  8. data/Guardfile +19 -0
  9. data/LICENSE.txt +201 -0
  10. data/README.md +46 -18
  11. data/Rakefile +13 -1
  12. data/docs/.gitignore +5 -0
  13. data/docs/CNAME +1 -0
  14. data/docs/Gemfile +16 -0
  15. data/docs/LICENSE +201 -0
  16. data/docs/Procfile +2 -0
  17. data/docs/README.md +24 -0
  18. data/docs/Rakefile +38 -0
  19. data/docs/_config.yml +71 -0
  20. data/docs/_docs/auto-context.md +47 -0
  21. data/docs/_docs/ci/cloudbuild.md +69 -0
  22. data/docs/_docs/config.md +9 -0
  23. data/docs/_docs/config/docker.md +70 -0
  24. data/docs/_docs/config/env.md +58 -0
  25. data/docs/_docs/config/kubectl.md +61 -0
  26. data/docs/_docs/contributing.md +98 -0
  27. data/docs/_docs/dsl.md +66 -0
  28. data/docs/_docs/dsl/multiple-resources.md +114 -0
  29. data/docs/_docs/dsl/resources.md +12 -0
  30. data/docs/_docs/dsl/resources/backend_config.md +45 -0
  31. data/docs/_docs/dsl/resources/config_map.md +84 -0
  32. data/docs/_docs/dsl/resources/daemon_set.md +58 -0
  33. data/docs/_docs/dsl/resources/deployment.md +137 -0
  34. data/docs/_docs/dsl/resources/generic.md +58 -0
  35. data/docs/_docs/dsl/resources/ingress.md +103 -0
  36. data/docs/_docs/dsl/resources/managed_certificate.md +39 -0
  37. data/docs/_docs/dsl/resources/namespace.md +34 -0
  38. data/docs/_docs/dsl/resources/network_policy.md +111 -0
  39. data/docs/_docs/dsl/resources/pod.md +82 -0
  40. data/docs/_docs/dsl/resources/role.md +44 -0
  41. data/docs/_docs/dsl/resources/role_binding.md +55 -0
  42. data/docs/_docs/dsl/resources/secret.md +87 -0
  43. data/docs/_docs/dsl/resources/service.md +60 -0
  44. data/docs/_docs/dsl/resources/service_account.md +37 -0
  45. data/docs/_docs/extra-env.md +23 -0
  46. data/docs/_docs/extra-env/dsl.md +86 -0
  47. data/docs/_docs/extra-env/yaml.md +67 -0
  48. data/docs/_docs/helpers.md +19 -0
  49. data/docs/_docs/intro.md +15 -0
  50. data/docs/_docs/intro/concepts.md +37 -0
  51. data/docs/_docs/intro/how-kubes-works.md +29 -0
  52. data/docs/_docs/intro/install.md +6 -0
  53. data/docs/_docs/intro/ordering.md +63 -0
  54. data/docs/_docs/intro/ordering/custom.md +25 -0
  55. data/docs/_docs/intro/structure.md +43 -0
  56. data/docs/_docs/kustomize.md +54 -0
  57. data/docs/_docs/layering.md +8 -0
  58. data/docs/_docs/layering/dsl.md +5 -0
  59. data/docs/_docs/layering/merge.md +96 -0
  60. data/docs/_docs/layering/yaml.md +5 -0
  61. data/docs/_docs/learn/dsl.md +5 -0
  62. data/docs/_docs/learn/dsl/change.md +16 -0
  63. data/docs/_docs/learn/dsl/cluster.md +5 -0
  64. data/docs/_docs/learn/dsl/delete.md +32 -0
  65. data/docs/_docs/learn/dsl/deploy.md +66 -0
  66. data/docs/_docs/learn/dsl/install.md +5 -0
  67. data/docs/_docs/learn/dsl/new-project.md +34 -0
  68. data/docs/_docs/learn/dsl/next-steps.md +5 -0
  69. data/docs/_docs/learn/dsl/review-project.md +63 -0
  70. data/docs/_docs/learn/dsl/update.md +53 -0
  71. data/docs/_docs/learn/yaml.md +5 -0
  72. data/docs/_docs/learn/yaml/change.md +17 -0
  73. data/docs/_docs/learn/yaml/cluster.md +5 -0
  74. data/docs/_docs/learn/yaml/delete.md +32 -0
  75. data/docs/_docs/learn/yaml/deploy.md +67 -0
  76. data/docs/_docs/learn/yaml/install.md +5 -0
  77. data/docs/_docs/learn/yaml/new-project.md +37 -0
  78. data/docs/_docs/learn/yaml/next-steps.md +5 -0
  79. data/docs/_docs/learn/yaml/review-project.md +108 -0
  80. data/docs/_docs/learn/yaml/update.md +54 -0
  81. data/docs/_docs/next-steps.md +13 -0
  82. data/docs/_docs/patterns.md +7 -0
  83. data/docs/_docs/patterns/clock-web-worker.md +71 -0
  84. data/docs/_docs/resources.md +11 -0
  85. data/docs/_docs/resources/base.md +33 -0
  86. data/docs/_docs/resources/role.md +41 -0
  87. data/docs/_docs/resources/shared.md +36 -0
  88. data/docs/_docs/yaml.md +41 -0
  89. data/docs/_includes/commands.html +131 -0
  90. data/docs/_includes/content.html +25 -0
  91. data/docs/_includes/dsl/methods.md +1 -0
  92. data/docs/_includes/dsl/rolling_deployment.md +1 -0
  93. data/docs/_includes/dsl/suffix_hash.md +8 -0
  94. data/docs/_includes/example.html +12 -0
  95. data/docs/_includes/footer.html +37 -0
  96. data/docs/_includes/google_analytics.html +10 -0
  97. data/docs/_includes/header.html +31 -0
  98. data/docs/_includes/intro/install.md +15 -0
  99. data/docs/_includes/js.html +3 -0
  100. data/docs/_includes/kubes-steps.md +3 -0
  101. data/docs/_includes/layering/layers.md +64 -0
  102. data/docs/_includes/learn/cluster.md +22 -0
  103. data/docs/_includes/learn/next-steps.md +6 -0
  104. data/docs/_includes/learn/review.md +27 -0
  105. data/docs/_includes/learn/start.md +3 -0
  106. data/docs/_includes/reference.md +3 -0
  107. data/docs/_includes/sidebar.html +118 -0
  108. data/docs/_layouts/default.html +35 -0
  109. data/docs/_reference/kubes-apply.md +24 -0
  110. data/docs/_reference/kubes-clean.md +22 -0
  111. data/docs/_reference/kubes-compile.md +22 -0
  112. data/docs/_reference/kubes-completion.md +42 -0
  113. data/docs/_reference/kubes-completion_script.md +25 -0
  114. data/docs/_reference/kubes-delete.md +23 -0
  115. data/docs/_reference/kubes-deploy.md +35 -0
  116. data/docs/_reference/kubes-docker-build.md +20 -0
  117. data/docs/_reference/kubes-docker-help.md +15 -0
  118. data/docs/_reference/kubes-docker-push.md +20 -0
  119. data/docs/_reference/kubes-docker.md +25 -0
  120. data/docs/_reference/kubes-init.md +26 -0
  121. data/docs/_reference/kubes-version.md +21 -0
  122. data/docs/_sass/bootstrap-overrides.scss +17 -0
  123. data/docs/_sass/buttons.scss +62 -0
  124. data/docs/_sass/caret.scss +39 -0
  125. data/docs/_sass/content.scss +21 -0
  126. data/docs/_sass/cta.scss +39 -0
  127. data/docs/_sass/default.scss +103 -0
  128. data/docs/_sass/footer.scss +66 -0
  129. data/docs/_sass/masthead.scss +77 -0
  130. data/docs/_sass/mixins.scss +79 -0
  131. data/docs/_sass/sidebar.scss +107 -0
  132. data/docs/_sass/syntax.scss +89 -0
  133. data/docs/_sass/table.scss +30 -0
  134. data/docs/_sass/theme.scss +292 -0
  135. data/docs/_sass/variables.scss +24 -0
  136. data/docs/bin/build +4 -0
  137. data/docs/bin/rerun +2 -0
  138. data/docs/bin/web +8 -0
  139. data/docs/css/main.scss +24 -0
  140. data/docs/docs.md +7 -0
  141. data/docs/getting-started.md +12 -0
  142. data/docs/img/logos/boltops-logo-full.png +0 -0
  143. data/docs/img/logos/boltops-logo.png +0 -0
  144. data/docs/img/logos/filler-logo.png +0 -0
  145. data/docs/img/logos/kubes-black.png +0 -0
  146. data/docs/img/logos/kubes-sign.png +0 -0
  147. data/docs/index.html +34 -0
  148. data/docs/js/app.js +39414 -0
  149. data/docs/opal/app.rb +16 -0
  150. data/docs/opal/pager.rb +90 -0
  151. data/docs/opal/sidebar.rb +94 -0
  152. data/docs/opal/sidebar/expander.rb +51 -0
  153. data/docs/reference.md +15 -0
  154. data/docs/support.md +19 -0
  155. data/docs/vendor/bootstrap/css/bootstrap-grid.css +3719 -0
  156. data/docs/vendor/bootstrap/css/bootstrap-grid.css.map +1 -0
  157. data/docs/vendor/bootstrap/css/bootstrap-grid.min.css +7 -0
  158. data/docs/vendor/bootstrap/css/bootstrap-grid.min.css.map +1 -0
  159. data/docs/vendor/bootstrap/css/bootstrap-reboot.css +331 -0
  160. data/docs/vendor/bootstrap/css/bootstrap-reboot.css.map +1 -0
  161. data/docs/vendor/bootstrap/css/bootstrap-reboot.min.css +8 -0
  162. data/docs/vendor/bootstrap/css/bootstrap-reboot.min.css.map +1 -0
  163. data/docs/vendor/bootstrap/css/bootstrap.css +10038 -0
  164. data/docs/vendor/bootstrap/css/bootstrap.css.map +1 -0
  165. data/docs/vendor/bootstrap/css/bootstrap.min.css +7 -0
  166. data/docs/vendor/bootstrap/css/bootstrap.min.css.map +1 -0
  167. data/docs/vendor/bootstrap/js/bootstrap.bundle.js +7013 -0
  168. data/docs/vendor/bootstrap/js/bootstrap.bundle.js.map +1 -0
  169. data/docs/vendor/bootstrap/js/bootstrap.bundle.min.js +7 -0
  170. data/docs/vendor/bootstrap/js/bootstrap.bundle.min.js.map +1 -0
  171. data/docs/vendor/bootstrap/js/bootstrap.js +4435 -0
  172. data/docs/vendor/bootstrap/js/bootstrap.js.map +1 -0
  173. data/docs/vendor/bootstrap/js/bootstrap.min.js +7 -0
  174. data/docs/vendor/bootstrap/js/bootstrap.min.js.map +1 -0
  175. data/docs/vendor/font-awesome/css/font-awesome.css +2337 -0
  176. data/docs/vendor/font-awesome/css/font-awesome.min.css +4 -0
  177. data/docs/vendor/font-awesome/fonts/FontAwesome.otf +0 -0
  178. data/docs/vendor/font-awesome/fonts/fontawesome-webfont.eot +0 -0
  179. data/docs/vendor/font-awesome/fonts/fontawesome-webfont.svg +2671 -0
  180. data/docs/vendor/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
  181. data/docs/vendor/font-awesome/fonts/fontawesome-webfont.woff +0 -0
  182. data/docs/vendor/font-awesome/fonts/fontawesome-webfont.woff2 +0 -0
  183. data/docs/vendor/font-awesome/less/animated.less +34 -0
  184. data/docs/vendor/font-awesome/less/bordered-pulled.less +25 -0
  185. data/docs/vendor/font-awesome/less/core.less +12 -0
  186. data/docs/vendor/font-awesome/less/fixed-width.less +6 -0
  187. data/docs/vendor/font-awesome/less/font-awesome.less +18 -0
  188. data/docs/vendor/font-awesome/less/icons.less +789 -0
  189. data/docs/vendor/font-awesome/less/larger.less +13 -0
  190. data/docs/vendor/font-awesome/less/list.less +19 -0
  191. data/docs/vendor/font-awesome/less/mixins.less +60 -0
  192. data/docs/vendor/font-awesome/less/path.less +15 -0
  193. data/docs/vendor/font-awesome/less/rotated-flipped.less +20 -0
  194. data/docs/vendor/font-awesome/less/screen-reader.less +5 -0
  195. data/docs/vendor/font-awesome/less/stacked.less +20 -0
  196. data/docs/vendor/font-awesome/less/variables.less +799 -0
  197. data/docs/vendor/font-awesome/scss/_animated.scss +34 -0
  198. data/docs/vendor/font-awesome/scss/_bordered-pulled.scss +25 -0
  199. data/docs/vendor/font-awesome/scss/_core.scss +12 -0
  200. data/docs/vendor/font-awesome/scss/_fixed-width.scss +6 -0
  201. data/docs/vendor/font-awesome/scss/_icons.scss +789 -0
  202. data/docs/vendor/font-awesome/scss/_larger.scss +13 -0
  203. data/docs/vendor/font-awesome/scss/_list.scss +19 -0
  204. data/docs/vendor/font-awesome/scss/_mixins.scss +60 -0
  205. data/docs/vendor/font-awesome/scss/_path.scss +15 -0
  206. data/docs/vendor/font-awesome/scss/_rotated-flipped.scss +20 -0
  207. data/docs/vendor/font-awesome/scss/_screen-reader.scss +5 -0
  208. data/docs/vendor/font-awesome/scss/_stacked.scss +20 -0
  209. data/docs/vendor/font-awesome/scss/_variables.scss +799 -0
  210. data/docs/vendor/font-awesome/scss/font-awesome.scss +18 -0
  211. data/docs/vendor/jquery/jquery.js +10598 -0
  212. data/docs/vendor/jquery/jquery.min.js +2 -0
  213. data/docs/vendor/jquery/jquery.min.map +1 -0
  214. data/docs/vendor/jquery/jquery.slim.js +8495 -0
  215. data/docs/vendor/jquery/jquery.slim.min.js +2 -0
  216. data/docs/vendor/jquery/jquery.slim.min.map +1 -0
  217. data/docs/vendor/simple-line-icons/css/simple-line-icons.css +778 -0
  218. data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.eot +0 -0
  219. data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.svg +200 -0
  220. data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.ttf +0 -0
  221. data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.woff +0 -0
  222. data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.woff2 +0 -0
  223. data/docs/vendor/simple-line-icons/less/simple-line-icons.less +982 -0
  224. data/docs/vendor/simple-line-icons/scss/simple-line-icons.scss +979 -0
  225. data/exe/kubes +14 -0
  226. data/kubes.gemspec +29 -19
  227. data/lib/kubes.rb +21 -1
  228. data/lib/kubes/args/custom.rb +30 -0
  229. data/lib/kubes/args/dsl.rb +14 -0
  230. data/lib/kubes/auth.rb +21 -0
  231. data/lib/kubes/auth/ecr.rb +55 -0
  232. data/lib/kubes/autoloader.rb +21 -0
  233. data/lib/kubes/aws_services.rb +14 -0
  234. data/lib/kubes/cli.rb +93 -0
  235. data/lib/kubes/cli/apply.rb +9 -0
  236. data/lib/kubes/cli/base.rb +9 -0
  237. data/lib/kubes/cli/build.rb +8 -0
  238. data/lib/kubes/cli/clean.rb +9 -0
  239. data/lib/kubes/cli/compile.rb +8 -0
  240. data/lib/kubes/cli/delete.rb +11 -0
  241. data/lib/kubes/cli/deploy.rb +13 -0
  242. data/lib/kubes/cli/describe.rb +8 -0
  243. data/lib/kubes/cli/docker.rb +20 -0
  244. data/lib/kubes/cli/get.rb +8 -0
  245. data/lib/kubes/cli/help.rb +11 -0
  246. data/lib/kubes/cli/help/completion.md +20 -0
  247. data/lib/kubes/cli/help/completion_script.md +3 -0
  248. data/lib/kubes/cli/help/deploy.md +10 -0
  249. data/lib/kubes/cli/init.rb +69 -0
  250. data/lib/kubes/cli/sequence.rb +27 -0
  251. data/lib/kubes/command.rb +100 -0
  252. data/lib/kubes/compiler.rb +71 -0
  253. data/lib/kubes/compiler/decorator.rb +17 -0
  254. data/lib/kubes/compiler/decorator/base.rb +16 -0
  255. data/lib/kubes/compiler/decorator/compile.rb +12 -0
  256. data/lib/kubes/compiler/decorator/resources/base.rb +13 -0
  257. data/lib/kubes/compiler/decorator/resources/container.rb +76 -0
  258. data/lib/kubes/compiler/decorator/resources/container/mapping.rb +28 -0
  259. data/lib/kubes/compiler/decorator/resources/deployment.rb +10 -0
  260. data/lib/kubes/compiler/decorator/resources/pod.rb +10 -0
  261. data/lib/kubes/compiler/decorator/resources/secret.rb +23 -0
  262. data/lib/kubes/compiler/decorator/write.rb +14 -0
  263. data/lib/kubes/compiler/dsl/core/base.rb +27 -0
  264. data/lib/kubes/compiler/dsl/core/blocks.rb +55 -0
  265. data/lib/kubes/compiler/dsl/core/fields.rb +78 -0
  266. data/lib/kubes/compiler/dsl/core/files.rb +28 -0
  267. data/lib/kubes/compiler/dsl/core/helpers.rb +19 -0
  268. data/lib/kubes/compiler/dsl/core/parser.rb +43 -0
  269. data/lib/kubes/compiler/dsl/syntax/backend_config.rb +10 -0
  270. data/lib/kubes/compiler/dsl/syntax/cluster_role.rb +4 -0
  271. data/lib/kubes/compiler/dsl/syntax/cluster_role_binding.rb +4 -0
  272. data/lib/kubes/compiler/dsl/syntax/config_map.rb +20 -0
  273. data/lib/kubes/compiler/dsl/syntax/daemon_set.rb +23 -0
  274. data/lib/kubes/compiler/dsl/syntax/deployment.rb +160 -0
  275. data/lib/kubes/compiler/dsl/syntax/ingress.rb +41 -0
  276. data/lib/kubes/compiler/dsl/syntax/managed_certificate.rb +18 -0
  277. data/lib/kubes/compiler/dsl/syntax/namespace.rb +13 -0
  278. data/lib/kubes/compiler/dsl/syntax/network_policy.rb +47 -0
  279. data/lib/kubes/compiler/dsl/syntax/pod.rb +81 -0
  280. data/lib/kubes/compiler/dsl/syntax/resource.rb +70 -0
  281. data/lib/kubes/compiler/dsl/syntax/role.rb +40 -0
  282. data/lib/kubes/compiler/dsl/syntax/role_binding.rb +43 -0
  283. data/lib/kubes/compiler/dsl/syntax/secret.rb +22 -0
  284. data/lib/kubes/compiler/dsl/syntax/service.rb +68 -0
  285. data/lib/kubes/compiler/dsl/syntax/service_account.rb +20 -0
  286. data/lib/kubes/compiler/layering.rb +39 -0
  287. data/lib/kubes/compiler/shared/helpers.rb +31 -0
  288. data/lib/kubes/compiler/strategy.rb +27 -0
  289. data/lib/kubes/compiler/strategy/base.rb +13 -0
  290. data/lib/kubes/compiler/strategy/dsl.rb +32 -0
  291. data/lib/kubes/compiler/strategy/erb.rb +42 -0
  292. data/lib/kubes/compiler/strategy/pass.rb +9 -0
  293. data/lib/kubes/compiler/strategy/result.rb +26 -0
  294. data/lib/kubes/compiler/util/normalize.rb +11 -0
  295. data/lib/kubes/compiler/util/yaml_dump.rb +23 -0
  296. data/lib/kubes/completer.rb +159 -0
  297. data/lib/kubes/completer/script.rb +6 -0
  298. data/lib/kubes/completer/script.sh +10 -0
  299. data/lib/kubes/config.rb +82 -0
  300. data/lib/kubes/core.rb +32 -0
  301. data/lib/kubes/docker/args/default.rb +39 -0
  302. data/lib/kubes/docker/base.rb +88 -0
  303. data/lib/kubes/docker/build.rb +22 -0
  304. data/lib/kubes/docker/push.rb +33 -0
  305. data/lib/kubes/hooks/builder.rb +41 -0
  306. data/lib/kubes/hooks/dsl.rb +19 -0
  307. data/lib/kubes/kubectl.rb +87 -0
  308. data/lib/kubes/kubectl/args/base.rb +12 -0
  309. data/lib/kubes/kubectl/args/kustomize.rb +28 -0
  310. data/lib/kubes/kubectl/args/standard.rb +32 -0
  311. data/lib/kubes/kubectl/batch.rb +49 -0
  312. data/lib/kubes/kubectl/decider.rb +15 -0
  313. data/lib/kubes/kubectl/kustomize.rb +13 -0
  314. data/lib/kubes/kubectl/ordering.rb +27 -0
  315. data/lib/kubes/logger.rb +26 -0
  316. data/lib/kubes/logging.rb +7 -0
  317. data/lib/kubes/util/consider.rb +9 -0
  318. data/lib/kubes/util/sh.rb +43 -0
  319. data/lib/kubes/util/sure.rb +17 -0
  320. data/lib/kubes/util/time.rb +14 -0
  321. data/lib/kubes/version.rb +1 -1
  322. data/lib/templates/base/.kubes/config.rb.tt +9 -0
  323. data/lib/templates/base/.kubes/config/env/dev.rb +6 -0
  324. data/lib/templates/base/.kubes/config/env/prod.rb +6 -0
  325. data/lib/templates/docker/Dockerfile +4 -0
  326. data/lib/templates/dsl/.kubes/resources/base/all.rb.tt +2 -0
  327. data/lib/templates/dsl/.kubes/resources/shared/namespace.rb.tt +2 -0
  328. data/lib/templates/dsl/.kubes/resources/web/deployment.rb +10 -0
  329. data/lib/templates/dsl/.kubes/resources/web/deployment/dev.rb +1 -0
  330. data/lib/templates/dsl/.kubes/resources/web/deployment/prod.rb +1 -0
  331. data/lib/templates/dsl/.kubes/resources/web/service.rb +8 -0
  332. data/lib/templates/yaml/.kubes/resources/base/all.yaml.tt +2 -0
  333. data/lib/templates/yaml/.kubes/resources/base/deployment.yaml.tt +11 -0
  334. data/lib/templates/yaml/.kubes/resources/shared/namespace.yaml.tt +6 -0
  335. data/lib/templates/yaml/.kubes/resources/web/deployment.yaml.tt +19 -0
  336. data/lib/templates/yaml/.kubes/resources/web/deployment/dev.yaml +2 -0
  337. data/lib/templates/yaml/.kubes/resources/web/deployment/prod.yaml +2 -0
  338. data/lib/templates/yaml/.kubes/resources/web/service.yaml.tt +14 -0
  339. data/spec/cli_spec.rb +8 -0
  340. data/spec/fixtures/artifacts/demo-web/deployment.yaml +26 -0
  341. data/spec/fixtures/artifacts/demo-web/service.yaml +16 -0
  342. data/spec/fixtures/blocks/deployments.rb +9 -0
  343. data/spec/fixtures/decorators/deployment/configMap/envFrom.yaml +27 -0
  344. data/spec/fixtures/decorators/deployment/configMap/valueFrom.yaml +30 -0
  345. data/spec/fixtures/decorators/deployment/configMap/volumes.yaml +34 -0
  346. data/spec/fixtures/decorators/deployment/secret/envFrom.yaml +27 -0
  347. data/spec/fixtures/decorators/deployment/secret/valueFrom.yaml +30 -0
  348. data/spec/fixtures/decorators/deployment/secret/volumes.yaml +34 -0
  349. data/spec/fixtures/decorators/pod/configMap/envFrom.yaml +12 -0
  350. data/spec/fixtures/decorators/pod/configMap/valueFrom.yaml +16 -0
  351. data/spec/fixtures/decorators/pod/configMap/volumes.yaml +19 -0
  352. data/spec/fixtures/decorators/pod/secret/envFrom.yaml +12 -0
  353. data/spec/fixtures/decorators/pod/secret/valueFrom.yaml +16 -0
  354. data/spec/fixtures/decorators/pod/secret/volumes.yaml +19 -0
  355. data/spec/fixtures/deployments/minimum.rb +5 -0
  356. data/spec/fixtures/deployments/props.rb +7 -0
  357. data/spec/fixtures/deployments/setter/container.rb +11 -0
  358. data/spec/fixtures/deployments/setter/containers.rb +14 -0
  359. data/spec/fixtures/deployments/setter/metadata.rb +15 -0
  360. data/spec/fixtures/deployments/setter/sidecar.rb +12 -0
  361. data/spec/fixtures/deployments/setter/spec.rb +10 -0
  362. data/spec/fixtures/multiple-files/deployment-1.rb +4 -0
  363. data/spec/fixtures/multiple-files/deployment-2.rb +4 -0
  364. data/spec/fixtures/project/.gitignore +1 -0
  365. data/spec/fixtures/project/.kubes/resources/deployment.rb +32 -0
  366. data/spec/fixtures/project/.kubes/resources/foobar.rb +0 -0
  367. data/spec/fixtures/project/.kubes/resources/service.rb +3 -0
  368. data/spec/fixtures/services/minimum.rb +3 -0
  369. data/spec/fixtures/syntax/network_policy.rb +3 -0
  370. data/spec/fixtures/syntax/pod.rb +1 -0
  371. data/spec/kubes/compiler/decorator/resources/deployment_spec.rb +92 -0
  372. data/spec/kubes/compiler/decorator/resources/pod_spec.rb +92 -0
  373. data/spec/kubes/compiler/strategy/dsl_spec.rb +36 -0
  374. data/spec/kubes/compiler_spec.rb +10 -0
  375. data/spec/kubes/dsl/daemon_set.rb +11 -0
  376. data/spec/kubes/dsl/deployment_spec.rb +60 -0
  377. data/spec/kubes/dsl/network_policy_spec.rb +14 -0
  378. data/spec/kubes/dsl/pod_spec.rb +11 -0
  379. data/spec/kubes/dsl/service_spec.rb +12 -0
  380. data/spec/kubes/kubectl/batch_spec.rb +24 -0
  381. data/spec/spec_helper.rb +34 -0
  382. metadata +607 -22
  383. data/bin/console +0 -14
  384. data/bin/setup +0 -8
@@ -0,0 +1,98 @@
1
+ ---
2
+ title: Contributing
3
+ ---
4
+
5
+ Hi there! Are you interested in contributing to Kubes? We'd love your help. Kubes is an open-source project, built one contribution at a time by users like you.
6
+
7
+ ## Where to get help or report a problem
8
+
9
+ See [the support guidelines]({% link support.md %})
10
+
11
+ ## Ways to contribute
12
+
13
+ Whether you're a developer, an infrastructure engineer, or just an enthusiast, there are lots of ways to contribute. Here are a few ideas:
14
+
15
+ * [Install Kubes on your computer](https://https://kubes.guru.com/docs/install/) and kick the tires. Does it work? Does it do what you'd expect? If not, [open an issue](https://github.com/boltops-tools/kubes/issues/new/choose) and let us know.
16
+ * Comment on some of the project's [open issues](https://github.com/boltops-tools/kubes/issues). Have you experienced the same problem? Know a workaround? Do you have a suggestion for how the feature could be better?
17
+ * Read through [the documentation](https://https://kubes.guru.com/docs/), and click the "improve this page" button, any time you see something confusing or have a suggestion for something that could be improved.
18
+ * Find [an open issue](https://github.com/boltops-tools/kubes/issues) (especially [those labeled `help wanted`](https://github.com/boltops-tools/kubes/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22)), and submit a proposed fix. If it's your first pull request, we promise we won't bite and are glad to answer any questions.
19
+ * Help evaluate [open pull requests](https://github.com/boltops-tools/kubes/pulls), by testing the changes locally and reviewing what's proposed.
20
+
21
+ ## Submitting a pull request
22
+
23
+ ### Pull requests generally
24
+
25
+ * The smaller the proposed change, the better. If you'd like to propose two unrelated changes, submit two pull requests.
26
+
27
+ * The more information, the better. Make judicious use of the pull request body. Describe what changes were made, why you made them, and what impact they will have for users.
28
+
29
+ * If this is your first pull request, it may help to [understand GitHub Flow](https://guides.github.com/introduction/flow/).
30
+
31
+ * If you're submitting a code contribution, be sure to read the [code contributions](#code-contributions) section below.
32
+
33
+ ### Submitting a pull request via github.com
34
+
35
+ Many small changes can be made entirely through the github.com web interface.
36
+
37
+ 1. Navigate to the file within [boltops-tools/kubes](https://github.com/boltops-tools/kubes) that you'd like to edit.
38
+ 2. Click the pencil icon in the top right corner to edit the file.
39
+ 3. Make your proposed changes.
40
+ 4. Click "Propose file change."
41
+ 5. Click "Create pull request."
42
+ 6. Add a descriptive title and detailed description for your proposed change. The more information, the better.
43
+ 7. Click "Create pull request."
44
+
45
+ That's it! You'll be automatically subscribed to receive updates as others review your proposed change and provide feedback.
46
+
47
+ ### Submitting a pull request via Git command line
48
+
49
+ 1. Fork the project by clicking "Fork" in the top right corner of [boltops-tools/kubes](https://github.com/boltops-tools/kubes).
50
+ 2. Clone the repository locally `git clone https://github.com/<your-username>/kubes`.
51
+ 3. Fetch submodules `git submodule init && git submodule update`.
52
+ 4. Create a new, descriptively named branch to contain your change ( `git checkout -b my-awesome-feature` ).
53
+ 5. Hack away, add tests. Not necessarily in that order.
54
+ 6. Make sure everything still passes by running `bundle exec rspec` (see [the tests section](#running-tests-locally) below)
55
+ 7. Push the branch up ( `git push origin my-awesome-feature` ).
56
+ 8. Create a pull request by visiting `https://github.com/<your-username>/kubes` and following the instructions at the top of the screen.
57
+
58
+ ## Proposing updates to the documentation
59
+
60
+ We want the Kubes documentation to be the best it can be. We've open-sourced our docs and we welcome any pull requests if you find it lacking.
61
+
62
+ ### How to submit changes
63
+
64
+ You can find the documentation for [https://kubes.guru](http://https://kubes.guru) in the [docs](https://github.com/boltops-tools/kubes/tree/master/docs) directory. See the section above, [submitting a pull request](#submitting-a-pull-request) for information on how to propose a change.
65
+
66
+ One gotcha, all pull requests should be directed at the `master` branch (the default branch).
67
+
68
+ ## Code Contributions
69
+
70
+ Interesting in submitting a pull request? Awesome. Read on. There are a few common gotchas that we'd love to help you avoid.
71
+
72
+ ### Tests and documentation
73
+
74
+ Any time you propose a code change, you should also include updates to the documentation and tests within the same pull request.
75
+
76
+ #### Documentation
77
+
78
+ If your contribution changes any Kubes behavior, make sure to update the documentation. Documentation lives in the `docs` folder. It's a Jekyll site and can be started with `cd docs && bin/web`. If the docs are missing information, please feel free to add it in. Great docs make a great project. Include changes to the documentation within your pull request, and once merged, `https://kubes.guru.com` will be updated.
79
+
80
+ #### Tests
81
+
82
+ * If you're creating a small fix or patch to an existing feature, a simple test is more than enough. You can usually copy/paste from an existing example in the `specs` folder.
83
+
84
+ ### Code contributions generally
85
+
86
+ * Don't bump the Gem version in your pull request (if you don't know what that means, you probably didn't).
87
+
88
+ ## Running tests
89
+
90
+ ### Test Dependencies
91
+
92
+ To run the test suite by running the following command:
93
+
94
+ bundle exec rspec
95
+
96
+ ## Thank You
97
+
98
+ Thanks! Hacking on Kubes should be fun. If you find any of this hard to figure out, let us know so we can improve our process or documentation!
@@ -0,0 +1,66 @@
1
+ ---
2
+ title: Kubes DSL
3
+ ---
4
+
5
+ Kubes supports a DSL that builds Kubernetes YAML files. The DSL substantially reduces the amount of code you have to write. Each part of the structure can be customized and overridden.
6
+
7
+ ## DSL Methods
8
+
9
+ In general, the available DSL methods correspond to resource fields available. To find available methods:
10
+
11
+ 1. Look the at the source for each of the [resources](https://github.com/boltops-tools/kubes/tree/master/lib/kubes/compiler/dsl/syntax).
12
+ 2. Refer to each resource's docs, linked at the bottom of this page.
13
+ 3. And use the `kubectl explain` command.
14
+
15
+ Sometimes the methods may not exactly match to avoid field names collisions. Though this is the exception, not the rule.
16
+
17
+ ## Example
18
+
19
+ Here's a simple example:
20
+
21
+ .kubes/resources/web/service.rb
22
+
23
+ ```ruby
24
+ name "demo-web"
25
+ labels(role: "web")
26
+ namespace "demo"
27
+
28
+ port 80
29
+ targetPort 80
30
+ ```
31
+
32
+ Results in:
33
+
34
+ .kubes/output/web/service.yaml
35
+
36
+ ```yaml
37
+ ---
38
+ apiVersion: v1
39
+ kind: Service
40
+ metadata:
41
+ name: demo-web
42
+ labels:
43
+ app: demo
44
+ namespace: demo
45
+ spec:
46
+ ports:
47
+ - port: 80
48
+ protocol: TCP
49
+ targetPort: 8080
50
+ selector:
51
+ app: demo
52
+ type: NodePort
53
+ ```
54
+
55
+ Notice how `port` and `targetPort` correspond to `spec.ports.port` and `spec.ports.targetPort` in the YAML.
56
+
57
+ ## Reader and Writer Methods
58
+
59
+ In general:
60
+
61
+ * The DSL methods behave as reader methods when no arguments are passed to it. IE: `name "demo-web"` sets the value.
62
+ * The DSL methods behave as writer methods when arguments are passed to it. IE: `name` returns the value.
63
+
64
+ ## Merge Behavior
65
+
66
+ Generally, the merge should behave as expected. For example, map or Hash fields are merged together from multiple layers. Strings are simply replaced. See more details at [Layering Merge Behavior]({% link _docs/layering/merge.md %})
@@ -0,0 +1,114 @@
1
+ ---
2
+ title: Multiple Resources
3
+ ---
4
+
5
+ Kubes encourages a structure with files that matches the resource kind. Example:
6
+
7
+ .kubes
8
+ └── resources
9
+ └── web
10
+ ├── deployment.rb
11
+ └── service.rb
12
+
13
+ This structure is nicely organized and covers 80% of use cases. An astute user may point out that this struture assumes one resource of each kind.
14
+
15
+ Next, we'll cover different ways to create multiple resource of the same kinds.
16
+
17
+ ## Multiple Resources: Multiple Files
18
+
19
+ You can create multiple resources of same kind by appending a dash followed by anything. Example:
20
+
21
+ .kubes
22
+ └── resources
23
+ └── web
24
+ ├── deployment-1.rb
25
+ ├── deployment-2.rb
26
+ ├── service-1.rb
27
+ └── service-2.rb
28
+
29
+ Only words before the dash are used to infer the resource kind.
30
+
31
+ Filename | Resource Kind
32
+ --- | ---
33
+ deployment-1.rb | Deployment
34
+ deployment-2.rb | Deployment
35
+ service-1.rb | Service
36
+ service-2.rb | Service
37
+
38
+ Using multiple files is the general recommended approach.
39
+
40
+ ## Multiple Resources: Block Form
41
+
42
+ You can also use a block form to create multiple resources. You name the resource files with plural names. An example helps explain:
43
+
44
+ .kubes
45
+ └── resources
46
+ └── deployments.rb
47
+
48
+ .kubes/resources/web/deployments.rb
49
+
50
+ ```ruby
51
+ deployment "demo-web" do
52
+ labels(role: "web")
53
+ replicas 1
54
+ image built_image # IE: user/demo:kubes-2020-06-13T19-55-16-43afc6e
55
+ end
56
+
57
+ deployment "demo-web-2" do
58
+ labels(role: "web")
59
+ replicas 1
60
+ image built_image # IE: user/demo:kubes-2020-06-13T19-55-16-43afc6e
61
+ end
62
+ ```
63
+
64
+ You can also mix and matched resources. When you use the block form, the file name is not used to infer the resource type. The resource kind is explicitly declare by the block method name.
65
+
66
+
67
+ .kubes/resources/web/resources.rb
68
+
69
+ ```ruby
70
+ deployment "demo-web" do
71
+ labels(role: "web")
72
+ replicas 1
73
+ image built_image # IE: user/demo:kubes-2020-06-13T19-55-16-43afc6e
74
+ end
75
+
76
+ service "demo-web" do
77
+ labels(role: "web")
78
+ end
79
+ ```
80
+
81
+ You can declare deployment, service, and other resource kinds multiple times.
82
+
83
+ ## Layering
84
+
85
+ Layering works for both simple and block form. Just create a folder with the corresponding name.
86
+
87
+ * The layering definitions with the simple form only merge with other simple form layers.
88
+ * The layering definitions for block forms only merge with other block form layers.
89
+
90
+ Simple form layering:
91
+
92
+ .kubes/resources/
93
+ ├── base
94
+ │ ├── all.rb
95
+ │ └── deployment.rb
96
+ └── web
97
+ ├── deployment
98
+ │ ├── dev.rb
99
+ │ └── prod.rb
100
+ └── deployment.rb
101
+
102
+ Block form layering:
103
+
104
+ .kubes/resources/
105
+ ├── base
106
+ │ ├── alls.rb
107
+ │ └── deployments.rb
108
+ └── web
109
+ ├── deployments
110
+ │ ├── dev.rb
111
+ │ └── prod.rb
112
+ └── deployments.rb
113
+
114
+ The main difference are pluralized filenames.
@@ -0,0 +1,12 @@
1
+ ---
2
+ title: Resources
3
+ ---
4
+
5
+ Here's a list of the resources supported by the Kubes DSL.
6
+
7
+ {% assign docs = site.docs | where: "categories","dsl" %}
8
+ {% for doc in docs -%}
9
+ * [{{ doc.title }}]({{ doc.url }})
10
+ {% endfor %}
11
+
12
+ For resources, that are not supported, you can use the [Generic resource]({% link _docs/dsl/resources/generic.md %}) or use [YAML]({% link _docs/yaml.md %}) instead. You can use a mix of DSL and YAML definitions in the `.kubes/resources` folder.
@@ -0,0 +1,45 @@
1
+ ---
2
+ title: BackendConfig
3
+ categories: dsl
4
+ ---
5
+
6
+ A BackendConfig is [custom resource definitions (CRDs)](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/) that allow you to further customize the load balancer.
7
+
8
+ Here's an example of a BackendConfig.
9
+
10
+ .kubes/resources/web/backend-config.rb
11
+
12
+ ```ruby
13
+ name "backendconfig"
14
+ spec(
15
+ timeoutSec: 40,
16
+ connectionDraining: {
17
+ drainingTimeoutSec: 60,
18
+ },
19
+ sessionAffinity: {
20
+ affinityType: "CLIENT_IP",
21
+ }
22
+ )
23
+ ```
24
+
25
+ Produces:
26
+
27
+ .kubes/output/web/backend-config.yaml
28
+
29
+ ```yaml
30
+ ---
31
+ apiVersion: cloud.google.com/v1
32
+ kind: BackendConfig
33
+ metadata:
34
+ name: my-bsc-backendconfig
35
+ spec:
36
+ timeoutSec: 40
37
+ connectionDraining:
38
+ drainingTimeoutSec: 60
39
+ sessionAffinity:
40
+ affinityType: CLIENT_IP
41
+ ```
42
+
43
+ ## DSL Methods
44
+
45
+ {% include dsl/methods.md name="backend_config" %}
@@ -0,0 +1,84 @@
1
+ ---
2
+ title: ConfigMap
3
+ categories: dsl
4
+ ---
5
+
6
+ ## Example
7
+
8
+ Here's an example of a ConfigMap.
9
+
10
+ .kubes/resources/shared/config_map.rb
11
+
12
+ ```ruby
13
+ name "demo-config-map"
14
+ data(
15
+ database: "mongodb",
16
+ database_uri: "mongodb://localhost:27017",
17
+ )
18
+ ```
19
+
20
+ Produces:
21
+
22
+ .kubes/output/shared/config_map.yaml
23
+
24
+ ```yaml
25
+ apiVersion: v1
26
+ kind: ConfigMap
27
+ metadata:
28
+ name: demo-config-map-cfbd534f91
29
+ labels:
30
+ app: demo
31
+ namespace: default
32
+ data:
33
+ database: mongodb
34
+ database_uri: mongodb://localhost:27017
35
+ ```
36
+
37
+ ## Suffix Hash
38
+
39
+ {% include dsl/rolling_deployment.md kind="ConfigMap" %}
40
+
41
+ .kubes/output/web/deployment.yaml:
42
+
43
+ ```yaml
44
+ # ..
45
+ spec:
46
+ template:
47
+ spec:
48
+ containers:
49
+ - name: demo-web
50
+ image: nginx
51
+ envFrom:
52
+ - configMapRef:
53
+ name: demo-config-map-cfbd534f91
54
+ ```
55
+
56
+ {% include dsl/suffix_hash.md %}
57
+
58
+ ## Files Helper
59
+
60
+ You can use a `files` helper to load ConfigMap values from one or more files.
61
+
62
+
63
+ .kubes/resources/shared/config_map.rb
64
+
65
+ ```ruby
66
+ name "demo-secret"
67
+ files("files/configs.txt")
68
+ ```
69
+
70
+ The `files/configs.txt` should be in the same folder as the `config_map.rb` definition. Example:
71
+
72
+ .kubes/resources/shared/files/configs.txt
73
+
74
+ CONFIG1=value1
75
+ CONFIG2=value2
76
+
77
+ ## DSL Methods
78
+
79
+ Here's a list of more common methods:
80
+
81
+ * data
82
+ * binaryData
83
+
84
+ {% include dsl/methods.md name="config_map" %}
@@ -0,0 +1,58 @@
1
+ ---
2
+ title: DaemonSet
3
+ categories: dsl
4
+ ---
5
+
6
+ ## Example
7
+
8
+ Here's an example of a DaemonSet.
9
+
10
+ .kubes/resources/shared/daemon_set.rb
11
+
12
+ ```ruby
13
+ name "calico-node"
14
+ namespace "kube-system"
15
+ labels("k8s-app": "calico-node")
16
+ updateStrategy(
17
+ type: "RollingUpdate",
18
+ rollingUpdate: {
19
+ maxUnavailable: 1
20
+ }
21
+ )
22
+ annotations(
23
+ "*scheduler**.alpha.kubernetes.io/critical-pod": '*'
24
+ )
25
+ ```
26
+
27
+ Produces:
28
+
29
+ .kubes/output/shared/daemon_set.yaml
30
+
31
+ ```yaml
32
+ apiVersion: apps/v1
33
+ kind: DaemonSet
34
+ metadata:
35
+ annotations:
36
+ "*scheduler**.alpha.kubernetes.io/critical-pod": "*"
37
+ name: calico-node
38
+ labels:
39
+ k8s-app: calico-node
40
+ namespace: kube-system
41
+ spec:
42
+ updateStrategy:
43
+ type: RollingUpdate
44
+ rollingUpdate:
45
+ maxUnavailable: 1
46
+ ```
47
+
48
+ ## DSL Methods
49
+
50
+ Here's a list of more common methods:
51
+
52
+ * minReadySeconds
53
+ * revisionHistoryLimit
54
+ * selector
55
+ * template
56
+ * updateStrategy
57
+
58
+ {% include dsl/methods.md name="daemon_set" %}