kubes 0.1.0 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.dockerignore +4 -0
- data/.gitignore +15 -7
- data/.rspec +3 -0
- data/CHANGELOG.md +22 -0
- data/Dockerfile +14 -0
- data/Gemfile +3 -1
- data/Guardfile +19 -0
- data/LICENSE.txt +201 -0
- data/README.md +46 -18
- data/Rakefile +13 -1
- data/docs/.gitignore +5 -0
- data/docs/CNAME +1 -0
- data/docs/Gemfile +16 -0
- data/docs/LICENSE +201 -0
- data/docs/Procfile +2 -0
- data/docs/README.md +24 -0
- data/docs/Rakefile +38 -0
- data/docs/_config.yml +71 -0
- data/docs/_docs/auto-context.md +47 -0
- data/docs/_docs/ci/cloudbuild.md +69 -0
- data/docs/_docs/config.md +9 -0
- data/docs/_docs/config/docker.md +70 -0
- data/docs/_docs/config/env.md +58 -0
- data/docs/_docs/config/kubectl.md +61 -0
- data/docs/_docs/contributing.md +98 -0
- data/docs/_docs/dsl.md +66 -0
- data/docs/_docs/dsl/multiple-resources.md +114 -0
- data/docs/_docs/dsl/resources.md +12 -0
- data/docs/_docs/dsl/resources/backend_config.md +45 -0
- data/docs/_docs/dsl/resources/config_map.md +84 -0
- data/docs/_docs/dsl/resources/daemon_set.md +58 -0
- data/docs/_docs/dsl/resources/deployment.md +137 -0
- data/docs/_docs/dsl/resources/generic.md +58 -0
- data/docs/_docs/dsl/resources/ingress.md +103 -0
- data/docs/_docs/dsl/resources/managed_certificate.md +39 -0
- data/docs/_docs/dsl/resources/namespace.md +34 -0
- data/docs/_docs/dsl/resources/network_policy.md +111 -0
- data/docs/_docs/dsl/resources/pod.md +82 -0
- data/docs/_docs/dsl/resources/role.md +44 -0
- data/docs/_docs/dsl/resources/role_binding.md +55 -0
- data/docs/_docs/dsl/resources/secret.md +87 -0
- data/docs/_docs/dsl/resources/service.md +60 -0
- data/docs/_docs/dsl/resources/service_account.md +37 -0
- data/docs/_docs/extra-env.md +23 -0
- data/docs/_docs/extra-env/dsl.md +86 -0
- data/docs/_docs/extra-env/yaml.md +67 -0
- data/docs/_docs/helpers.md +19 -0
- data/docs/_docs/intro.md +15 -0
- data/docs/_docs/intro/concepts.md +37 -0
- data/docs/_docs/intro/how-kubes-works.md +29 -0
- data/docs/_docs/intro/install.md +6 -0
- data/docs/_docs/intro/ordering.md +63 -0
- data/docs/_docs/intro/ordering/custom.md +25 -0
- data/docs/_docs/intro/structure.md +43 -0
- data/docs/_docs/kustomize.md +54 -0
- data/docs/_docs/layering.md +8 -0
- data/docs/_docs/layering/dsl.md +5 -0
- data/docs/_docs/layering/merge.md +96 -0
- data/docs/_docs/layering/yaml.md +5 -0
- data/docs/_docs/learn/dsl.md +5 -0
- data/docs/_docs/learn/dsl/change.md +16 -0
- data/docs/_docs/learn/dsl/cluster.md +5 -0
- data/docs/_docs/learn/dsl/delete.md +32 -0
- data/docs/_docs/learn/dsl/deploy.md +66 -0
- data/docs/_docs/learn/dsl/install.md +5 -0
- data/docs/_docs/learn/dsl/new-project.md +34 -0
- data/docs/_docs/learn/dsl/next-steps.md +5 -0
- data/docs/_docs/learn/dsl/review-project.md +63 -0
- data/docs/_docs/learn/dsl/update.md +53 -0
- data/docs/_docs/learn/yaml.md +5 -0
- data/docs/_docs/learn/yaml/change.md +17 -0
- data/docs/_docs/learn/yaml/cluster.md +5 -0
- data/docs/_docs/learn/yaml/delete.md +32 -0
- data/docs/_docs/learn/yaml/deploy.md +67 -0
- data/docs/_docs/learn/yaml/install.md +5 -0
- data/docs/_docs/learn/yaml/new-project.md +37 -0
- data/docs/_docs/learn/yaml/next-steps.md +5 -0
- data/docs/_docs/learn/yaml/review-project.md +108 -0
- data/docs/_docs/learn/yaml/update.md +54 -0
- data/docs/_docs/next-steps.md +13 -0
- data/docs/_docs/patterns.md +7 -0
- data/docs/_docs/patterns/clock-web-worker.md +71 -0
- data/docs/_docs/resources.md +11 -0
- data/docs/_docs/resources/base.md +33 -0
- data/docs/_docs/resources/role.md +41 -0
- data/docs/_docs/resources/shared.md +36 -0
- data/docs/_docs/yaml.md +41 -0
- data/docs/_includes/commands.html +131 -0
- data/docs/_includes/content.html +25 -0
- data/docs/_includes/dsl/methods.md +1 -0
- data/docs/_includes/dsl/rolling_deployment.md +1 -0
- data/docs/_includes/dsl/suffix_hash.md +8 -0
- data/docs/_includes/example.html +12 -0
- data/docs/_includes/footer.html +37 -0
- data/docs/_includes/google_analytics.html +10 -0
- data/docs/_includes/header.html +31 -0
- data/docs/_includes/intro/install.md +15 -0
- data/docs/_includes/js.html +3 -0
- data/docs/_includes/kubes-steps.md +3 -0
- data/docs/_includes/layering/layers.md +64 -0
- data/docs/_includes/learn/cluster.md +22 -0
- data/docs/_includes/learn/next-steps.md +6 -0
- data/docs/_includes/learn/review.md +27 -0
- data/docs/_includes/learn/start.md +3 -0
- data/docs/_includes/reference.md +3 -0
- data/docs/_includes/sidebar.html +118 -0
- data/docs/_layouts/default.html +35 -0
- data/docs/_reference/kubes-apply.md +24 -0
- data/docs/_reference/kubes-clean.md +22 -0
- data/docs/_reference/kubes-compile.md +22 -0
- data/docs/_reference/kubes-completion.md +42 -0
- data/docs/_reference/kubes-completion_script.md +25 -0
- data/docs/_reference/kubes-delete.md +23 -0
- data/docs/_reference/kubes-deploy.md +35 -0
- data/docs/_reference/kubes-docker-build.md +20 -0
- data/docs/_reference/kubes-docker-help.md +15 -0
- data/docs/_reference/kubes-docker-push.md +20 -0
- data/docs/_reference/kubes-docker.md +25 -0
- data/docs/_reference/kubes-init.md +26 -0
- data/docs/_reference/kubes-version.md +21 -0
- data/docs/_sass/bootstrap-overrides.scss +17 -0
- data/docs/_sass/buttons.scss +62 -0
- data/docs/_sass/caret.scss +39 -0
- data/docs/_sass/content.scss +21 -0
- data/docs/_sass/cta.scss +39 -0
- data/docs/_sass/default.scss +103 -0
- data/docs/_sass/footer.scss +66 -0
- data/docs/_sass/masthead.scss +77 -0
- data/docs/_sass/mixins.scss +79 -0
- data/docs/_sass/sidebar.scss +107 -0
- data/docs/_sass/syntax.scss +89 -0
- data/docs/_sass/table.scss +30 -0
- data/docs/_sass/theme.scss +292 -0
- data/docs/_sass/variables.scss +24 -0
- data/docs/bin/build +4 -0
- data/docs/bin/rerun +2 -0
- data/docs/bin/web +8 -0
- data/docs/css/main.scss +24 -0
- data/docs/docs.md +7 -0
- data/docs/getting-started.md +12 -0
- data/docs/img/logos/boltops-logo-full.png +0 -0
- data/docs/img/logos/boltops-logo.png +0 -0
- data/docs/img/logos/filler-logo.png +0 -0
- data/docs/img/logos/kubes-black.png +0 -0
- data/docs/img/logos/kubes-sign.png +0 -0
- data/docs/index.html +34 -0
- data/docs/js/app.js +39414 -0
- data/docs/opal/app.rb +16 -0
- data/docs/opal/pager.rb +90 -0
- data/docs/opal/sidebar.rb +94 -0
- data/docs/opal/sidebar/expander.rb +51 -0
- data/docs/reference.md +15 -0
- data/docs/support.md +19 -0
- data/docs/vendor/bootstrap/css/bootstrap-grid.css +3719 -0
- data/docs/vendor/bootstrap/css/bootstrap-grid.css.map +1 -0
- data/docs/vendor/bootstrap/css/bootstrap-grid.min.css +7 -0
- data/docs/vendor/bootstrap/css/bootstrap-grid.min.css.map +1 -0
- data/docs/vendor/bootstrap/css/bootstrap-reboot.css +331 -0
- data/docs/vendor/bootstrap/css/bootstrap-reboot.css.map +1 -0
- data/docs/vendor/bootstrap/css/bootstrap-reboot.min.css +8 -0
- data/docs/vendor/bootstrap/css/bootstrap-reboot.min.css.map +1 -0
- data/docs/vendor/bootstrap/css/bootstrap.css +10038 -0
- data/docs/vendor/bootstrap/css/bootstrap.css.map +1 -0
- data/docs/vendor/bootstrap/css/bootstrap.min.css +7 -0
- data/docs/vendor/bootstrap/css/bootstrap.min.css.map +1 -0
- data/docs/vendor/bootstrap/js/bootstrap.bundle.js +7013 -0
- data/docs/vendor/bootstrap/js/bootstrap.bundle.js.map +1 -0
- data/docs/vendor/bootstrap/js/bootstrap.bundle.min.js +7 -0
- data/docs/vendor/bootstrap/js/bootstrap.bundle.min.js.map +1 -0
- data/docs/vendor/bootstrap/js/bootstrap.js +4435 -0
- data/docs/vendor/bootstrap/js/bootstrap.js.map +1 -0
- data/docs/vendor/bootstrap/js/bootstrap.min.js +7 -0
- data/docs/vendor/bootstrap/js/bootstrap.min.js.map +1 -0
- data/docs/vendor/font-awesome/css/font-awesome.css +2337 -0
- data/docs/vendor/font-awesome/css/font-awesome.min.css +4 -0
- data/docs/vendor/font-awesome/fonts/FontAwesome.otf +0 -0
- data/docs/vendor/font-awesome/fonts/fontawesome-webfont.eot +0 -0
- data/docs/vendor/font-awesome/fonts/fontawesome-webfont.svg +2671 -0
- data/docs/vendor/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
- data/docs/vendor/font-awesome/fonts/fontawesome-webfont.woff +0 -0
- data/docs/vendor/font-awesome/fonts/fontawesome-webfont.woff2 +0 -0
- data/docs/vendor/font-awesome/less/animated.less +34 -0
- data/docs/vendor/font-awesome/less/bordered-pulled.less +25 -0
- data/docs/vendor/font-awesome/less/core.less +12 -0
- data/docs/vendor/font-awesome/less/fixed-width.less +6 -0
- data/docs/vendor/font-awesome/less/font-awesome.less +18 -0
- data/docs/vendor/font-awesome/less/icons.less +789 -0
- data/docs/vendor/font-awesome/less/larger.less +13 -0
- data/docs/vendor/font-awesome/less/list.less +19 -0
- data/docs/vendor/font-awesome/less/mixins.less +60 -0
- data/docs/vendor/font-awesome/less/path.less +15 -0
- data/docs/vendor/font-awesome/less/rotated-flipped.less +20 -0
- data/docs/vendor/font-awesome/less/screen-reader.less +5 -0
- data/docs/vendor/font-awesome/less/stacked.less +20 -0
- data/docs/vendor/font-awesome/less/variables.less +799 -0
- data/docs/vendor/font-awesome/scss/_animated.scss +34 -0
- data/docs/vendor/font-awesome/scss/_bordered-pulled.scss +25 -0
- data/docs/vendor/font-awesome/scss/_core.scss +12 -0
- data/docs/vendor/font-awesome/scss/_fixed-width.scss +6 -0
- data/docs/vendor/font-awesome/scss/_icons.scss +789 -0
- data/docs/vendor/font-awesome/scss/_larger.scss +13 -0
- data/docs/vendor/font-awesome/scss/_list.scss +19 -0
- data/docs/vendor/font-awesome/scss/_mixins.scss +60 -0
- data/docs/vendor/font-awesome/scss/_path.scss +15 -0
- data/docs/vendor/font-awesome/scss/_rotated-flipped.scss +20 -0
- data/docs/vendor/font-awesome/scss/_screen-reader.scss +5 -0
- data/docs/vendor/font-awesome/scss/_stacked.scss +20 -0
- data/docs/vendor/font-awesome/scss/_variables.scss +799 -0
- data/docs/vendor/font-awesome/scss/font-awesome.scss +18 -0
- data/docs/vendor/jquery/jquery.js +10598 -0
- data/docs/vendor/jquery/jquery.min.js +2 -0
- data/docs/vendor/jquery/jquery.min.map +1 -0
- data/docs/vendor/jquery/jquery.slim.js +8495 -0
- data/docs/vendor/jquery/jquery.slim.min.js +2 -0
- data/docs/vendor/jquery/jquery.slim.min.map +1 -0
- data/docs/vendor/simple-line-icons/css/simple-line-icons.css +778 -0
- data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.eot +0 -0
- data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.svg +200 -0
- data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.ttf +0 -0
- data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.woff +0 -0
- data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.woff2 +0 -0
- data/docs/vendor/simple-line-icons/less/simple-line-icons.less +982 -0
- data/docs/vendor/simple-line-icons/scss/simple-line-icons.scss +979 -0
- data/exe/kubes +14 -0
- data/kubes.gemspec +29 -19
- data/lib/kubes.rb +21 -1
- data/lib/kubes/args/custom.rb +30 -0
- data/lib/kubes/args/dsl.rb +14 -0
- data/lib/kubes/auth.rb +21 -0
- data/lib/kubes/auth/ecr.rb +55 -0
- data/lib/kubes/autoloader.rb +21 -0
- data/lib/kubes/aws_services.rb +14 -0
- data/lib/kubes/cli.rb +93 -0
- data/lib/kubes/cli/apply.rb +9 -0
- data/lib/kubes/cli/base.rb +9 -0
- data/lib/kubes/cli/build.rb +8 -0
- data/lib/kubes/cli/clean.rb +9 -0
- data/lib/kubes/cli/compile.rb +8 -0
- data/lib/kubes/cli/delete.rb +11 -0
- data/lib/kubes/cli/deploy.rb +13 -0
- data/lib/kubes/cli/describe.rb +8 -0
- data/lib/kubes/cli/docker.rb +20 -0
- data/lib/kubes/cli/get.rb +8 -0
- data/lib/kubes/cli/help.rb +11 -0
- data/lib/kubes/cli/help/completion.md +20 -0
- data/lib/kubes/cli/help/completion_script.md +3 -0
- data/lib/kubes/cli/help/deploy.md +10 -0
- data/lib/kubes/cli/init.rb +69 -0
- data/lib/kubes/cli/sequence.rb +27 -0
- data/lib/kubes/command.rb +100 -0
- data/lib/kubes/compiler.rb +71 -0
- data/lib/kubes/compiler/decorator.rb +17 -0
- data/lib/kubes/compiler/decorator/base.rb +16 -0
- data/lib/kubes/compiler/decorator/compile.rb +12 -0
- data/lib/kubes/compiler/decorator/resources/base.rb +13 -0
- data/lib/kubes/compiler/decorator/resources/container.rb +76 -0
- data/lib/kubes/compiler/decorator/resources/container/mapping.rb +28 -0
- data/lib/kubes/compiler/decorator/resources/deployment.rb +10 -0
- data/lib/kubes/compiler/decorator/resources/pod.rb +10 -0
- data/lib/kubes/compiler/decorator/resources/secret.rb +23 -0
- data/lib/kubes/compiler/decorator/write.rb +14 -0
- data/lib/kubes/compiler/dsl/core/base.rb +27 -0
- data/lib/kubes/compiler/dsl/core/blocks.rb +55 -0
- data/lib/kubes/compiler/dsl/core/fields.rb +78 -0
- data/lib/kubes/compiler/dsl/core/files.rb +28 -0
- data/lib/kubes/compiler/dsl/core/helpers.rb +19 -0
- data/lib/kubes/compiler/dsl/core/parser.rb +43 -0
- data/lib/kubes/compiler/dsl/syntax/backend_config.rb +10 -0
- data/lib/kubes/compiler/dsl/syntax/cluster_role.rb +4 -0
- data/lib/kubes/compiler/dsl/syntax/cluster_role_binding.rb +4 -0
- data/lib/kubes/compiler/dsl/syntax/config_map.rb +20 -0
- data/lib/kubes/compiler/dsl/syntax/daemon_set.rb +23 -0
- data/lib/kubes/compiler/dsl/syntax/deployment.rb +160 -0
- data/lib/kubes/compiler/dsl/syntax/ingress.rb +41 -0
- data/lib/kubes/compiler/dsl/syntax/managed_certificate.rb +18 -0
- data/lib/kubes/compiler/dsl/syntax/namespace.rb +13 -0
- data/lib/kubes/compiler/dsl/syntax/network_policy.rb +47 -0
- data/lib/kubes/compiler/dsl/syntax/pod.rb +81 -0
- data/lib/kubes/compiler/dsl/syntax/resource.rb +70 -0
- data/lib/kubes/compiler/dsl/syntax/role.rb +40 -0
- data/lib/kubes/compiler/dsl/syntax/role_binding.rb +43 -0
- data/lib/kubes/compiler/dsl/syntax/secret.rb +22 -0
- data/lib/kubes/compiler/dsl/syntax/service.rb +68 -0
- data/lib/kubes/compiler/dsl/syntax/service_account.rb +20 -0
- data/lib/kubes/compiler/layering.rb +39 -0
- data/lib/kubes/compiler/shared/helpers.rb +31 -0
- data/lib/kubes/compiler/strategy.rb +27 -0
- data/lib/kubes/compiler/strategy/base.rb +13 -0
- data/lib/kubes/compiler/strategy/dsl.rb +32 -0
- data/lib/kubes/compiler/strategy/erb.rb +42 -0
- data/lib/kubes/compiler/strategy/pass.rb +9 -0
- data/lib/kubes/compiler/strategy/result.rb +26 -0
- data/lib/kubes/compiler/util/normalize.rb +11 -0
- data/lib/kubes/compiler/util/yaml_dump.rb +23 -0
- data/lib/kubes/completer.rb +159 -0
- data/lib/kubes/completer/script.rb +6 -0
- data/lib/kubes/completer/script.sh +10 -0
- data/lib/kubes/config.rb +82 -0
- data/lib/kubes/core.rb +32 -0
- data/lib/kubes/docker/args/default.rb +39 -0
- data/lib/kubes/docker/base.rb +88 -0
- data/lib/kubes/docker/build.rb +22 -0
- data/lib/kubes/docker/push.rb +33 -0
- data/lib/kubes/hooks/builder.rb +41 -0
- data/lib/kubes/hooks/dsl.rb +19 -0
- data/lib/kubes/kubectl.rb +87 -0
- data/lib/kubes/kubectl/args/base.rb +12 -0
- data/lib/kubes/kubectl/args/kustomize.rb +28 -0
- data/lib/kubes/kubectl/args/standard.rb +32 -0
- data/lib/kubes/kubectl/batch.rb +49 -0
- data/lib/kubes/kubectl/decider.rb +15 -0
- data/lib/kubes/kubectl/kustomize.rb +13 -0
- data/lib/kubes/kubectl/ordering.rb +27 -0
- data/lib/kubes/logger.rb +26 -0
- data/lib/kubes/logging.rb +7 -0
- data/lib/kubes/util/consider.rb +9 -0
- data/lib/kubes/util/sh.rb +43 -0
- data/lib/kubes/util/sure.rb +17 -0
- data/lib/kubes/util/time.rb +14 -0
- data/lib/kubes/version.rb +1 -1
- data/lib/templates/base/.kubes/config.rb.tt +9 -0
- data/lib/templates/base/.kubes/config/env/dev.rb +6 -0
- data/lib/templates/base/.kubes/config/env/prod.rb +6 -0
- data/lib/templates/docker/Dockerfile +4 -0
- data/lib/templates/dsl/.kubes/resources/base/all.rb.tt +2 -0
- data/lib/templates/dsl/.kubes/resources/shared/namespace.rb.tt +2 -0
- data/lib/templates/dsl/.kubes/resources/web/deployment.rb +10 -0
- data/lib/templates/dsl/.kubes/resources/web/deployment/dev.rb +1 -0
- data/lib/templates/dsl/.kubes/resources/web/deployment/prod.rb +1 -0
- data/lib/templates/dsl/.kubes/resources/web/service.rb +8 -0
- data/lib/templates/yaml/.kubes/resources/base/all.yaml.tt +2 -0
- data/lib/templates/yaml/.kubes/resources/base/deployment.yaml.tt +11 -0
- data/lib/templates/yaml/.kubes/resources/shared/namespace.yaml.tt +6 -0
- data/lib/templates/yaml/.kubes/resources/web/deployment.yaml.tt +19 -0
- data/lib/templates/yaml/.kubes/resources/web/deployment/dev.yaml +2 -0
- data/lib/templates/yaml/.kubes/resources/web/deployment/prod.yaml +2 -0
- data/lib/templates/yaml/.kubes/resources/web/service.yaml.tt +14 -0
- data/spec/cli_spec.rb +8 -0
- data/spec/fixtures/artifacts/demo-web/deployment.yaml +26 -0
- data/spec/fixtures/artifacts/demo-web/service.yaml +16 -0
- data/spec/fixtures/blocks/deployments.rb +9 -0
- data/spec/fixtures/decorators/deployment/configMap/envFrom.yaml +27 -0
- data/spec/fixtures/decorators/deployment/configMap/valueFrom.yaml +30 -0
- data/spec/fixtures/decorators/deployment/configMap/volumes.yaml +34 -0
- data/spec/fixtures/decorators/deployment/secret/envFrom.yaml +27 -0
- data/spec/fixtures/decorators/deployment/secret/valueFrom.yaml +30 -0
- data/spec/fixtures/decorators/deployment/secret/volumes.yaml +34 -0
- data/spec/fixtures/decorators/pod/configMap/envFrom.yaml +12 -0
- data/spec/fixtures/decorators/pod/configMap/valueFrom.yaml +16 -0
- data/spec/fixtures/decorators/pod/configMap/volumes.yaml +19 -0
- data/spec/fixtures/decorators/pod/secret/envFrom.yaml +12 -0
- data/spec/fixtures/decorators/pod/secret/valueFrom.yaml +16 -0
- data/spec/fixtures/decorators/pod/secret/volumes.yaml +19 -0
- data/spec/fixtures/deployments/minimum.rb +5 -0
- data/spec/fixtures/deployments/props.rb +7 -0
- data/spec/fixtures/deployments/setter/container.rb +11 -0
- data/spec/fixtures/deployments/setter/containers.rb +14 -0
- data/spec/fixtures/deployments/setter/metadata.rb +15 -0
- data/spec/fixtures/deployments/setter/sidecar.rb +12 -0
- data/spec/fixtures/deployments/setter/spec.rb +10 -0
- data/spec/fixtures/multiple-files/deployment-1.rb +4 -0
- data/spec/fixtures/multiple-files/deployment-2.rb +4 -0
- data/spec/fixtures/project/.gitignore +1 -0
- data/spec/fixtures/project/.kubes/resources/deployment.rb +32 -0
- data/spec/fixtures/project/.kubes/resources/foobar.rb +0 -0
- data/spec/fixtures/project/.kubes/resources/service.rb +3 -0
- data/spec/fixtures/services/minimum.rb +3 -0
- data/spec/fixtures/syntax/network_policy.rb +3 -0
- data/spec/fixtures/syntax/pod.rb +1 -0
- data/spec/kubes/compiler/decorator/resources/deployment_spec.rb +92 -0
- data/spec/kubes/compiler/decorator/resources/pod_spec.rb +92 -0
- data/spec/kubes/compiler/strategy/dsl_spec.rb +36 -0
- data/spec/kubes/compiler_spec.rb +10 -0
- data/spec/kubes/dsl/daemon_set.rb +11 -0
- data/spec/kubes/dsl/deployment_spec.rb +60 -0
- data/spec/kubes/dsl/network_policy_spec.rb +14 -0
- data/spec/kubes/dsl/pod_spec.rb +11 -0
- data/spec/kubes/dsl/service_spec.rb +12 -0
- data/spec/kubes/kubectl/batch_spec.rb +24 -0
- data/spec/spec_helper.rb +34 -0
- metadata +607 -22
- data/bin/console +0 -14
- data/bin/setup +0 -8
@@ -0,0 +1,67 @@
|
|
1
|
+
---
|
2
|
+
title: YAML Example
|
3
|
+
---
|
4
|
+
|
5
|
+
Kubes provides helper methods to make creating extra environments easy: `with_extra`. We'll create extra environments under different namespaces.
|
6
|
+
|
7
|
+
Here's how you achieve extra environments with the YAML form:
|
8
|
+
|
9
|
+
.kubes/resources/web/deployment.rb
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
---
|
13
|
+
apiVersion: apps/v1
|
14
|
+
kind: Deployment
|
15
|
+
metadata:
|
16
|
+
name: demo-web
|
17
|
+
labels:
|
18
|
+
app: demo
|
19
|
+
namespace: <%= with_extra("default") %>
|
20
|
+
spec:
|
21
|
+
replicas: 2
|
22
|
+
selector:
|
23
|
+
matchLabels:
|
24
|
+
app: demo
|
25
|
+
template:
|
26
|
+
metadata:
|
27
|
+
labels:
|
28
|
+
app: demo
|
29
|
+
spec:
|
30
|
+
containers:
|
31
|
+
- image: <%= built_image %>
|
32
|
+
name: demo-web
|
33
|
+
```
|
34
|
+
|
35
|
+
.kubes/resources/web/service.rb
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
---
|
39
|
+
apiVersion: v1
|
40
|
+
kind: Service
|
41
|
+
metadata:
|
42
|
+
name: demo-web
|
43
|
+
labels:
|
44
|
+
app: demo
|
45
|
+
namespace: <%= with_extra("default") %>
|
46
|
+
spec:
|
47
|
+
ports:
|
48
|
+
- port: 80
|
49
|
+
protocol: TCP
|
50
|
+
targetPort: 8080
|
51
|
+
selector:
|
52
|
+
app: demo
|
53
|
+
type: NodePort
|
54
|
+
```
|
55
|
+
|
56
|
+
It's important to use the `with_extra` helper to set the namesapce. The helper accounts for `KUBES_EXTRA` and appends the value.
|
57
|
+
|
58
|
+
## Deployment
|
59
|
+
|
60
|
+
Then to create an additional environment, it's simple:
|
61
|
+
|
62
|
+
kubectl create ns default-2
|
63
|
+
KUBES_EXTRA=2 kubes deploy
|
64
|
+
|
65
|
+
To check on the resources:
|
66
|
+
|
67
|
+
kubectl get all -n default-2
|
@@ -0,0 +1,19 @@
|
|
1
|
+
---
|
2
|
+
title: Helpers
|
3
|
+
---
|
4
|
+
|
5
|
+
Kubes provides some helper methods to help write Kubernetes YAML files. Here's a list of the helper methods. These are available whether you write your resources in YAML or DSL.
|
6
|
+
|
7
|
+
Helper | Description
|
8
|
+
--- | ---
|
9
|
+
built_image | Method refers to the latest Docker image built by Kubes. This spares you from having to update the image manually in the deployment resource.
|
10
|
+
dockerfile_port | Exposed port extracted from the Dockerfile of the project.
|
11
|
+
extra | The `KUBES_EXTRA` value.
|
12
|
+
with_extra | Appends the `KUBES_EXTRA` value to a string if it's set. It's covered in the [Extra Env Docs]({% link _docs/extra-env.md %}).
|
13
|
+
|
14
|
+
Here's also the source code with the helpers: [helpers.rb](https://github.com/boltops-tools/kubes/blob/master/lib/kubes/compiler/shared/helpers.rb).
|
15
|
+
|
16
|
+
|
17
|
+
## DSL Specific Methods
|
18
|
+
|
19
|
+
Each DSL resource has it's own specific methods. Refer to the [DSL Docs]({% link _docs/dsl.md %}) for their methods.
|
data/docs/_docs/intro.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
title: What is Kubes?
|
3
|
+
---
|
4
|
+
|
5
|
+
{% include reference.md %}
|
6
|
+
|
7
|
+
## Features:
|
8
|
+
|
9
|
+
* Automation: [Builds the Docker image]({% link _docs/config/docker.md %}) and updates the compiled YAML files
|
10
|
+
* Syntactic Sugar: Use an [ERB/YAML]({% link _docs/yaml.md %}) or a [DSL]({% link _docs/dsl.md %}) to write your Kubernetes YAML files. You can use a mix of DSL and YAML definitions in the `.kubes/resources` folder.
|
11
|
+
* Layering: Use the same Kubernetes YAML to build multiple environments like dev and prod with [layering]({% link _docs/layering.md %}).
|
12
|
+
* CLI Customizations: You can customize the [cli args]({% link _docs/config/kubectl.md %}). You can also run hooks before and after kubectl commands.
|
13
|
+
* Automated Suffix Hashes: Automatically appends a suffix hash to ConfigMap and Secret resources. More details in [ConfigMap]({% link _docs/dsl/resources/config_map.md %}) and [Secret]({% link _docs/dsl/resources/secret.md %}) docs.
|
14
|
+
* Kustomize Support: If you’re a kustomization user, you can use it with Kubes. More details in [Kustomize Support Docs]({% link _docs/kustomize.md %}).
|
15
|
+
* Auto Context Switching: Map dev to a specific kubectl context and prod to another kubectl context and Kubes can switch them automatically so you won't have to remember. More details in [Auto Context Docs]({% link _docs/auto-context.md %}).
|
@@ -0,0 +1,37 @@
|
|
1
|
+
---
|
2
|
+
title: Kubes Concepts
|
3
|
+
---
|
4
|
+
|
5
|
+
## Resources Files
|
6
|
+
|
7
|
+
The `.kubes/resources` where you organized Kubernetes resources. Different subfolders within the resources folder represent your app. Example:
|
8
|
+
|
9
|
+
.kubes
|
10
|
+
└── resources
|
11
|
+
├── clock
|
12
|
+
│ └── deployment.yaml
|
13
|
+
├── worker
|
14
|
+
│ └── deployment.yaml
|
15
|
+
└── web
|
16
|
+
├── deployment.yaml
|
17
|
+
└── service.yaml
|
18
|
+
|
19
|
+
Each folder contains your Kubernetes deployment definition, either in [YAML]({% link _docs/yaml.md %}) or [DSL]({% link _docs/dsl.md %}) form. Both can be used together.
|
20
|
+
|
21
|
+
## Conventions Over Configuration
|
22
|
+
|
23
|
+
Kubes uses Conventions Over Configuration structure to remove boilerplate setup and mental overhead.
|
24
|
+
|
25
|
+
You can deploy just the demo-web app
|
26
|
+
|
27
|
+
kubes deploy web
|
28
|
+
|
29
|
+
Or you can deploy all 3 with:
|
30
|
+
|
31
|
+
kubes deploy
|
32
|
+
|
33
|
+
The deploy command automatically builds the Docker image and replaces the image in the YAML file with the latest built image.
|
34
|
+
|
35
|
+
## Layering
|
36
|
+
|
37
|
+
Kubes supports layering files together so you can use the same Kubernetes files to build multiple environments like dev and prod. More details in the [Layering Docs]({% link _docs/layering.md %}).
|
@@ -0,0 +1,29 @@
|
|
1
|
+
---
|
2
|
+
title: How Kubes Works
|
3
|
+
---
|
4
|
+
|
5
|
+
Kubes is pretty straightforward. Kubes first builds the Docker image. Then it compiles Kubernetes YAML files. Lastly, it merely calls out to `kubectl`.
|
6
|
+
|
7
|
+
In fact, you can use Kubes to build the files first, and then run `kubectl` directly. Example:
|
8
|
+
|
9
|
+
kubes docker build
|
10
|
+
kubes docker push
|
11
|
+
kubes compile # compiles the .kubes/resources files to .kubes/output
|
12
|
+
|
13
|
+
Now, use `kubectl` directly. This will apply all the files:
|
14
|
+
|
15
|
+
kubectl apply --recursive -f .kubes/output
|
16
|
+
|
17
|
+
You can also selectively apply specific files:
|
18
|
+
|
19
|
+
kubectl apply -f .kubes/output/web/deployment.yaml
|
20
|
+
kubectl apply -f .kubes/output/web/service.yaml
|
21
|
+
|
22
|
+
You can also apply with kubes. This will compile the files automatically also.
|
23
|
+
|
24
|
+
kubes apply
|
25
|
+
|
26
|
+
The deploy command, does all 3 steps: builds the docker image, compiles the `.kubes/resources` files, and runs kubectl apply.
|
27
|
+
|
28
|
+
kubes deploy
|
29
|
+
|
@@ -0,0 +1,63 @@
|
|
1
|
+
---
|
2
|
+
title: Ordering
|
3
|
+
---
|
4
|
+
|
5
|
+
Generally, Kubes will apply resources in order so dependent resources are created first. If needed, you can completely customize the order: [Custom Ordering]({% link _docs/intro/ordering/custom.md %}).
|
6
|
+
|
7
|
+
## Apply
|
8
|
+
|
9
|
+
Here's an example that shows it creating the service and deployment first, and then the ingress last.
|
10
|
+
|
11
|
+
$ kubes apply
|
12
|
+
Compiled .kubes/resources files
|
13
|
+
Deploying kubes files
|
14
|
+
=> kubectl apply -f .kubes/output/web/service.yaml
|
15
|
+
service/demo-web created
|
16
|
+
=> kubectl apply -f .kubes/output/web/deployment.yaml
|
17
|
+
deployment.apps/demo-web created
|
18
|
+
=> kubectl apply -f .kubes/output/web/ingress.yaml
|
19
|
+
ingress.networking.k8s.io/demo-web created
|
20
|
+
$
|
21
|
+
|
22
|
+
## Delete
|
23
|
+
|
24
|
+
Kubes will delete in the reverse order.
|
25
|
+
|
26
|
+
$ kubes delete -y
|
27
|
+
Compiled .kubes/resources files
|
28
|
+
=> kubectl delete -f .kubes/output/web/ingress.yaml
|
29
|
+
ingress.networking.k8s.io "demo-web" deleted
|
30
|
+
=> kubectl delete -f .kubes/output/web/deployment.yaml
|
31
|
+
deployment.apps "demo-web" deleted
|
32
|
+
=> kubectl delete -f .kubes/output/web/service.yaml
|
33
|
+
service "demo-web" deleted
|
34
|
+
$
|
35
|
+
|
36
|
+
## Shared Resources First
|
37
|
+
|
38
|
+
Resources in the `shared` folder will be applied first. Example:
|
39
|
+
|
40
|
+
.kubes
|
41
|
+
└── resources
|
42
|
+
├── clock
|
43
|
+
│ └── deployment.yaml
|
44
|
+
├── web
|
45
|
+
│ ├── deployment.yaml
|
46
|
+
│ └── service.yaml
|
47
|
+
└── shared
|
48
|
+
├── config_map.yaml
|
49
|
+
└── secret.yaml
|
50
|
+
|
51
|
+
Results in:
|
52
|
+
|
53
|
+
$ kubes apply
|
54
|
+
=> kubectl apply -f .kubes/output/shared/secret.yaml
|
55
|
+
secret/demo-secret created
|
56
|
+
=> kubectl apply -f .kubes/output/clock/deployment.yaml
|
57
|
+
deployment.apps/demo-clock created
|
58
|
+
=> kubectl apply -f .kubes/output/web/service.yaml
|
59
|
+
service/demo-web created
|
60
|
+
=> kubectl apply -f .kubes/output/web/deployment.yaml
|
61
|
+
deployment.apps/demo-web created
|
62
|
+
$
|
63
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
---
|
2
|
+
title: Custom Ordering
|
3
|
+
---
|
4
|
+
|
5
|
+
You can override the ordering with the `kinds` and `roles` option under the `config.kubectl.order` key. It is fully configurable. Here's an example of overriding the default ordering.
|
6
|
+
|
7
|
+
.kubes/config.rb:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
Kubes.configure do |config|
|
11
|
+
config.kubectl.order.roles = %w[
|
12
|
+
shared
|
13
|
+
web
|
14
|
+
worker
|
15
|
+
clock
|
16
|
+
]
|
17
|
+
config.kubectl.order.kinds = [
|
18
|
+
"Namespace",
|
19
|
+
# ...
|
20
|
+
"Deployment",
|
21
|
+
]
|
22
|
+
end
|
23
|
+
```
|
24
|
+
|
25
|
+
Items not listed in the list are sorted at the end and in alphabetical order. Refer to the source [ordering.rb](https://github.com/boltops-tools/kubes/blob/master/lib/kubes/config.rb#L50) for the default ordering.
|
@@ -0,0 +1,43 @@
|
|
1
|
+
---
|
2
|
+
title: Kubes Structure
|
3
|
+
---
|
4
|
+
|
5
|
+
Here's what a .kubes folder structure can look like this:
|
6
|
+
|
7
|
+
.kubes
|
8
|
+
├── config
|
9
|
+
│ ├── docker
|
10
|
+
│ │ ├── args.rb
|
11
|
+
│ │ └── hooks.rb
|
12
|
+
│ ├── env
|
13
|
+
│ │ ├── dev.rb
|
14
|
+
│ │ └── prod.rb
|
15
|
+
│ └── kubectl
|
16
|
+
│ ├── args.rb
|
17
|
+
│ └── hooks.rb
|
18
|
+
├── config.rb
|
19
|
+
├── output
|
20
|
+
├── resources
|
21
|
+
│ ├── base
|
22
|
+
│ │ └── all.yaml
|
23
|
+
│ ├── clock
|
24
|
+
│ │ └── deployment.yaml
|
25
|
+
│ ├── shared
|
26
|
+
│ │ ├── config_map.yaml
|
27
|
+
│ │ └── secret.yaml
|
28
|
+
│ ├── web
|
29
|
+
│ │ ├── deployment.yaml
|
30
|
+
│ │ └── service.yaml
|
31
|
+
│ └── worker
|
32
|
+
│ └── deployment.yaml
|
33
|
+
└── state
|
34
|
+
|
35
|
+
Name | Description
|
36
|
+
--- | ---
|
37
|
+
base | The base folder is processed first and can be used to define common fields and resources. Learn more on the [Layering Docs]({% link _docs/layering.md %}).
|
38
|
+
config | The config folder can be used to configure behavior of Kubes. The [docker]({% link _docs/config/docker.md %}) config is used to customize the docker command. The [env]({% link _docs/config/env.md %}) config is used to override `config.rb` settings on a `KUBES_ENV` basis. The [kubectl]({% link _docs/config/kubectl.md %}) config is used to customize the kubectl command.
|
39
|
+
config.rb | The main thing to configure here is the repo to push the docker image to.
|
40
|
+
output | Where kubes builds and writes the Kubernetes YAML to.
|
41
|
+
resources | Where you define your Kubernetes resources.
|
42
|
+
shared | The shared folder is where you can put shared resources. This folder gets applied first. More info: [Ordering]({% link _docs/intro/ordering.md %}).
|
43
|
+
state | Temporary state info that stores the built Docker image name.
|
@@ -0,0 +1,54 @@
|
|
1
|
+
---
|
2
|
+
title: Kustomize Support
|
3
|
+
---
|
4
|
+
|
5
|
+
Kubes supports Kustomize. So if you're a kustomization user, you can use it with Kubes.
|
6
|
+
|
7
|
+
## Structure
|
8
|
+
|
9
|
+
If there are any kustomization.yaml files in your `.kubes/resources` folder, Kubes kustomize mode is automatically enabled. Example structure:
|
10
|
+
|
11
|
+
.kubes/resources
|
12
|
+
├── base
|
13
|
+
│ ├── deployment.yaml
|
14
|
+
│ ├── kustomization.yaml
|
15
|
+
│ └── service.yaml
|
16
|
+
└── overlays
|
17
|
+
├── dev
|
18
|
+
│ └── kustomization.yaml
|
19
|
+
└── prod
|
20
|
+
└── kustomization.yaml
|
21
|
+
|
22
|
+
## Deploy
|
23
|
+
|
24
|
+
In Kustomize mode, Kubes will call `kubectl apply -k`. Here's an example:
|
25
|
+
|
26
|
+
kubes deploy overlays/dev
|
27
|
+
|
28
|
+
Will call:
|
29
|
+
|
30
|
+
kubectl apply -k .kubes/output/overlays/dev
|
31
|
+
|
32
|
+
With Kubes kustomize mode, an argument to the kubes commands are generally required. The argument is the folder within the `.kubes/resources` folder.
|
33
|
+
|
34
|
+
## Environments
|
35
|
+
|
36
|
+
To deploy different kustomize environments using different overlays:
|
37
|
+
|
38
|
+
kubes deploy overlays/prod
|
39
|
+
|
40
|
+
This results in:
|
41
|
+
|
42
|
+
kubectl apply -k .kubes/output/overlays/prod
|
43
|
+
|
44
|
+
## Get
|
45
|
+
|
46
|
+
To check created resources.
|
47
|
+
|
48
|
+
kubes get overlays/dev
|
49
|
+
|
50
|
+
## Compile
|
51
|
+
|
52
|
+
With kustomize mode, all files in `.kubes/resources` are compiled and written to `.kubes/output`.
|
53
|
+
|
54
|
+
Also, no Kubes layering is performed, as kustomization overlays should be used instead.
|
@@ -0,0 +1,8 @@
|
|
1
|
+
---
|
2
|
+
title: Layering
|
3
|
+
---
|
4
|
+
|
5
|
+
Kubes supports layering files together so you can use the same Kubernetes files to build multiple environments like dev and prod.
|
6
|
+
|
7
|
+
* [YAML Layering]({% link _docs/layering/yaml.md %})
|
8
|
+
* [DSL Layering]({% link _docs/layering/dsl.md %})
|
@@ -0,0 +1,96 @@
|
|
1
|
+
---
|
2
|
+
title: DSL Merge Behavior
|
3
|
+
---
|
4
|
+
|
5
|
+
Generally, the merge should behave as expected. For example, map or Hash fields are merged together from multiple layers. Strings are simply replaced.
|
6
|
+
|
7
|
+
## Hash Example
|
8
|
+
|
9
|
+
.kubes/resources/base/all.rb
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
labels(app: "demo")
|
13
|
+
# ...
|
14
|
+
```
|
15
|
+
|
16
|
+
.kubes/resources/base/all/env.rb
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
labels(env: Kubes.env)
|
20
|
+
# ...
|
21
|
+
```
|
22
|
+
|
23
|
+
.kubes/resources/web/deployment.rb
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
labels(role: "web")
|
27
|
+
# ...
|
28
|
+
```
|
29
|
+
|
30
|
+
Layering results in:
|
31
|
+
|
32
|
+
.kubes/output/web/deployment.yaml
|
33
|
+
|
34
|
+
```yaml
|
35
|
+
metadata:
|
36
|
+
labels:
|
37
|
+
app: demo
|
38
|
+
env: dev
|
39
|
+
role: web
|
40
|
+
# ...
|
41
|
+
```
|
42
|
+
|
43
|
+
## Hash Merge Behavior Override
|
44
|
+
|
45
|
+
You can override the merge behavior with the `_mode` key.
|
46
|
+
|
47
|
+
.kubes/resources/web/deployment.rb
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
labels(role: "web", _mode: "reset")
|
51
|
+
# ...
|
52
|
+
```
|
53
|
+
|
54
|
+
This will completely reset the labels and result in:
|
55
|
+
|
56
|
+
```yaml
|
57
|
+
metadata:
|
58
|
+
labels:
|
59
|
+
role: web
|
60
|
+
# ...
|
61
|
+
```
|
62
|
+
|
63
|
+
## String Example
|
64
|
+
|
65
|
+
The merging of simple String is a straightforward replacement.
|
66
|
+
|
67
|
+
.kubes/resources/web/deployment.rb
|
68
|
+
|
69
|
+
```ruby
|
70
|
+
image built_image # IE: user/demo:kubes-2020-06-13T19-55-16-43afc6e
|
71
|
+
# ...
|
72
|
+
```
|
73
|
+
|
74
|
+
.kubes/resources/web/deployment/prod.rb
|
75
|
+
|
76
|
+
```ruby
|
77
|
+
image "nginx:prod-v1"
|
78
|
+
# ...
|
79
|
+
```
|
80
|
+
|
81
|
+
Results in:
|
82
|
+
|
83
|
+
.kubes/output/web/deployment.yaml
|
84
|
+
|
85
|
+
```yaml
|
86
|
+
spec:
|
87
|
+
# ...
|
88
|
+
template:
|
89
|
+
spec:
|
90
|
+
containers:
|
91
|
+
- image: nginx:prod-v1
|
92
|
+
name: demo-web
|
93
|
+
# ...
|
94
|
+
```
|
95
|
+
|
96
|
+
{% include dsl/methods.md name="backend_config" %}
|