kuby-kube-db 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (170) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +19 -0
  3. data/LICENSE +21 -0
  4. data/Rakefile +74 -0
  5. data/kuby-kube-db.gemspec +19 -0
  6. data/lib/kuby/kube-db.rb +13 -0
  7. data/lib/kuby/kube-db/dsl.rb +7 -0
  8. data/lib/kuby/kube-db/dsl/api.rb +3 -0
  9. data/lib/kuby/kube-db/dsl/api/v1.rb +20 -0
  10. data/lib/kuby/kube-db/dsl/api/v1/agent_spec.rb +24 -0
  11. data/lib/kuby/kube-db/dsl/api/v1/azure_spec.rb +17 -0
  12. data/lib/kuby/kube-db/dsl/api/v1/b2_spec.rb +17 -0
  13. data/lib/kuby/kube-db/dsl/api/v1/backend.rb +29 -0
  14. data/lib/kuby/kube-db/dsl/api/v1/gcs_spec.rb +17 -0
  15. data/lib/kuby/kube-db/dsl/api/v1/local_spec.rb +72 -0
  16. data/lib/kuby/kube-db/dsl/api/v1/object_meta.rb +34 -0
  17. data/lib/kuby/kube-db/dsl/api/v1/pod_spec.rb +41 -0
  18. data/lib/kuby/kube-db/dsl/api/v1/pod_template_spec.rb +19 -0
  19. data/lib/kuby/kube-db/dsl/api/v1/prometheus_exporter_spec.rb +22 -0
  20. data/lib/kuby/kube-db/dsl/api/v1/prometheus_spec.rb +23 -0
  21. data/lib/kuby/kube-db/dsl/api/v1/rest_server_spec.rb +15 -0
  22. data/lib/kuby/kube-db/dsl/api/v1/s3_spec.rb +18 -0
  23. data/lib/kuby/kube-db/dsl/api/v1/service_monitor_spec.rb +18 -0
  24. data/lib/kuby/kube-db/dsl/api/v1/service_port.rb +17 -0
  25. data/lib/kuby/kube-db/dsl/api/v1/service_spec.rb +25 -0
  26. data/lib/kuby/kube-db/dsl/api/v1/service_template_spec.rb +17 -0
  27. data/lib/kuby/kube-db/dsl/api/v1/swift_spec.rb +16 -0
  28. data/lib/kuby/kube-db/dsl/appcatalog.rb +3 -0
  29. data/lib/kuby/kube-db/dsl/appcatalog/v1alpha1.rb +3 -0
  30. data/lib/kuby/kube-db/dsl/appcatalog/v1alpha1/app_reference.rb +17 -0
  31. data/lib/kuby/kube-db/dsl/catalog.rb +3 -0
  32. data/lib/kuby/kube-db/dsl/catalog/v1alpha1.rb +65 -0
  33. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/elasticsearch_version.rb +20 -0
  34. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/elasticsearch_version_database.rb +15 -0
  35. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/elasticsearch_version_exporter.rb +15 -0
  36. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/elasticsearch_version_init_container.rb +16 -0
  37. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/elasticsearch_version_list.rb +20 -0
  38. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/elasticsearch_version_pod_security_policy.rb +15 -0
  39. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/elasticsearch_version_spec.rb +27 -0
  40. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/elasticsearch_version_tools.rb +15 -0
  41. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/etcd_version.rb +20 -0
  42. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/etcd_version_database.rb +15 -0
  43. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/etcd_version_exporter.rb +15 -0
  44. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/etcd_version_list.rb +20 -0
  45. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/etcd_version_spec.rb +22 -0
  46. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/etcd_version_tools.rb +15 -0
  47. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/memcached_version.rb +20 -0
  48. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/memcached_version_database.rb +15 -0
  49. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/memcached_version_exporter.rb +15 -0
  50. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/memcached_version_list.rb +20 -0
  51. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/memcached_version_pod_security_policy.rb +15 -0
  52. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/memcached_version_spec.rb +22 -0
  53. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/mongo_db_version.rb +20 -0
  54. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/mongo_db_version_database.rb +15 -0
  55. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/mongo_db_version_exporter.rb +15 -0
  56. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/mongo_db_version_init_container.rb +15 -0
  57. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/mongo_db_version_list.rb +20 -0
  58. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/mongo_db_version_pod_security_policy.rb +15 -0
  59. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/mongo_db_version_spec.rb +26 -0
  60. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/mongo_db_version_tools.rb +15 -0
  61. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/my_sql_version.rb +20 -0
  62. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/my_sql_version_database.rb +15 -0
  63. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/my_sql_version_exporter.rb +15 -0
  64. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/my_sql_version_init_container.rb +15 -0
  65. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/my_sql_version_list.rb +20 -0
  66. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/my_sql_version_pod_security_policy.rb +15 -0
  67. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/my_sql_version_replication_mode_detector.rb +15 -0
  68. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/my_sql_version_spec.rb +28 -0
  69. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/my_sql_version_tools.rb +15 -0
  70. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/percona_xtra_db_version.rb +20 -0
  71. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/percona_xtra_db_version_database.rb +15 -0
  72. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/percona_xtra_db_version_exporter.rb +15 -0
  73. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/percona_xtra_db_version_init_container.rb +15 -0
  74. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/percona_xtra_db_version_list.rb +20 -0
  75. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/percona_xtra_db_version_pod_security_policy.rb +15 -0
  76. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/percona_xtra_db_version_spec.rb +24 -0
  77. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/postgres_version.rb +20 -0
  78. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/postgres_version_database.rb +15 -0
  79. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/postgres_version_exporter.rb +15 -0
  80. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/postgres_version_list.rb +20 -0
  81. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/postgres_version_pod_security_policy.rb +15 -0
  82. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/postgres_version_spec.rb +24 -0
  83. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/postgres_version_tools.rb +15 -0
  84. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/proxy_sql_version.rb +20 -0
  85. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/proxy_sql_version_exporter.rb +15 -0
  86. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/proxy_sql_version_list.rb +20 -0
  87. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/proxy_sql_version_pod_security_policy.rb +15 -0
  88. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/proxy_sql_version_proxysql.rb +15 -0
  89. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/proxy_sql_version_spec.rb +22 -0
  90. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/redis_version.rb +20 -0
  91. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/redis_version_database.rb +15 -0
  92. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/redis_version_exporter.rb +15 -0
  93. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/redis_version_list.rb +20 -0
  94. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/redis_version_pod_security_policy.rb +15 -0
  95. data/lib/kuby/kube-db/dsl/catalog/v1alpha1/redis_version_spec.rb +22 -0
  96. data/lib/kuby/kube-db/dsl/kubedb.rb +3 -0
  97. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1.rb +69 -0
  98. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/certificate_spec.rb +20 -0
  99. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/connection_pool_config.rb +28 -0
  100. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/databases.rb +20 -0
  101. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/elasticsearch.rb +22 -0
  102. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/elasticsearch_cluster_topology.rb +19 -0
  103. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/elasticsearch_list.rb +20 -0
  104. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/elasticsearch_node.rb +21 -0
  105. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/elasticsearch_spec.rb +44 -0
  106. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/elasticsearch_status.rb +17 -0
  107. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/etcd.rb +22 -0
  108. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/etcd_list.rb +20 -0
  109. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/etcd_spec.rb +36 -0
  110. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/etcd_status.rb +17 -0
  111. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/init_spec.rb +19 -0
  112. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/leader_election_config.rb +17 -0
  113. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/maria_db.rb +22 -0
  114. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/maria_db_list.rb +20 -0
  115. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/maria_db_spec.rb +36 -0
  116. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/maria_db_status.rb +17 -0
  117. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/member_secret.rb +16 -0
  118. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/memcached.rb +22 -0
  119. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/memcached_list.rb +20 -0
  120. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/memcached_spec.rb +29 -0
  121. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/memcached_status.rb +17 -0
  122. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/mongo_db.rb +22 -0
  123. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/mongo_db_config_node.rb +22 -0
  124. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/mongo_db_list.rb +20 -0
  125. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/mongo_db_mongos_node.rb +22 -0
  126. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/mongo_db_replica_set.rb +15 -0
  127. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/mongo_db_shard_node.rb +23 -0
  128. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/mongo_db_sharding_topology.rb +19 -0
  129. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/mongo_db_spec.rb +46 -0
  130. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/mongo_db_status.rb +17 -0
  131. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/my_sql.rb +22 -0
  132. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/my_sql_cluster_topology.rb +17 -0
  133. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/my_sql_group_spec.rb +17 -0
  134. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/my_sql_list.rb +20 -0
  135. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/my_sql_spec.rb +40 -0
  136. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/my_sql_status.rb +17 -0
  137. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/percona_xtra_db.rb +22 -0
  138. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/percona_xtra_db_list.rb +20 -0
  139. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/percona_xtra_db_spec.rb +38 -0
  140. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/percona_xtra_db_status.rb +17 -0
  141. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/pg_bouncer.rb +22 -0
  142. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/pg_bouncer_list.rb +20 -0
  143. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/pg_bouncer_spec.rb +31 -0
  144. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/pg_bouncer_status.rb +17 -0
  145. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/postgres.rb +22 -0
  146. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/postgres_archiver_spec.rb +15 -0
  147. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/postgres_list.rb +20 -0
  148. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/postgres_spec.rb +46 -0
  149. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/postgres_status.rb +17 -0
  150. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/postgres_wal_source_spec.rb +32 -0
  151. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/proxy_sql.rb +22 -0
  152. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/proxy_sql_backend_spec.rb +17 -0
  153. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/proxy_sql_list.rb +20 -0
  154. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/proxy_sql_spec.rb +34 -0
  155. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/proxy_sql_status.rb +17 -0
  156. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/recovery_target.rb +18 -0
  157. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/redis.rb +22 -0
  158. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/redis_cluster_spec.rb +16 -0
  159. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/redis_list.rb +20 -0
  160. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/redis_spec.rb +35 -0
  161. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/redis_status.rb +17 -0
  162. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/script_source_spec.rb +71 -0
  163. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/tls_config.rb +17 -0
  164. data/lib/kuby/kube-db/dsl/kubedb/v1alpha1/tls_policy.rb +17 -0
  165. data/lib/kuby/kube-db/dsl/v1.rb +3 -0
  166. data/lib/kuby/kube-db/dsl/v1/volume_source.rb +69 -0
  167. data/lib/kuby/kube-db/entrypoint.rb +269 -0
  168. data/lib/kuby/kube-db/plugin.rb +182 -0
  169. data/lib/kuby/kube-db/version.rb +6 -0
  170. metadata +224 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: fc064eb5250b5089f3e08738f63cc53eab102284a9624d7de8ddba3d7da59ba7
