kube-dsl 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/LICENSE +21 -0
- data/kube-dsl.gemspec +1 -1
- data/lib/kube-dsl/dsl/apiextensions/v1/json_schema_props.rb +4 -4
- data/lib/kube-dsl/dsl/apiextensions/v1beta1/json_schema_props.rb +4 -4
- data/lib/kube-dsl/dsl/apps/v1beta1/deployment_rollback.rb +1 -1
- data/lib/kube-dsl/dsl/apps/v1beta1/scale_status.rb +1 -1
- data/lib/kube-dsl/dsl/apps/v1beta2/scale_status.rb +1 -1
- data/lib/kube-dsl/dsl/authentication/v1/user_info.rb +1 -1
- data/lib/kube-dsl/dsl/authentication/v1beta1/user_info.rb +1 -1
- data/lib/kube-dsl/dsl/authorization/v1/subject_access_review_spec.rb +1 -1
- data/lib/kube-dsl/dsl/authorization/v1beta1/subject_access_review_spec.rb +1 -1
- data/lib/kube-dsl/dsl/certificates/v1beta1/certificate_signing_request_spec.rb +1 -1
- data/lib/kube-dsl/dsl/discovery/v1beta1/endpoint.rb +1 -1
- data/lib/kube-dsl/dsl/extensions/v1beta1/deployment_rollback.rb +1 -1
- data/lib/kube-dsl/dsl/extensions/v1beta1/scale_status.rb +1 -1
- data/lib/kube-dsl/dsl/meta/v1/label_selector.rb +1 -1
- data/lib/kube-dsl/dsl/meta/v1/object_meta.rb +2 -2
- data/lib/kube-dsl/dsl/node/v1alpha1/overhead.rb +1 -1
- data/lib/kube-dsl/dsl/node/v1alpha1/scheduling.rb +1 -1
- data/lib/kube-dsl/dsl/node/v1beta1/overhead.rb +1 -1
- data/lib/kube-dsl/dsl/node/v1beta1/scheduling.rb +1 -1
- data/lib/kube-dsl/dsl/policy/v1beta1/pod_disruption_budget_status.rb +1 -1
- data/lib/kube-dsl/dsl/storage/v1/storage_class.rb +1 -1
- data/lib/kube-dsl/dsl/storage/v1/volume_attachment_status.rb +1 -1
- data/lib/kube-dsl/dsl/storage/v1alpha1/volume_attachment_status.rb +1 -1
- data/lib/kube-dsl/dsl/storage/v1beta1/storage_class.rb +1 -1
- data/lib/kube-dsl/dsl/storage/v1beta1/volume_attachment_status.rb +1 -1
- data/lib/kube-dsl/dsl/v1/config_map.rb +2 -2
- data/lib/kube-dsl/dsl/v1/csi_persistent_volume_source.rb +1 -1
- data/lib/kube-dsl/dsl/v1/csi_volume_source.rb +1 -1
- data/lib/kube-dsl/dsl/v1/flex_persistent_volume_source.rb +1 -1
- data/lib/kube-dsl/dsl/v1/flex_volume_source.rb +1 -1
- data/lib/kube-dsl/dsl/v1/limit_range_item.rb +5 -5
- data/lib/kube-dsl/dsl/v1/node_status.rb +2 -2
- data/lib/kube-dsl/dsl/v1/persistent_volume_claim_status.rb +1 -1
- data/lib/kube-dsl/dsl/v1/persistent_volume_spec.rb +1 -1
- data/lib/kube-dsl/dsl/v1/pod_spec.rb +2 -2
- data/lib/kube-dsl/dsl/v1/replication_controller_spec.rb +1 -1
- data/lib/kube-dsl/dsl/v1/resource_quota_spec.rb +1 -1
- data/lib/kube-dsl/dsl/v1/resource_quota_status.rb +2 -2
- data/lib/kube-dsl/dsl/v1/resource_requirements.rb +2 -2
- data/lib/kube-dsl/dsl/v1/secret.rb +2 -2
- data/lib/kube-dsl/dsl/v1/service_spec.rb +1 -1
- data/lib/kube-dsl/key_value_fields.rb +4 -0
- data/lib/kube-dsl/resource_meta.rb +1 -1
- data/lib/kube-dsl/value_fields.rb +134 -48
- data/lib/kube-dsl/version.rb +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7a616f5571a180de6f04decd298d902b823148b10596292fa69ab68ce7f2ddb
|
4
|
+
data.tar.gz: 51d822c6644973f06cb3f8c819eef7bf99f21d54ff7c7820f0e3105b712a1880
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 821f0332b1aa16b3ba3ffc2fad7a3f453878fa97993dfb71fc74386dc5a0b1aecd0e56f9bd86518a869721d1a5d21a7c2f433edc8bc82e378bba5b1b1900929f
|
7
|
+
data.tar.gz: 6882c287e01af9c05d32a8729e1999a485a75bfec2fd433a53d65efbbd1de0d6fa6dc72b4f6169150d7f00b419e650d8ac4766308f23ba9d766c7bd7af0df354
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## 0.3.0
|
2
|
+
* Introduce the `key_value_field` method to simplify creating key/value fields.
|
3
|
+
* Add `#merge` and `#merge!` methods to anything that includes or extends `ValueFields`.
|
4
|
+
|
1
5
|
## 0.2.0
|
2
6
|
* Treat bare array fields as value fields.
|
3
7
|
- When specifying `array_field(:foo)`, you would get a doubly-nested array if you filled in the value via a block, eg: `foo { [1, 2, 3] }`.
|
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.
|
data/kube-dsl.gemspec
CHANGED
@@ -13,5 +13,5 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.add_dependency 'dry-inflector', '~> 0.2'
|
14
14
|
|
15
15
|
s.require_path = 'lib'
|
16
|
-
s.files = Dir['{lib,spec}/**/*', 'Gemfile', 'CHANGELOG.md', 'README.md', 'Rakefile', 'kube-dsl.gemspec']
|
16
|
+
s.files = Dir['{lib,spec}/**/*', 'Gemfile', 'LICENSE', 'CHANGELOG.md', 'README.md', 'Rakefile', 'kube-dsl.gemspec']
|
17
17
|
end
|
@@ -7,10 +7,10 @@ module KubeDSL::DSL::Apiextensions::V1
|
|
7
7
|
array_field(:one_of) { KubeDSL::DSL::Apiextensions::V1::JSONSchemaProps.new }
|
8
8
|
object_field(:external_docs) { KubeDSL::DSL::Apiextensions::V1::ExternalDocumentation.new }
|
9
9
|
object_field(:not) { KubeDSL::DSL::Apiextensions::V1::JSONSchemaProps.new }
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
key_value_field(:definitions, format: :string)
|
11
|
+
key_value_field(:dependencies, format: :string)
|
12
|
+
key_value_field(:pattern_properties, format: :string)
|
13
|
+
key_value_field(:properties, format: :string)
|
14
14
|
|
15
15
|
def serialize
|
16
16
|
{}.tap do |result|
|
@@ -7,10 +7,10 @@ module KubeDSL::DSL::Apiextensions::V1beta1
|
|
7
7
|
array_field(:one_of) { KubeDSL::DSL::Apiextensions::V1beta1::JSONSchemaProps.new }
|
8
8
|
object_field(:external_docs) { KubeDSL::DSL::Apiextensions::V1beta1::ExternalDocumentation.new }
|
9
9
|
object_field(:not) { KubeDSL::DSL::Apiextensions::V1beta1::JSONSchemaProps.new }
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
key_value_field(:definitions, format: :string)
|
11
|
+
key_value_field(:dependencies, format: :string)
|
12
|
+
key_value_field(:pattern_properties, format: :string)
|
13
|
+
key_value_field(:properties, format: :string)
|
14
14
|
|
15
15
|
def serialize
|
16
16
|
{}.tap do |result|
|
@@ -2,7 +2,7 @@ module KubeDSL::DSL::Apps::V1beta1
|
|
2
2
|
class DeploymentRollback < ::KubeDSL::DSLObject
|
3
3
|
value_fields :name
|
4
4
|
object_field(:rollback_to) { KubeDSL::DSL::Apps::V1beta1::RollbackConfig.new }
|
5
|
-
|
5
|
+
key_value_field(:updated_annotations, format: :string)
|
6
6
|
|
7
7
|
def serialize
|
8
8
|
{}.tap do |result|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module KubeDSL::DSL::Apps::V1beta1
|
2
2
|
class ScaleStatus < ::KubeDSL::DSLObject
|
3
3
|
value_fields :replicas, :target_selector
|
4
|
-
|
4
|
+
key_value_field(:selector, format: :string)
|
5
5
|
|
6
6
|
def serialize
|
7
7
|
{}.tap do |result|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module KubeDSL::DSL::Apps::V1beta2
|
2
2
|
class ScaleStatus < ::KubeDSL::DSLObject
|
3
3
|
value_fields :replicas, :target_selector
|
4
|
-
|
4
|
+
key_value_field(:selector, format: :string)
|
5
5
|
|
6
6
|
def serialize
|
7
7
|
{}.tap do |result|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module KubeDSL::DSL::Authentication::V1
|
2
2
|
class UserInfo < ::KubeDSL::DSLObject
|
3
3
|
value_fields :groups, :uid, :username
|
4
|
-
|
4
|
+
key_value_field(:extra, format: :string)
|
5
5
|
|
6
6
|
def serialize
|
7
7
|
{}.tap do |result|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module KubeDSL::DSL::Authentication::V1beta1
|
2
2
|
class UserInfo < ::KubeDSL::DSLObject
|
3
3
|
value_fields :groups, :uid, :username
|
4
|
-
|
4
|
+
key_value_field(:extra, format: :string)
|
5
5
|
|
6
6
|
def serialize
|
7
7
|
{}.tap do |result|
|
@@ -3,7 +3,7 @@ module KubeDSL::DSL::Authorization::V1
|
|
3
3
|
value_fields :groups, :uid, :user
|
4
4
|
object_field(:non_resource_attributes) { KubeDSL::DSL::Authorization::V1::NonResourceAttributes.new }
|
5
5
|
object_field(:resource_attributes) { KubeDSL::DSL::Authorization::V1::ResourceAttributes.new }
|
6
|
-
|
6
|
+
key_value_field(:extra, format: :string)
|
7
7
|
|
8
8
|
def serialize
|
9
9
|
{}.tap do |result|
|
@@ -3,7 +3,7 @@ module KubeDSL::DSL::Authorization::V1beta1
|
|
3
3
|
value_fields :group, :uid, :user
|
4
4
|
object_field(:non_resource_attributes) { KubeDSL::DSL::Authorization::V1beta1::NonResourceAttributes.new }
|
5
5
|
object_field(:resource_attributes) { KubeDSL::DSL::Authorization::V1beta1::ResourceAttributes.new }
|
6
|
-
|
6
|
+
key_value_field(:extra, format: :string)
|
7
7
|
|
8
8
|
def serialize
|
9
9
|
{}.tap do |result|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module KubeDSL::DSL::Certificates::V1beta1
|
2
2
|
class CertificateSigningRequestSpec < ::KubeDSL::DSLObject
|
3
3
|
value_fields :groups, :request, :uid, :usages, :username
|
4
|
-
|
4
|
+
key_value_field(:extra, format: :string)
|
5
5
|
|
6
6
|
def serialize
|
7
7
|
{}.tap do |result|
|
@@ -3,7 +3,7 @@ module KubeDSL::DSL::Discovery::V1beta1
|
|
3
3
|
value_fields :addresses, :hostname
|
4
4
|
object_field(:conditions) { KubeDSL::DSL::Discovery::V1beta1::EndpointConditions.new }
|
5
5
|
object_field(:target_ref) { KubeDSL::DSL::V1::ObjectReference.new }
|
6
|
-
|
6
|
+
key_value_field(:topology, format: :string)
|
7
7
|
|
8
8
|
def serialize
|
9
9
|
{}.tap do |result|
|
@@ -2,7 +2,7 @@ module KubeDSL::DSL::Extensions::V1beta1
|
|
2
2
|
class DeploymentRollback < ::KubeDSL::DSLObject
|
3
3
|
value_fields :name
|
4
4
|
object_field(:rollback_to) { KubeDSL::DSL::Extensions::V1beta1::RollbackConfig.new }
|
5
|
-
|
5
|
+
key_value_field(:updated_annotations, format: :string)
|
6
6
|
|
7
7
|
def serialize
|
8
8
|
{}.tap do |result|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module KubeDSL::DSL::Extensions::V1beta1
|
2
2
|
class ScaleStatus < ::KubeDSL::DSLObject
|
3
3
|
value_fields :replicas, :target_selector
|
4
|
-
|
4
|
+
key_value_field(:selector, format: :string)
|
5
5
|
|
6
6
|
def serialize
|
7
7
|
{}.tap do |result|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module KubeDSL::DSL::Meta::V1
|
2
2
|
class LabelSelector < ::KubeDSL::DSLObject
|
3
3
|
array_field(:match_expression) { KubeDSL::DSL::Meta::V1::LabelSelectorRequirement.new }
|
4
|
-
|
4
|
+
key_value_field(:match_labels, format: :string)
|
5
5
|
|
6
6
|
def serialize
|
7
7
|
{}.tap do |result|
|
@@ -3,8 +3,8 @@ module KubeDSL::DSL::Meta::V1
|
|
3
3
|
value_fields :cluster_name, :creation_timestamp, :deletion_grace_period_seconds, :deletion_timestamp, :finalizers, :generate_name, :generation, :name, :namespace, :resource_version, :self_link, :uid
|
4
4
|
array_field(:managed_field) { KubeDSL::DSL::Meta::V1::ManagedFieldsEntry.new }
|
5
5
|
array_field(:owner_reference) { KubeDSL::DSL::Meta::V1::OwnerReference.new }
|
6
|
-
|
7
|
-
|
6
|
+
key_value_field(:annotations, format: :string)
|
7
|
+
key_value_field(:labels, format: :string)
|
8
8
|
|
9
9
|
def serialize
|
10
10
|
{}.tap do |result|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module KubeDSL::DSL::Node::V1alpha1
|
2
2
|
class Scheduling < ::KubeDSL::DSLObject
|
3
3
|
array_field(:toleration) { KubeDSL::DSL::V1::Toleration.new }
|
4
|
-
|
4
|
+
key_value_field(:node_selector, format: :string)
|
5
5
|
|
6
6
|
def serialize
|
7
7
|
{}.tap do |result|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module KubeDSL::DSL::Node::V1beta1
|
2
2
|
class Scheduling < ::KubeDSL::DSLObject
|
3
3
|
array_field(:toleration) { KubeDSL::DSL::V1::Toleration.new }
|
4
|
-
|
4
|
+
key_value_field(:node_selector, format: :string)
|
5
5
|
|
6
6
|
def serialize
|
7
7
|
{}.tap do |result|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module KubeDSL::DSL::Policy::V1beta1
|
2
2
|
class PodDisruptionBudgetStatus < ::KubeDSL::DSLObject
|
3
3
|
value_fields :current_healthy, :desired_healthy, :disruptions_allowed, :expected_pods, :observed_generation
|
4
|
-
|
4
|
+
key_value_field(:disrupted_pods, format: :string)
|
5
5
|
|
6
6
|
def serialize
|
7
7
|
{}.tap do |result|
|
@@ -3,7 +3,7 @@ module KubeDSL::DSL::Storage::V1
|
|
3
3
|
value_fields :allow_volume_expansion, :mount_options, :provisioner, :reclaim_policy, :volume_binding_mode
|
4
4
|
array_field(:allowed_topology) { KubeDSL::DSL::V1::TopologySelectorTerm.new }
|
5
5
|
object_field(:metadata) { KubeDSL::DSL::Meta::V1::ObjectMeta.new }
|
6
|
-
|
6
|
+
key_value_field(:parameters, format: :string)
|
7
7
|
|
8
8
|
def serialize
|
9
9
|
{}.tap do |result|
|
@@ -3,7 +3,7 @@ module KubeDSL::DSL::Storage::V1
|
|
3
3
|
value_fields :attached
|
4
4
|
object_field(:attach_error) { KubeDSL::DSL::Storage::V1::VolumeError.new }
|
5
5
|
object_field(:detach_error) { KubeDSL::DSL::Storage::V1::VolumeError.new }
|
6
|
-
|
6
|
+
key_value_field(:attachment_metadata, format: :string)
|
7
7
|
|
8
8
|
def serialize
|
9
9
|
{}.tap do |result|
|
@@ -3,7 +3,7 @@ module KubeDSL::DSL::Storage::V1alpha1
|
|
3
3
|
value_fields :attached
|
4
4
|
object_field(:attach_error) { KubeDSL::DSL::Storage::V1alpha1::VolumeError.new }
|
5
5
|
object_field(:detach_error) { KubeDSL::DSL::Storage::V1alpha1::VolumeError.new }
|
6
|
-
|
6
|
+
key_value_field(:attachment_metadata, format: :string)
|
7
7
|
|
8
8
|
def serialize
|
9
9
|
{}.tap do |result|
|
@@ -3,7 +3,7 @@ module KubeDSL::DSL::Storage::V1beta1
|
|
3
3
|
value_fields :allow_volume_expansion, :mount_options, :provisioner, :reclaim_policy, :volume_binding_mode
|
4
4
|
array_field(:allowed_topology) { KubeDSL::DSL::V1::TopologySelectorTerm.new }
|
5
5
|
object_field(:metadata) { KubeDSL::DSL::Meta::V1::ObjectMeta.new }
|
6
|
-
|
6
|
+
key_value_field(:parameters, format: :string)
|
7
7
|
|
8
8
|
def serialize
|
9
9
|
{}.tap do |result|
|
@@ -3,7 +3,7 @@ module KubeDSL::DSL::Storage::V1beta1
|
|
3
3
|
value_fields :attached
|
4
4
|
object_field(:attach_error) { KubeDSL::DSL::Storage::V1beta1::VolumeError.new }
|
5
5
|
object_field(:detach_error) { KubeDSL::DSL::Storage::V1beta1::VolumeError.new }
|
6
|
-
|
6
|
+
key_value_field(:attachment_metadata, format: :string)
|
7
7
|
|
8
8
|
def serialize
|
9
9
|
{}.tap do |result|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module KubeDSL::DSL::V1
|
2
2
|
class ConfigMap < ::KubeDSL::DSLObject
|
3
3
|
object_field(:metadata) { KubeDSL::DSL::Meta::V1::ObjectMeta.new }
|
4
|
-
|
5
|
-
|
4
|
+
key_value_field(:binary_data, format: :byte)
|
5
|
+
key_value_field(:data, format: :string)
|
6
6
|
|
7
7
|
def serialize
|
8
8
|
{}.tap do |result|
|
@@ -5,7 +5,7 @@ module KubeDSL::DSL::V1
|
|
5
5
|
object_field(:controller_publish_secret_ref) { KubeDSL::DSL::V1::SecretReference.new }
|
6
6
|
object_field(:node_publish_secret_ref) { KubeDSL::DSL::V1::SecretReference.new }
|
7
7
|
object_field(:node_stage_secret_ref) { KubeDSL::DSL::V1::SecretReference.new }
|
8
|
-
|
8
|
+
key_value_field(:volume_attributes, format: :string)
|
9
9
|
|
10
10
|
def serialize
|
11
11
|
{}.tap do |result|
|
@@ -2,7 +2,7 @@ module KubeDSL::DSL::V1
|
|
2
2
|
class CSIVolumeSource < ::KubeDSL::DSLObject
|
3
3
|
value_fields :driver, :fs_type, :read_only
|
4
4
|
object_field(:node_publish_secret_ref) { KubeDSL::DSL::V1::LocalObjectReference.new }
|
5
|
-
|
5
|
+
key_value_field(:volume_attributes, format: :string)
|
6
6
|
|
7
7
|
def serialize
|
8
8
|
{}.tap do |result|
|
@@ -2,7 +2,7 @@ module KubeDSL::DSL::V1
|
|
2
2
|
class FlexPersistentVolumeSource < ::KubeDSL::DSLObject
|
3
3
|
value_fields :driver, :fs_type, :read_only
|
4
4
|
object_field(:secret_ref) { KubeDSL::DSL::V1::SecretReference.new }
|
5
|
-
|
5
|
+
key_value_field(:options, format: :string)
|
6
6
|
|
7
7
|
def serialize
|
8
8
|
{}.tap do |result|
|
@@ -2,7 +2,7 @@ module KubeDSL::DSL::V1
|
|
2
2
|
class FlexVolumeSource < ::KubeDSL::DSLObject
|
3
3
|
value_fields :driver, :fs_type, :read_only
|
4
4
|
object_field(:secret_ref) { KubeDSL::DSL::V1::LocalObjectReference.new }
|
5
|
-
|
5
|
+
key_value_field(:options, format: :string)
|
6
6
|
|
7
7
|
def serialize
|
8
8
|
{}.tap do |result|
|
@@ -1,11 +1,11 @@
|
|
1
1
|
module KubeDSL::DSL::V1
|
2
2
|
class LimitRangeItem < ::KubeDSL::DSLObject
|
3
3
|
value_fields :type
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
key_value_field(:default, format: :string)
|
5
|
+
key_value_field(:default_request, format: :string)
|
6
|
+
key_value_field(:max, format: :string)
|
7
|
+
key_value_field(:max_limit_request_ratio, format: :string)
|
8
|
+
key_value_field(:min, format: :string)
|
9
9
|
|
10
10
|
def serialize
|
11
11
|
{}.tap do |result|
|
@@ -8,8 +8,8 @@ module KubeDSL::DSL::V1
|
|
8
8
|
object_field(:config) { KubeDSL::DSL::V1::NodeConfigStatus.new }
|
9
9
|
object_field(:daemon_endpoints) { KubeDSL::DSL::V1::NodeDaemonEndpoints.new }
|
10
10
|
object_field(:node_info) { KubeDSL::DSL::V1::NodeSystemInfo.new }
|
11
|
-
|
12
|
-
|
11
|
+
key_value_field(:allocatable, format: :string)
|
12
|
+
key_value_field(:capacity, format: :string)
|
13
13
|
|
14
14
|
def serialize
|
15
15
|
{}.tap do |result|
|
@@ -2,7 +2,7 @@ module KubeDSL::DSL::V1
|
|
2
2
|
class PersistentVolumeClaimStatus < ::KubeDSL::DSLObject
|
3
3
|
value_fields :access_modes, :phase
|
4
4
|
array_field(:condition) { KubeDSL::DSL::V1::PersistentVolumeClaimCondition.new }
|
5
|
-
|
5
|
+
key_value_field(:capacity, format: :string)
|
6
6
|
|
7
7
|
def serialize
|
8
8
|
{}.tap do |result|
|
@@ -25,7 +25,7 @@ module KubeDSL::DSL::V1
|
|
25
25
|
object_field(:scale_io) { KubeDSL::DSL::V1::ScaleIOPersistentVolumeSource.new }
|
26
26
|
object_field(:storageos) { KubeDSL::DSL::V1::StorageOSPersistentVolumeSource.new }
|
27
27
|
object_field(:vsphere_volume) { KubeDSL::DSL::V1::VsphereVirtualDiskVolumeSource.new }
|
28
|
-
|
28
|
+
key_value_field(:capacity, format: :string)
|
29
29
|
|
30
30
|
def serialize
|
31
31
|
{}.tap do |result|
|
@@ -13,8 +13,8 @@ module KubeDSL::DSL::V1
|
|
13
13
|
object_field(:affinity) { KubeDSL::DSL::V1::Affinity.new }
|
14
14
|
object_field(:dns_config) { KubeDSL::DSL::V1::PodDNSConfig.new }
|
15
15
|
object_field(:security_context) { KubeDSL::DSL::V1::PodSecurityContext.new }
|
16
|
-
|
17
|
-
|
16
|
+
key_value_field(:node_selector, format: :string)
|
17
|
+
key_value_field(:overhead, format: :string)
|
18
18
|
|
19
19
|
def serialize
|
20
20
|
{}.tap do |result|
|
@@ -2,7 +2,7 @@ module KubeDSL::DSL::V1
|
|
2
2
|
class ReplicationControllerSpec < ::KubeDSL::DSLObject
|
3
3
|
value_fields :min_ready_seconds, :replicas
|
4
4
|
object_field(:template) { KubeDSL::DSL::V1::PodTemplateSpec.new }
|
5
|
-
|
5
|
+
key_value_field(:selector, format: :string)
|
6
6
|
|
7
7
|
def serialize
|
8
8
|
{}.tap do |result|
|
@@ -2,7 +2,7 @@ module KubeDSL::DSL::V1
|
|
2
2
|
class ResourceQuotaSpec < ::KubeDSL::DSLObject
|
3
3
|
value_fields :scopes
|
4
4
|
object_field(:scope_selector) { KubeDSL::DSL::V1::ScopeSelector.new }
|
5
|
-
|
5
|
+
key_value_field(:hard, format: :string)
|
6
6
|
|
7
7
|
def serialize
|
8
8
|
{}.tap do |result|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module KubeDSL::DSL::V1
|
2
2
|
class ResourceQuotaStatus < ::KubeDSL::DSLObject
|
3
|
-
|
4
|
-
|
3
|
+
key_value_field(:hard, format: :string)
|
4
|
+
key_value_field(:used, format: :string)
|
5
5
|
|
6
6
|
def serialize
|
7
7
|
{}.tap do |result|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module KubeDSL::DSL::V1
|
2
2
|
class ResourceRequirements < ::KubeDSL::DSLObject
|
3
|
-
|
4
|
-
|
3
|
+
key_value_field(:limits, format: :string)
|
4
|
+
key_value_field(:requests, format: :string)
|
5
5
|
|
6
6
|
def serialize
|
7
7
|
{}.tap do |result|
|
@@ -2,8 +2,8 @@ module KubeDSL::DSL::V1
|
|
2
2
|
class Secret < ::KubeDSL::DSLObject
|
3
3
|
value_fields :type
|
4
4
|
object_field(:metadata) { KubeDSL::DSL::Meta::V1::ObjectMeta.new }
|
5
|
-
|
6
|
-
|
5
|
+
key_value_field(:data, format: :byte)
|
6
|
+
key_value_field(:string_data, format: :string)
|
7
7
|
|
8
8
|
def serialize
|
9
9
|
{}.tap do |result|
|
@@ -3,7 +3,7 @@ module KubeDSL::DSL::V1
|
|
3
3
|
value_fields :cluster_ip, :external_i_ps, :external_name, :external_traffic_policy, :health_check_node_port, :ip_family, :load_balancer_ip, :load_balancer_source_ranges, :publish_not_ready_addresses, :session_affinity, :topology_keys, :type
|
4
4
|
array_field(:port) { KubeDSL::DSL::V1::ServicePort.new }
|
5
5
|
object_field(:session_affinity_config) { KubeDSL::DSL::V1::SessionAffinityConfig.new }
|
6
|
-
|
6
|
+
key_value_field(:selector, format: :string)
|
7
7
|
|
8
8
|
def serialize
|
9
9
|
{}.tap do |result|
|
@@ -2,77 +2,163 @@ require 'securerandom'
|
|
2
2
|
|
3
3
|
module KubeDSL
|
4
4
|
module ValueFields
|
5
|
-
|
6
|
-
fields.each { |field| value_field(field) }
|
7
|
-
end
|
5
|
+
class ClassMismatchError < StandardError; end
|
8
6
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
instance_variable_get(:"@#{field}") || (
|
13
|
-
default.respond_to?(:call) ? default.call : default
|
14
|
-
)
|
15
|
-
else
|
16
|
-
instance_variable_set(:"@#{field}", args.first)
|
17
|
-
end
|
7
|
+
module ClassMethods
|
8
|
+
def value_fields(*fields)
|
9
|
+
fields.each { |field| value_field(field) }
|
18
10
|
end
|
19
|
-
end
|
20
11
|
|
21
|
-
|
22
|
-
|
23
|
-
ivar = :"@#{field}"
|
24
|
-
val = instance_variable_get(ivar)
|
12
|
+
def value_field(field, default: nil)
|
13
|
+
__fields__[:value] << field
|
25
14
|
|
26
|
-
|
27
|
-
|
28
|
-
|
15
|
+
define_method(field) do |*args|
|
16
|
+
if args.empty?
|
17
|
+
instance_variable_get(:"@#{field}") || (
|
18
|
+
default.respond_to?(:call) ? default.call : default
|
19
|
+
)
|
20
|
+
else
|
21
|
+
instance_variable_set(:"@#{field}", args.first)
|
22
|
+
end
|
29
23
|
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def object_field(field, &field_block)
|
27
|
+
__fields__[:object] << field
|
28
|
+
|
29
|
+
define_method(field) do |*args, &block|
|
30
|
+
ivar = :"@#{field}"
|
31
|
+
val = instance_variable_get(ivar)
|
30
32
|
|
31
|
-
|
32
|
-
|
33
|
+
unless val
|
34
|
+
val = field_block.call(*args)
|
35
|
+
instance_variable_set(ivar, val)
|
36
|
+
end
|
37
|
+
|
38
|
+
val.instance_exec(&block) if block
|
39
|
+
val
|
40
|
+
end
|
33
41
|
end
|
34
|
-
end
|
35
42
|
|
36
|
-
|
37
|
-
|
43
|
+
def key_value_field(field, format:)
|
44
|
+
__fields__[:key_value] << field
|
45
|
+
|
46
|
+
define_method(field) do |*args, &block|
|
47
|
+
ivar = :"@#{field}"
|
48
|
+
val = instance_variable_get(ivar)
|
38
49
|
|
39
|
-
|
40
|
-
|
41
|
-
|
50
|
+
unless val
|
51
|
+
val = ::KubeDSL::KeyValueFields.new(format: format)
|
52
|
+
instance_variable_set(ivar, val)
|
53
|
+
end
|
42
54
|
|
43
|
-
|
44
|
-
|
45
|
-
arr = {}
|
46
|
-
instance_variable_set(ivar, arr)
|
55
|
+
val.instance_exec(&block) if block
|
56
|
+
val
|
47
57
|
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def array_field(field, accessor = nil, &field_block)
|
61
|
+
accessor ||= Inflector.pluralize(field.to_s).to_sym
|
62
|
+
|
63
|
+
__fields__[:array] << { field: field, accessor: accessor }
|
48
64
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
65
|
+
define_method(field) do |elem_name = nil, &block|
|
66
|
+
ivar = :"@#{accessor}"
|
67
|
+
arr = instance_variable_get(ivar)
|
68
|
+
|
69
|
+
# use a hash so elements can be named and modified later
|
70
|
+
unless arr
|
71
|
+
arr = {}
|
72
|
+
instance_variable_set(ivar, arr)
|
73
|
+
end
|
74
|
+
|
75
|
+
if elem_name && elem = arr[elem_name]
|
76
|
+
elem.instance_eval(&block) if block
|
77
|
+
elem
|
55
78
|
else
|
56
|
-
|
79
|
+
if field_block
|
80
|
+
new_val = field_block.call
|
81
|
+
new_val.instance_eval(&block) if block
|
82
|
+
else
|
83
|
+
new_val = block.call if block
|
84
|
+
end
|
85
|
+
|
86
|
+
arr[elem_name || SecureRandom.hex] = new_val
|
87
|
+
new_val
|
57
88
|
end
|
89
|
+
end
|
58
90
|
|
59
|
-
|
91
|
+
define_method(accessor) do
|
92
|
+
ivar = :"@#{accessor}"
|
93
|
+
arr = instance_variable_get(ivar)
|
94
|
+
|
95
|
+
unless arr
|
96
|
+
arr = {}
|
97
|
+
instance_variable_set(ivar, arr)
|
98
|
+
end
|
99
|
+
|
100
|
+
arr.values
|
60
101
|
end
|
102
|
+
end
|
61
103
|
|
62
|
-
|
104
|
+
def __fields__
|
105
|
+
@__fields__ ||= {
|
106
|
+
value: [],
|
107
|
+
object: [],
|
108
|
+
key_value: [],
|
109
|
+
array: []
|
110
|
+
}
|
63
111
|
end
|
112
|
+
end
|
113
|
+
|
114
|
+
|
115
|
+
module InstanceMethods
|
116
|
+
def merge!(other, fields: nil)
|
117
|
+
unless other.is_a?(self.class)
|
118
|
+
raise ClassMismatchError, 'cannot merge two objects of '\
|
119
|
+
"different types, namely '#{self.class}' and '#{other.class}'"
|
120
|
+
end
|
121
|
+
|
122
|
+
(self.class.__fields__[:value] + self.class.__fields__[:object]).each do |field|
|
123
|
+
next if fields && !fields.include?(field)
|
124
|
+
ivar = :"@#{field}"
|
125
|
+
|
126
|
+
if other_val = other.instance_variable_get(ivar)
|
127
|
+
instance_variable_set(ivar, other_val)
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
self.class.__fields__[:key_value].each do |field|
|
132
|
+
next if fields && !fields.include?(field)
|
133
|
+
send(field).merge!(other.send(field))
|
134
|
+
end
|
64
135
|
|
65
|
-
|
66
|
-
|
67
|
-
|
136
|
+
self.class.__fields__[:array].each do |af|
|
137
|
+
next if fields && !fields.include?(af[:field])
|
138
|
+
ivar = :"@#{af[:accessor]}"
|
139
|
+
|
140
|
+
arrs = instance_variable_get(ivar) || {}
|
141
|
+
|
142
|
+
arrs.merge!(
|
143
|
+
other.instance_variable_get(ivar) || {}
|
144
|
+
)
|
68
145
|
|
69
|
-
|
70
|
-
arr = {}
|
71
|
-
instance_variable_set(ivar, arr)
|
146
|
+
instance_variable_set(ivar, arrs)
|
72
147
|
end
|
148
|
+
end
|
73
149
|
|
74
|
-
|
150
|
+
def merge(other, fields)
|
151
|
+
self.class.new.tap do |result|
|
152
|
+
result.merge!(self)
|
153
|
+
result.merge!(other, fields: fields)
|
154
|
+
end
|
75
155
|
end
|
76
156
|
end
|
157
|
+
|
158
|
+
|
159
|
+
def self.extended(base)
|
160
|
+
base.include(InstanceMethods)
|
161
|
+
base.extend(ClassMethods)
|
162
|
+
end
|
77
163
|
end
|
78
164
|
end
|
data/lib/kube-dsl/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kube-dsl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cameron Dutro
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-inflector
|
@@ -33,6 +33,7 @@ extra_rdoc_files: []
|
|
33
33
|
files:
|
34
34
|
- CHANGELOG.md
|
35
35
|
- Gemfile
|
36
|
+
- LICENSE
|
36
37
|
- Rakefile
|
37
38
|
- kube-dsl.gemspec
|
38
39
|
- lib/kube-dsl.rb
|
@@ -795,7 +796,7 @@ files:
|
|
795
796
|
homepage: http://github.com/getkuby/kube-dsl
|
796
797
|
licenses: []
|
797
798
|
metadata: {}
|
798
|
-
post_install_message:
|
799
|
+
post_install_message:
|
799
800
|
rdoc_options: []
|
800
801
|
require_paths:
|
801
802
|
- lib
|
@@ -810,8 +811,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
810
811
|
- !ruby/object:Gem::Version
|
811
812
|
version: '0'
|
812
813
|
requirements: []
|
813
|
-
rubygems_version: 3.
|
814
|
-
signing_key:
|
814
|
+
rubygems_version: 3.1.4
|
815
|
+
signing_key:
|
815
816
|
specification_version: 4
|
816
817
|
summary: A Ruby DSL for defining Kubernetes resources.
|
817
818
|
test_files: []
|