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,17 @@
1
+ module Kuby::KubeDB::DSL::Kubedb::V1alpha1
2
+ class TLSConfig < ::KubeDSL::DSLObject
3
+ object_field(:issuer_ref) { KubeDSL::DSL::V1::TypedLocalObjectReference.new }
4
+ object_field(:certificate) { Kuby::KubeDB::DSL::Kubedb::V1alpha1::CertificateSpec.new }
5
+
6
+ def serialize
7
+ {}.tap do |result|
8
+ result[:issuerRef] = issuer_ref.serialize
9
+ result[:certificate] = certificate.serialize
10
+ end
11
+ end
12
+
13
+ def kind_sym
14
+ :tls_config
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ module Kuby::KubeDB::DSL::Kubedb::V1alpha1
2
+ class TLSPolicy < ::KubeDSL::DSLObject
3
+ value_fields :operator_secret
4
+ object_field(:member) { Kuby::KubeDB::DSL::Kubedb::V1alpha1::MemberSecret.new }
5
+
6
+ def serialize
7
+ {}.tap do |result|
8
+ result[:operatorSecret] = operator_secret
9
+ result[:member] = member.serialize
10
+ end
11
+ end
12
+
13
+ def kind_sym
14
+ :tls_policy
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,3 @@
1
+ module Kuby::KubeDB::DSL::V1
2
+ autoload :VolumeSource, 'kuby/kube-db/dsl/v1/volume_source'
3
+ end
@@ -0,0 +1,69 @@
1
+ module Kuby::KubeDB::DSL::V1
2
+ class VolumeSource < ::KubeDSL::DSLObject
3
+ object_field(:portworx_volume) { KubeDSL::DSL::V1::PortworxVolumeSource.new }
4
+ object_field(:glusterfs) { KubeDSL::DSL::V1::GlusterfsVolumeSource.new }
5
+ object_field(:git_repo) { KubeDSL::DSL::V1::GitRepoVolumeSource.new }
6
+ object_field(:flocker) { KubeDSL::DSL::V1::FlockerVolumeSource.new }
7
+ object_field(:storageos) { KubeDSL::DSL::V1::StorageOSVolumeSource.new }
8
+ object_field(:csi) { KubeDSL::DSL::V1::CSIVolumeSource.new }
9
+ object_field(:iscsi) { KubeDSL::DSL::V1::ISCSIVolumeSource.new }
10
+ object_field(:projected) { KubeDSL::DSL::V1::ProjectedVolumeSource.new }
11
+ object_field(:secret) { KubeDSL::DSL::V1::SecretVolumeSource.new }
12
+ object_field(:scale_io) { KubeDSL::DSL::V1::ScaleIOVolumeSource.new }
13
+ object_field(:photon_persistent_disk) { KubeDSL::DSL::V1::PhotonPersistentDiskVolumeSource.new }
14
+ object_field(:azure_disk) { KubeDSL::DSL::V1::AzureDiskVolumeSource.new }
15
+ object_field(:fc) { KubeDSL::DSL::V1::FCVolumeSource.new }
16
+ object_field(:flex_volume) { KubeDSL::DSL::V1::FlexVolumeSource.new }
17
+ object_field(:empty_dir) { KubeDSL::DSL::V1::EmptyDirVolumeSource.new }
18
+ object_field(:persistent_volume_claim) { KubeDSL::DSL::V1::PersistentVolumeClaimVolumeSource.new }
19
+ object_field(:config_map) { KubeDSL::DSL::V1::ConfigMapVolumeSource.new }
20
+ object_field(:rbd) { KubeDSL::DSL::V1::RBDVolumeSource.new }
21
+ object_field(:azure_file) { KubeDSL::DSL::V1::AzureFileVolumeSource.new }
22
+ object_field(:quobyte) { KubeDSL::DSL::V1::QuobyteVolumeSource.new }
23
+ object_field(:host_path) { KubeDSL::DSL::V1::HostPathVolumeSource.new }
24
+ object_field(:nfs) { KubeDSL::DSL::V1::NFSVolumeSource.new }
25
+ object_field(:vsphere_volume) { KubeDSL::DSL::V1::VsphereVirtualDiskVolumeSource.new }
26
+ object_field(:cinder) { KubeDSL::DSL::V1::CinderVolumeSource.new }
27
+ object_field(:aws_elastic_block_store) { KubeDSL::DSL::V1::AWSElasticBlockStoreVolumeSource.new }
28
+ object_field(:cephfs) { KubeDSL::DSL::V1::CephFSVolumeSource.new }
29
+ object_field(:downward_api) { KubeDSL::DSL::V1::DownwardAPIVolumeSource.new }
30
+ object_field(:gce_persistent_disk) { KubeDSL::DSL::V1::GCEPersistentDiskVolumeSource.new }
31
+
32
+ def serialize
33
+ {}.tap do |result|
34
+ result[:portworxVolume] = portworx_volume.serialize
35
+ result[:glusterfs] = glusterfs.serialize
36
+ result[:gitRepo] = git_repo.serialize
37
+ result[:flocker] = flocker.serialize
38
+ result[:storageos] = storageos.serialize
39
+ result[:csi] = csi.serialize
40
+ result[:iscsi] = iscsi.serialize
41
+ result[:projected] = projected.serialize
42
+ result[:secret] = secret.serialize
43
+ result[:scaleIO] = scale_io.serialize
44
+ result[:photonPersistentDisk] = photon_persistent_disk.serialize
45
+ result[:azureDisk] = azure_disk.serialize
46
+ result[:fc] = fc.serialize
47
+ result[:flexVolume] = flex_volume.serialize
48
+ result[:emptyDir] = empty_dir.serialize
49
+ result[:persistentVolumeClaim] = persistent_volume_claim.serialize
50
+ result[:configMap] = config_map.serialize
51
+ result[:rbd] = rbd.serialize
52
+ result[:azureFile] = azure_file.serialize
53
+ result[:quobyte] = quobyte.serialize
54
+ result[:hostPath] = host_path.serialize
55
+ result[:nfs] = nfs.serialize
56
+ result[:vsphereVolume] = vsphere_volume.serialize
57
+ result[:cinder] = cinder.serialize
58
+ result[:awsElasticBlockStore] = aws_elastic_block_store.serialize
59
+ result[:cephfs] = cephfs.serialize
60
+ result[:downwardAPI] = downward_api.serialize
61
+ result[:gcePersistentDisk] = gce_persistent_disk.serialize
62
+ end
63
+ end
64
+
65
+ def kind_sym
66
+ :volume_source
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,269 @@
1
+ module Kuby::KubeDB::Entrypoint
2
+ def etcd_status(&block)
3
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::EtcdStatus.new(&block)
4
+ end
5
+
6
+ def etcd(&block)
7
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::Etcd.new(&block)
8
+ end
9
+
10
+ def my_sql_list(&block)
11
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::MySQLList.new(&block)
12
+ end
13
+
14
+ def maria_db_status(&block)
15
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::MariaDBStatus.new(&block)
16
+ end
17
+
18
+ def connection_pool_config(&block)
19
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::ConnectionPoolConfig.new(&block)
20
+ end
21
+
22
+ def maria_db_spec(&block)
23
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::MariaDBSpec.new(&block)
24
+ end
25
+
26
+ def postgres(&block)
27
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::Postgres.new(&block)
28
+ end
29
+
30
+ def mongo_db_config_node(&block)
31
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::MongoDBConfigNode.new(&block)
32
+ end
33
+
34
+ def init_spec(&block)
35
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::InitSpec.new(&block)
36
+ end
37
+
38
+ def mongo_db(&block)
39
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::MongoDB.new(&block)
40
+ end
41
+
42
+ def elasticsearch_status(&block)
43
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::ElasticsearchStatus.new(&block)
44
+ end
45
+
46
+ def percona_xtra_db_list(&block)
47
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::PerconaXtraDBList.new(&block)
48
+ end
49
+
50
+ def memcached_status(&block)
51
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::MemcachedStatus.new(&block)
52
+ end
53
+
54
+ def my_sql_group_spec(&block)
55
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::MySQLGroupSpec.new(&block)
56
+ end
57
+
58
+ def postgres_spec(&block)
59
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::PostgresSpec.new(&block)
60
+ end
61
+
62
+ def pg_bouncer_list(&block)
63
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::PgBouncerList.new(&block)
64
+ end
65
+
66
+ def redis_cluster_spec(&block)
67
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::RedisClusterSpec.new(&block)
68
+ end
69
+
70
+ def mongo_db_spec(&block)
71
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::MongoDBSpec.new(&block)
72
+ end
73
+
74
+ def proxy_sql_list(&block)
75
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::ProxySQLList.new(&block)
76
+ end
77
+
78
+ def percona_xtra_db_spec(&block)
79
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::PerconaXtraDBSpec.new(&block)
80
+ end
81
+
82
+ def memcached_list(&block)
83
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::MemcachedList.new(&block)
84
+ end
85
+
86
+ def mongo_db_list(&block)
87
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::MongoDBList.new(&block)
88
+ end
89
+
90
+ def tls_policy(&block)
91
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::TLSPolicy.new(&block)
92
+ end
93
+
94
+ def my_sql_spec(&block)
95
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::MySQLSpec.new(&block)
96
+ end
97
+
98
+ def proxy_sql_status(&block)
99
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::ProxySQLStatus.new(&block)
100
+ end
101
+
102
+ def mongo_db_sharding_topology(&block)
103
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::MongoDBShardingTopology.new(&block)
104
+ end
105
+
106
+ def proxy_sql(&block)
107
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::ProxySQL.new(&block)
108
+ end
109
+
110
+ def percona_xtra_db(&block)
111
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::PerconaXtraDB.new(&block)
112
+ end
113
+
114
+ def member_secret(&block)
115
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::MemberSecret.new(&block)
116
+ end
117
+
118
+ def etcd_list(&block)
119
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::EtcdList.new(&block)
120
+ end
121
+
122
+ def mongo_db_shard_node(&block)
123
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::MongoDBShardNode.new(&block)
124
+ end
125
+
126
+ def mongo_db_mongos_node(&block)
127
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::MongoDBMongosNode.new(&block)
128
+ end
129
+
130
+ def postgres_status(&block)
131
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::PostgresStatus.new(&block)
132
+ end
133
+
134
+ def memcached_spec(&block)
135
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::MemcachedSpec.new(&block)
136
+ end
137
+
138
+ def maria_db(&block)
139
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::MariaDB.new(&block)
140
+ end
141
+
142
+ def elasticsearch_list(&block)
143
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::ElasticsearchList.new(&block)
144
+ end
145
+
146
+ def redis(&block)
147
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::Redis.new(&block)
148
+ end
149
+
150
+ def memcached(&block)
151
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::Memcached.new(&block)
152
+ end
153
+
154
+ def leader_election_config(&block)
155
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::LeaderElectionConfig.new(&block)
156
+ end
157
+
158
+ def recovery_target(&block)
159
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::RecoveryTarget.new(&block)
160
+ end
161
+
162
+ def elasticsearch_node(&block)
163
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::ElasticsearchNode.new(&block)
164
+ end
165
+
166
+ def tls_config(&block)
167
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::TLSConfig.new(&block)
168
+ end
169
+
170
+ def redis_status(&block)
171
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::RedisStatus.new(&block)
172
+ end
173
+
174
+ def proxy_sql_spec(&block)
175
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::ProxySQLSpec.new(&block)
176
+ end
177
+
178
+ def mongo_db_replica_set(&block)
179
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::MongoDBReplicaSet.new(&block)
180
+ end
181
+
182
+ def redis_spec(&block)
183
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::RedisSpec.new(&block)
184
+ end
185
+
186
+ def my_sql_cluster_topology(&block)
187
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::MySQLClusterTopology.new(&block)
188
+ end
189
+
190
+ def elasticsearch_spec(&block)
191
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::ElasticsearchSpec.new(&block)
192
+ end
193
+
194
+ def my_sql_status(&block)
195
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::MySQLStatus.new(&block)
196
+ end
197
+
198
+ def my_sql(&block)
199
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::MySQL.new(&block)
200
+ end
201
+
202
+ def pg_bouncer_spec(&block)
203
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::PgBouncerSpec.new(&block)
204
+ end
205
+
206
+ def postgres_archiver_spec(&block)
207
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::PostgresArchiverSpec.new(&block)
208
+ end
209
+
210
+ def databases(&block)
211
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::Databases.new(&block)
212
+ end
213
+
214
+ def script_source_spec(&block)
215
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::ScriptSourceSpec.new(&block)
216
+ end
217
+
218
+ def pg_bouncer(&block)
219
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::PgBouncer.new(&block)
220
+ end
221
+
222
+ def etcd_spec(&block)
223
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::EtcdSpec.new(&block)
224
+ end
225
+
226
+ def pg_bouncer_status(&block)
227
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::PgBouncerStatus.new(&block)
228
+ end
229
+
230
+ def elasticsearch(&block)
231
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::Elasticsearch.new(&block)
232
+ end
233
+
234
+ def certificate_spec(&block)
235
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::CertificateSpec.new(&block)
236
+ end
237
+
238
+ def mongo_db_status(&block)
239
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::MongoDBStatus.new(&block)
240
+ end
241
+
242
+ def elasticsearch_cluster_topology(&block)
243
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::ElasticsearchClusterTopology.new(&block)
244
+ end
245
+
246
+ def percona_xtra_db_status(&block)
247
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::PerconaXtraDBStatus.new(&block)
248
+ end
249
+
250
+ def postgres_list(&block)
251
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::PostgresList.new(&block)
252
+ end
253
+
254
+ def maria_db_list(&block)
255
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::MariaDBList.new(&block)
256
+ end
257
+
258
+ def postgres_wal_source_spec(&block)
259
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::PostgresWALSourceSpec.new(&block)
260
+ end
261
+
262
+ def proxy_sql_backend_spec(&block)
263
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::ProxySQLBackendSpec.new(&block)
264
+ end
265
+
266
+ def redis_list(&block)
267
+ ::Kuby::KubeDB::DSL::Kubedb::V1alpha1::RedisList.new(&block)
268
+ end
269
+ end
@@ -0,0 +1,182 @@
1
+ require 'helm-cli'
2
+ require 'kuby'
3
+
4
+ module Kuby
5
+ module KubeDB
6
+ class KubeDBError < StandardError; end
7
+ class OperatorDeployError < KubeDBError; end
8
+
9
+ class Plugin < ::Kuby::Kubernetes::Plugin
10
+ NAMESPACE = 'kube-system'.freeze
11
+ REPO_NAME = 'appscode'.freeze
12
+ REPO_URL = 'https://charts.appscode.com/stable/'.freeze
13
+ OPERATOR_DEPLOYMENT_NAME = 'kubedb-operator'.freeze
14
+ OPERATOR_RELEASE_NAME = 'kubedb-operator'.freeze
15
+ CATALOG_RELEASE_NAME = 'kubedb-catalog'.freeze
16
+ OPERATOR_CHART_NAME = 'appscode/kubedb'.freeze
17
+ CATALOG_CHART_NAME = 'appscode/kubedb-catalog'.freeze
18
+ OPERATOR_WAIT_INTERVAL = 5 # seconds
19
+ OPERATOR_WAIT_MAX = 30 # seconds
20
+
21
+ OPERATOR_PARAMS = {
22
+ 'apiserver.enableValidatingWebhook' => 'true',
23
+ 'apiserver.enableMutatingWebhook' => 'true'
24
+ }
25
+
26
+ OPERATOR_PARAMS.freeze
27
+
28
+ def setup
29
+ Kuby.logger.info('Setting up kubedb')
30
+
31
+ Kuby.logger.info('Fetching Helm chart')
32
+ helm_cli.add_repo(REPO_NAME, REPO_URL)
33
+ helm_cli.update_repos
34
+
35
+ Kuby.logger.info('Deploying kubedb operator')
36
+ operator_deployed? ? upgrade_operator : install_operator
37
+
38
+ wait_for_operator do
39
+ Kuby.logger.info('Waiting for kubedb operator deployment')
40
+ end
41
+
42
+ Kuby.logger.info('Deploying kubedb catalog')
43
+ catalog_deployed? ? upgrade_catalog : install_catalog
44
+
45
+ Kuby.logger.info('Kubedb setup finished')
46
+ end
47
+
48
+ private
49
+
50
+ def install_operator
51
+ helm_cli.install_chart(OPERATOR_CHART_NAME, {
52
+ release: OPERATOR_RELEASE_NAME,
53
+ version: Kuby::KubeDB::KUBEDB_VERSION,
54
+ namespace: NAMESPACE,
55
+ params: OPERATOR_PARAMS
56
+ })
57
+ end
58
+
59
+ def upgrade_operator
60
+ helm_cli.upgrade_chart(OPERATOR_CHART_NAME, {
61
+ release: OPERATOR_RELEASE_NAME,
62
+ version: Kuby::KubeDB::KUBEDB_VERSION,
63
+ namespace: NAMESPACE,
64
+ params: OPERATOR_PARAMS
65
+ })
66
+ end
67
+
68
+ def install_catalog
69
+ helm_cli.install_chart(CATALOG_CHART_NAME, {
70
+ release: CATALOG_RELEASE_NAME,
71
+ version: Kuby::KubeDB::KUBEDB_VERSION,
72
+ namespace: NAMESPACE
73
+ })
74
+ end
75
+
76
+ def upgrade_catalog
77
+ helm_cli.upgrade_chart(CATALOG_CHART_NAME, {
78
+ release: CATALOG_RELEASE_NAME,
79
+ version: Kuby::KubeDB::KUBEDB_VERSION,
80
+ namespace: NAMESPACE
81
+ })
82
+ end
83
+
84
+ def wait_for_operator
85
+ time_elapsed = 0
86
+
87
+ loop do
88
+ break if operator_ready?
89
+
90
+ if time_elapsed >= OPERATOR_WAIT_MAX
91
+ raise OperatorDeployError, 'timeout waiting for operator to start. '\
92
+ "Waited #{time_elapsed}s."
93
+ end
94
+
95
+ yield
96
+
97
+ sleep OPERATOR_WAIT_INTERVAL
98
+ time_elapsed += OPERATOR_WAIT_INTERVAL
99
+ end
100
+ end
101
+
102
+ def operator_ready?
103
+ depl = operator_deployment
104
+ rs = find_operator_rs(depl)
105
+ return false unless depl && rs
106
+
107
+ observed_generation = depl.dig('status', 'observedGeneration')
108
+ current_generation = depl.dig('metadata', 'generation')
109
+ return false unless observed_generation == current_generation
110
+
111
+ rollout_data = { 'replicas' => 0 }.merge(
112
+ depl['status'].slice(
113
+ *%w(replicas updatedReplicas availableReplicas unavailableReplicas)
114
+ )
115
+ )
116
+
117
+ desired_replicas = depl['spec']['replicas'].to_i
118
+ rs_desired_replicas = rs['spec']['replicas'].to_i
119
+
120
+ rs_ready?(rs) &&
121
+ rs_desired_replicas == desired_replicas &&
122
+ rollout_data['updatedReplicas'].to_i == desired_replicas &&
123
+ rollout_data['updatedReplicas'].to_i == rollout_data['availableReplicas'].to_i
124
+ end
125
+
126
+ def rs_ready?(rs)
127
+ observed_generation = rs.dig('status', 'observedGeneration')
128
+ current_generation = rs.dig('metadata', 'generation')
129
+ return false if observed_generation != current_generation
130
+
131
+ rollout_data = { "replicas" => 0 }.merge(
132
+ rs['status'].slice('replicas', 'availableReplicas', 'readyReplicas')
133
+ )
134
+
135
+ desired_replicas = rs['spec']['replicas'].to_i
136
+ desired_replicas == rollout_data['availableReplicas'].to_i &&
137
+ desired_replicas == rollout_data['readyReplicas'].to_i
138
+ end
139
+
140
+ def operator_deployment
141
+ kubernetes_cli.get_object(
142
+ 'Deployment', NAMESPACE, OPERATOR_DEPLOYMENT_NAME
143
+ )
144
+ rescue ::Kuby::Kubernetes::GetResourceError
145
+ nil
146
+ end
147
+
148
+ def find_operator_rs(depl)
149
+ match_labels = depl.dig('metadata', 'labels')
150
+ all_rs_data = kubernetes_cli.get_objects('ReplicaSet', NAMESPACE, match_labels)
151
+ current_revision = depl.dig('metadata', 'annotations', 'deployment.kubernetes.io/revision')
152
+
153
+ all_rs_data.find do |rs|
154
+ rs.dig('metadata', 'ownerReferences').any? { |ref| ref['uid'] == depl.dig('metadata', 'uid') } &&
155
+ rs.dig('metadata', 'annotations', 'deployment.kubernetes.io/revision') == current_revision
156
+ end
157
+ rescue ::Kuby::Kubernetes::GetResourceError
158
+ nil
159
+ end
160
+
161
+ def operator_deployed?
162
+ helm_cli.release_exists?(OPERATOR_RELEASE_NAME, namespace: NAMESPACE)
163
+ end
164
+
165
+ def catalog_deployed?
166
+ helm_cli.release_exists?(CATALOG_RELEASE_NAME, namespace: NAMESPACE)
167
+ end
168
+
169
+ def helm_cli
170
+ @helm_cli ||= HelmCLI.new(provider.kubeconfig_path)
171
+ end
172
+
173
+ def kubernetes_cli
174
+ provider.kubernetes_cli
175
+ end
176
+
177
+ def provider
178
+ definition.kubernetes.provider
179
+ end
180
+ end
181
+ end
182
+ end