4
+ data.tar.gz: 445713e447e71586a709606349e93e6ccced779202abe22017c9cf7ce0527925
5
+ SHA512:
6
+ metadata.gz: 98286cfb5f8e40bfef7993d48d567fb7f38c5be22031b0fa7ec0a7b6678203504c6c405a02ce71a8a8b6306700323b9975ddfffe6bc3019f07f94bd8b809efc9
7
+ data.tar.gz: 42e2af6271196a739db2031ed7dae88a56726bfbc4272820947f2781c76c30f8bfb627a6bbb5b9a94b159c63b88ccccda51d313a05399364eb2b3398a0f01f34
data/Gemfile ADDED
@@ -0,0 +1,19 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ gem 'dry-inflector'
7
+ gem 'kube-dsl', '~> 0.1'
8
+ end
9
+
10
+ group :development, :test do
11
+ gem 'kuby', path: '../kuby'
12
+ gem 'kuby-cert-manager', path: '../kuby-cert-manager'
13
+ gem 'pry-byebug'
14
+ gem 'rake'
15
+ end
16
+
17
+ group :test do
18
+ gem 'rspec', '~> 3.0'
19
+ end
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Cameron Dutro
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.
@@ -0,0 +1,74 @@
1
+ require 'bundler'
2
+ require 'rspec/core/rake_task'
3
+ require 'rubygems/package_task'
4
+
5
+ require 'kuby/kube-db'
6
+ require 'pry-byebug'
7
+
8
+ Bundler::GemHelper.install_tasks
9
+
10
+ task default: :spec
11
+
12
+ desc 'Run specs'
13
+ RSpec::Core::RakeTask.new do |t|
14
+ t.pattern = './spec/**/*_spec.rb'
15
+ end
16
+
17
+ task :generate do
18
+ require 'dry/inflector'
19
+ require 'fileutils'
20
+
21
+ # delete anything that should be re-generated
22
+ FileUtils.rm_rf('./lib/kuby/kube-db/entrypoint.rb')
23
+ FileUtils.rm_rf('./lib/kuby/kube-db/dsl.rb')
24
+ FileUtils.rm_rf('./lib/kuby/kube-db/dsl')
25
+ FileUtils.mkdir_p('./lib/kuby/kube-db/dsl')
26
+ FileUtils.mkdir_p('./vendor')
27
+
28
+ schema_url = "https://github.com/kubedb/apimachinery/blob/#{Kuby::KubeDB::KUBEDB_VERSION}/api/openapi-spec/swagger.json?raw=true"
29
+ local_json_schema_path = 'vendor/json_schema'
30
+
31
+ unless File.exist?(local_json_schema_path)
32
+ FileUtils.mkdir_p(local_json_schema_path)
33
+ system('docker pull garethr/openapi2jsonschema')
34
+
35
+ system(<<~END)
36
+ docker run --rm \
37
+ -v #{File.expand_path(local_json_schema_path)}:/usr/local/json_schema \
38
+ garethr/openapi2jsonschema \
39
+ --kubernetes --output /usr/local/json_schema #{schema_url}
40
+ END
41
+ end
42
+
43
+ Dir.chdir('lib') do
44
+ generator = KubeDSL::Generator.new(
45
+ schema_dir: File.join('..', local_json_schema_path),
46
+ output_dir: File.join('kuby', 'kube-db', 'dsl'),
47
+ inflector: Dry::Inflector.new do |inflections|
48
+ inflections.acronym('DSL')
49
+ inflections.acronym('DB')
50
+ end
51
+ )
52
+
53
+ # WTF even is xyz.kmodules??
54
+ generator.builder.register_resolver('io.k8s', 'xyz.kmodules') do |ref_str, builder|
55
+ external_ref = ::KubeDSL::ExternalRef.new(
56
+ ref_str,
57
+ ['KubeDSL', 'DSL'],
58
+ 'kube-dsl/dsl',
59
+ builder.inflector,
60
+ builder.schema_dir
61
+ )
62
+
63
+ ns = external_ref.ruby_namespace + [external_ref.kind]
64
+ exists = ns.inject(Object) { |mod, n| mod.const_get(n, false) } rescue false
65
+ exists ? external_ref : builder.parse_ref(ref_str)
66
+ end
67
+
68
+ generator.generate_resource_files
69
+ generator.generate_autoload_files
70
+ generator.generate_entrypoint_file do |resource, ns|
71
+ ns =~ /Kuby::KubeDB::DSL::Kubedb::V1alpha1/
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,19 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), 'lib')
2
+ require 'kuby/kube-db/version'
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = 'kuby-kube-db'
6
+ s.version = ::Kuby::KubeDB::VERSION
7
+ s.authors = ['Cameron Dutro']
8
+ s.email = ['camertron@gmail.com']
9
+ s.homepage = 'http://github.com/camertron/kuby-kube-db'
10
+
11
+ s.description = s.summary = 'KubeDB plugin for Kuby.'
12
+
13
+ s.platform = Gem::Platform::RUBY
14
+
15
+ s.add_dependency 'helm-cli', '~> 0.1'
16
+
17
+ s.require_path = 'lib'
18
+ s.files = Dir['{lib,spec}/**/*', 'Gemfile', 'LICENSE', 'CHANGELOG.md', 'README.md', 'Rakefile', 'kuby-kube-db.gemspec']
19
+ end
@@ -0,0 +1,13 @@
1
+ require 'kube-dsl'
2
+
3
+ module Kuby
4
+ module KubeDB
5
+ autoload :DSL, 'kuby/kube-db/dsl'
6
+ autoload :Entrypoint, 'kuby/kube-db/entrypoint'
7
+ autoload :Plugin, 'kuby/kube-db/plugin'
8
+
9
+ extend Entrypoint
10
+ end
11
+ end
12
+
13
+ Kuby.register_plugin(:kube_db, ::Kuby::KubeDB::Plugin)
@@ -0,0 +1,7 @@
1
+ module Kuby::KubeDB::DSL
2
+ autoload :Catalog, 'kuby/kube-db/dsl/catalog'
3
+ autoload :Kubedb, 'kuby/kube-db/dsl/kubedb'
4
+ autoload :Api, 'kuby/kube-db/dsl/api'
5
+ autoload :Appcatalog, 'kuby/kube-db/dsl/appcatalog'
6
+ autoload :V1, 'kuby/kube-db/dsl/v1'
7
+ end
@@ -0,0 +1,3 @@
1
+ module Kuby::KubeDB::DSL::Api
2
+ autoload :V1, 'kuby/kube-db/dsl/api/v1'
3
+ end
@@ -0,0 +1,20 @@
1
+ module Kuby::KubeDB::DSL::Api::V1
2
+ autoload :RestServerSpec, 'kuby/kube-db/dsl/api/v1/rest_server_spec'
3
+ autoload :ServiceTemplateSpec, 'kuby/kube-db/dsl/api/v1/service_template_spec'
4
+ autoload :SwiftSpec, 'kuby/kube-db/dsl/api/v1/swift_spec'
5
+ autoload :S3Spec, 'kuby/kube-db/dsl/api/v1/s3_spec'
6
+ autoload :PodTemplateSpec, 'kuby/kube-db/dsl/api/v1/pod_template_spec'
7
+ autoload :ServiceMonitorSpec, 'kuby/kube-db/dsl/api/v1/service_monitor_spec'
8
+ autoload :B2Spec, 'kuby/kube-db/dsl/api/v1/b2_spec'
9
+ autoload :ObjectMeta, 'kuby/kube-db/dsl/api/v1/object_meta'
10
+ autoload :PodSpec, 'kuby/kube-db/dsl/api/v1/pod_spec'
11
+ autoload :PrometheusExporterSpec, 'kuby/kube-db/dsl/api/v1/prometheus_exporter_spec'
12
+ autoload :AzureSpec, 'kuby/kube-db/dsl/api/v1/azure_spec'
13
+ autoload :LocalSpec, 'kuby/kube-db/dsl/api/v1/local_spec'
14
+ autoload :ServicePort, 'kuby/kube-db/dsl/api/v1/service_port'
15
+ autoload :Backend, 'kuby/kube-db/dsl/api/v1/backend'
16
+ autoload :ServiceSpec, 'kuby/kube-db/dsl/api/v1/service_spec'
17
+ autoload :AgentSpec, 'kuby/kube-db/dsl/api/v1/agent_spec'
18
+ autoload :PrometheusSpec, 'kuby/kube-db/dsl/api/v1/prometheus_spec'
19
+ autoload :GCSSpec, 'kuby/kube-db/dsl/api/v1/gcs_spec'
20
+ end
@@ -0,0 +1,24 @@
1
+ module Kuby::KubeDB::DSL::Api::V1
2
+ class AgentSpec < ::KubeDSL::DSLObject
3
+ value_fields :args, :agent
4
+ array_field(:env) { KubeDSL::DSL::V1::EnvVar.new }
5
+ object_field(:security_context) { KubeDSL::DSL::V1::SecurityContext.new }
6
+ object_field(:prometheus) { Kuby::KubeDB::DSL::Api::V1::PrometheusSpec.new }
7
+ object_field(:resources) { KubeDSL::DSL::V1::ResourceRequirements.new }
8
+
9
+ def serialize
10
+ {}.tap do |result|
11
+ result[:args] = args
12
+ result[:agent] = agent
13
+ result[:env] = envs.map(&:serialize)
14
+ result[:securityContext] = security_context.serialize
15
+ result[:prometheus] = prometheus.serialize
16
+ result[:resources] = resources.serialize
17
+ end
18
+ end
19
+
20
+ def kind_sym
21
+ :agent_spec
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,17 @@
1
+ module Kuby::KubeDB::DSL::Api::V1
2
+ class AzureSpec < ::KubeDSL::DSLObject
3
+ value_fields :prefix, :container, :max_connections
4
+
5
+ def serialize
6
+ {}.tap do |result|
7
+ result[:prefix] = prefix
8
+ result[:container] = container
9
+ result[:maxConnections] = max_connections
10
+ end
11
+ end
12
+
13
+ def kind_sym
14
+ :azure_spec
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ module Kuby::KubeDB::DSL::Api::V1
2
+ class B2Spec < ::KubeDSL::DSLObject
3
+ value_fields :prefix, :bucket, :max_connections
4
+
5
+ def serialize
6
+ {}.tap do |result|
7
+ result[:prefix] = prefix
8
+ result[:bucket] = bucket
9
+ result[:maxConnections] = max_connections
10
+ end
11
+ end
12
+
13
+ def kind_sym
14
+ :b2_spec
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,29 @@
1
+ module Kuby::KubeDB::DSL::Api::V1
2
+ class Backend < ::KubeDSL::DSLObject
3
+ value_fields :storage_secret_name
4
+ object_field(:s3) { Kuby::KubeDB::DSL::Api::V1::S3Spec.new }
5
+ object_field(:swift) { Kuby::KubeDB::DSL::Api::V1::SwiftSpec.new }
6
+ object_field(:rest) { Kuby::KubeDB::DSL::Api::V1::RestServerSpec.new }
7
+ object_field(:gcs) { Kuby::KubeDB::DSL::Api::V1::GCSSpec.new }
8
+ object_field(:b2) { Kuby::KubeDB::DSL::Api::V1::B2Spec.new }
9
+ object_field(:azure) { Kuby::KubeDB::DSL::Api::V1::AzureSpec.new }
10
+ object_field(:local) { Kuby::KubeDB::DSL::Api::V1::LocalSpec.new }
11
+
12
+ def serialize
13
+ {}.tap do |result|
14
+ result[:storageSecretName] = storage_secret_name
15
+ result[:s3] = s3.serialize
16
+ result[:swift] = swift.serialize
17
+ result[:rest] = rest.serialize
18
+ result[:gcs] = gcs.serialize
19
+ result[:b2] = b2.serialize
20
+ result[:azure] = azure.serialize
21
+ result[:local] = local.serialize
22
+ end
23
+ end
24
+
25
+ def kind_sym
26
+ :backend
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,17 @@
1
+ module Kuby::KubeDB::DSL::Api::V1
2
+ class GCSSpec < ::KubeDSL::DSLObject
3
+ value_fields :prefix, :bucket, :max_connections
4
+
5
+ def serialize
6
+ {}.tap do |result|
7
+ result[:prefix] = prefix
8
+ result[:bucket] = bucket
9
+ result[:maxConnections] = max_connections
10
+ end
11
+ end
12
+
13
+ def kind_sym
14
+ :gcs_spec
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,72 @@
1
+ module Kuby::KubeDB::DSL::Api::V1
2
+ class LocalSpec < ::KubeDSL::DSLObject
3
+ value_fields :sub_path, :mount_path
4
+ object_field(:portworx_volume) { KubeDSL::DSL::V1::PortworxVolumeSource.new }
5
+ object_field(:glusterfs) { KubeDSL::DSL::V1::GlusterfsVolumeSource.new }
6
+ object_field(:git_repo) { KubeDSL::DSL::V1::GitRepoVolumeSource.new }
7
+ object_field(:flocker) { KubeDSL::DSL::V1::FlockerVolumeSource.new }
8
+ object_field(:storageos) { KubeDSL::DSL::V1::StorageOSVolumeSource.new }
9
+ object_field(:csi) { KubeDSL::DSL::V1::CSIVolumeSource.new }
10
+ object_field(:iscsi) { KubeDSL::DSL::V1::ISCSIVolumeSource.new }
11
+ object_field(:projected) { KubeDSL::DSL::V1::ProjectedVolumeSource.new }
12
+ object_field(:secret) { KubeDSL::DSL::V1::SecretVolumeSource.new }
13
+ object_field(:scale_io) { KubeDSL::DSL::V1::ScaleIOVolumeSource.new }
14
+ object_field(:photon_persistent_disk) { KubeDSL::DSL::V1::PhotonPersistentDiskVolumeSource.new }
15
+ object_field(:azure_disk) { KubeDSL::DSL::V1::AzureDiskVolumeSource.new }
16
+ object_field(:fc) { KubeDSL::DSL::V1::FCVolumeSource.new }
17
+ object_field(:flex_volume) { KubeDSL::DSL::V1::FlexVolumeSource.new }
18
+ object_field(:empty_dir) { KubeDSL::DSL::V1::EmptyDirVolumeSource.new }
19
+ object_field(:rbd) { KubeDSL::DSL::V1::RBDVolumeSource.new }
20
+ object_field(:persistent_volume_claim) { KubeDSL::DSL::V1::PersistentVolumeClaimVolumeSource.new }
21
+ object_field(:config_map) { KubeDSL::DSL::V1::ConfigMapVolumeSource.new }
22
+ object_field(:azure_file) { KubeDSL::DSL::V1::AzureFileVolumeSource.new }
23
+ object_field(:quobyte) { KubeDSL::DSL::V1::QuobyteVolumeSource.new }
24
+ object_field(:host_path) { KubeDSL::DSL::V1::HostPathVolumeSource.new }
25
+ object_field(:nfs) { KubeDSL::DSL::V1::NFSVolumeSource.new }
26
+ object_field(:vsphere_volume) { KubeDSL::DSL::V1::VsphereVirtualDiskVolumeSource.new }
27
+ object_field(:cinder) { KubeDSL::DSL::V1::CinderVolumeSource.new }
28
+ object_field(:aws_elastic_block_store) { KubeDSL::DSL::V1::AWSElasticBlockStoreVolumeSource.new }
29
+ object_field(:cephfs) { KubeDSL::DSL::V1::CephFSVolumeSource.new }
30
+ object_field(:downward_api) { KubeDSL::DSL::V1::DownwardAPIVolumeSource.new }
31
+ object_field(:gce_persistent_disk) { KubeDSL::DSL::V1::GCEPersistentDiskVolumeSource.new }
32
+
33
+ def serialize
34
+ {}.tap do |result|
35
+ result[:subPath] = sub_path
36
+ result[:mountPath] = mount_path
37
+ result[:portworxVolume] = portworx_volume.serialize
38
+ result[:glusterfs] = glusterfs.serialize
39
+ result[:gitRepo] = git_repo.serialize
40
+ result[:flocker] = flocker.serialize
41
+ result[:storageos] = storageos.serialize
42
+ result[:csi] = csi.serialize
43
+ result[:iscsi] = iscsi.serialize
44
+ result[:projected] = projected.serialize
45
+ result[:secret] = secret.serialize
46
+ result[:scaleIO] = scale_io.serialize
47
+ result[:photonPersistentDisk] = photon_persistent_disk.serialize
48
+ result[:azureDisk] = azure_disk.serialize
49
+ result[:fc] = fc.serialize
50
+ result[:flexVolume] = flex_volume.serialize
51
+ result[:emptyDir] = empty_dir.serialize
52
+ result[:rbd] = rbd.serialize
53
+ result[:persistentVolumeClaim] = persistent_volume_claim.serialize
54
+ result[:configMap] = config_map.serialize
55
+ result[:azureFile] = azure_file.serialize
56
+ result[:quobyte] = quobyte.serialize
57
+ result[:hostPath] = host_path.serialize
58
+ result[:nfs] = nfs.serialize
59
+ result[:vsphereVolume] = vsphere_volume.serialize
60
+ result[:cinder] = cinder.serialize
61
+ result[:awsElasticBlockStore] = aws_elastic_block_store.serialize
62
+ result[:cephfs] = cephfs.serialize
63
+ result[:downwardAPI] = downward_api.serialize
64
+ result[:gcePersistentDisk] = gce_persistent_disk.serialize
65
+ end
66
+ end
67
+
68
+ def kind_sym
69
+ :local_spec
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,34 @@
1
+ module Kuby::KubeDB::DSL::Api::V1
2
+ class ObjectMeta < ::KubeDSL::DSLObject
3
+ value_fields :uid, :deletion_timestamp, :cluster_name, :deletion_grace_period_seconds, :namespace, :generation, :finalizers, :generate_name, :resource_version, :creation_timestamp, :self_link, :name
4
+ array_field(:owner_reference) { KubeDSL::DSL::Meta::V1::OwnerReference.new }
5
+ array_field(:managed_field) { KubeDSL::DSL::Meta::V1::ManagedFieldsEntry.new }
6
+ object_field(:labels) { ::KubeDSL::KeyValueFields.new(format: :string) }
7
+ object_field(:annotations) { ::KubeDSL::KeyValueFields.new(format: :string) }
8
+
9
+ def serialize
10
+ {}.tap do |result|
11
+ result[:uid] = uid
12
+ result[:deletionTimestamp] = deletion_timestamp
13
+ result[:clusterName] = cluster_name
14
+ result[:deletionGracePeriodSeconds] = deletion_grace_period_seconds
15
+ result[:namespace] = namespace
16
+ result[:generation] = generation
17
+ result[:finalizers] = finalizers
18
+ result[:generateName] = generate_name
19
+ result[:resourceVersion] = resource_version
20
+ result[:creationTimestamp] = creation_timestamp
21
+ result[:selfLink] = self_link
22
+ result[:name] = name
23
+ result[:ownerReferences] = owner_references.map(&:serialize)
24
+ result[:managedFields] = managed_fields.map(&:serialize)
25
+ result[:labels] = labels.serialize
26
+ result[:annotations] = annotations.serialize
27
+ end
28
+ end
29
+
30
+ def kind_sym
31
+ :object_meta
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,41 @@
1
+ module Kuby::KubeDB::DSL::Api::V1
2
+ class PodSpec < ::KubeDSL::DSLObject
3
+ value_fields :priority_class_name, :service_account_name, :scheduler_name, :args, :priority
4
+ array_field(:env) { KubeDSL::DSL::V1::EnvVar.new }
5
+ array_field(:toleration) { KubeDSL::DSL::V1::Toleration.new }
6
+ array_field(:init_container) { KubeDSL::DSL::V1::Container.new }
7
+ array_field(:image_pull_secret) { KubeDSL::DSL::V1::LocalObjectReference.new }
8
+ object_field(:liveness_probe) { KubeDSL::DSL::V1::Probe.new }
9
+ object_field(:security_context) { KubeDSL::DSL::V1::PodSecurityContext.new }
10
+ object_field(:affinity) { KubeDSL::DSL::V1::Affinity.new }
11
+ object_field(:readiness_probe) { KubeDSL::DSL::V1::Probe.new }
12
+ object_field(:lifecycle) { KubeDSL::DSL::V1::Lifecycle.new }
13
+ object_field(:resources) { KubeDSL::DSL::V1::ResourceRequirements.new }
14
+ object_field(:node_selector) { ::KubeDSL::KeyValueFields.new(format: :string) }
15
+
16
+ def serialize
17
+ {}.tap do |result|
18
+ result[:priorityClassName] = priority_class_name
19
+ result[:serviceAccountName] = service_account_name
20
+ result[:schedulerName] = scheduler_name
21
+ result[:args] = args
22
+ result[:priority] = priority
23
+ result[:env] = envs.map(&:serialize)
24
+ result[:tolerations] = tolerations.map(&:serialize)
25
+ result[:initContainers] = init_containers.map(&:serialize)
26
+ result[:imagePullSecrets] = image_pull_secrets.map(&:serialize)
27
+ result[:livenessProbe] = liveness_probe.serialize
28
+ result[:securityContext] = security_context.serialize
29
+ result[:affinity] = affinity.serialize
30
+ result[:readinessProbe] = readiness_probe.serialize
31
+ result[:lifecycle] = lifecycle.serialize
32
+ result[:resources] = resources.serialize
33
+ result[:nodeSelector] = node_selector.serialize
34
+ end
35
+ end
36
+
37
+ def kind_sym
38
+ :pod_spec
39
+ end
40
+ end
41
+ end