dtk_crd_parser 0.0.66 → 0.0.67
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44c9c34cc93408e2bd39b9f98cde56fec64eef1f596a47efabbc692b9608a86a
|
4
|
+
data.tar.gz: 2f4acb8053c767b161833244a4bb057e0d1a7d6922d00cb985af49f33a0531ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bad65cd3743b2b6e66e220a2ad69620368ec7000eb56d7c7587c8d246aaa806c7fed7f76cc82f99e19720798afdf89ffb10e30306cbde8946154508bcd032249
|
7
|
+
data.tar.gz: 77fe983b615d17f25e748378c7edc4a715803e2a6dc71248b6948bd344215a416040872b7690f12b7f7d99ef9d5915b91053d2180a1dc24f17a869a93f05435a
|
@@ -1,14 +1,14 @@
|
|
1
1
|
module DTK::CrdParser
|
2
2
|
class ExecutableAction < BaseClass
|
3
3
|
|
4
|
+
attr_reader :entrypoint, :bash_script, :name, :type
|
5
|
+
|
4
6
|
def initialize(params)
|
5
7
|
@name = params[:name]
|
6
8
|
@entrypoint = params[:entrypoint]
|
7
9
|
@type = params[:type]
|
8
10
|
@bash_script = params[:bash_script]
|
9
11
|
end
|
10
|
-
|
11
|
-
attr_reader :entrypoint, :bash_script, :name, :type
|
12
12
|
|
13
13
|
private
|
14
14
|
|
@@ -1,6 +1,9 @@
|
|
1
1
|
module DTK::CrdParser
|
2
2
|
class Component
|
3
3
|
class Attribute < BaseClass
|
4
|
+
|
5
|
+
attr_reader :name, :value
|
6
|
+
|
4
7
|
def initialize(name, value)
|
5
8
|
@name = fail_if_nil(name, 'Attribute.name')
|
6
9
|
@value = fail_if_nil(value, 'Attribute.value')
|
@@ -10,10 +13,6 @@ module DTK::CrdParser
|
|
10
13
|
Attribute.new(attribute_name, attribute_value)
|
11
14
|
end
|
12
15
|
|
13
|
-
protected
|
14
|
-
|
15
|
-
attr_reader :name, :value
|
16
|
-
|
17
16
|
end
|
18
17
|
end
|
19
18
|
end
|
data/lib/crd_parser/component.rb
CHANGED
@@ -3,6 +3,8 @@ module DTK::CrdParser
|
|
3
3
|
require_relative('component/attribute')
|
4
4
|
require_relative('error')
|
5
5
|
|
6
|
+
attr_reader :name, :component_def, :attributes
|
7
|
+
|
6
8
|
MODE_DEFAULT = :component_instance
|
7
9
|
attr_reader :name, :component_def, :attributes
|
8
10
|
|
@@ -13,21 +15,23 @@ module DTK::CrdParser
|
|
13
15
|
end
|
14
16
|
|
15
17
|
def self.create_from_kube(client, component_instance, component_name)
|
18
|
+
component_name.gsub!('_', '-')
|
16
19
|
component_instance_obj = client.get_component(component_instance[:name], component_instance[:namespace])
|
17
20
|
component_def = ComponentDef.create_from_kube(client, component_instance_obj, component_name)
|
18
21
|
component_attributes = getComponentAttributes(component_name, component_instance_obj[:spec][:components])
|
19
22
|
attributes = []
|
20
|
-
|
21
|
-
|
23
|
+
if component_attributes
|
24
|
+
component_attributes.to_hash.each do |attribute_name, attribute_value|
|
25
|
+
attributes.push Attribute.create_from_kube(attribute_name, attribute_value)
|
26
|
+
end
|
22
27
|
end
|
23
|
-
|
28
|
+
Component.new(component_name, component_def, attributes)
|
24
29
|
end
|
25
30
|
|
26
31
|
|
27
32
|
protected
|
28
33
|
|
29
34
|
def self.getComponentAttributes(fullComponentName, components)
|
30
|
-
fullComponentName.gsub!('_', '-')
|
31
35
|
component = components.each do |component|
|
32
36
|
componentObj = component[fullComponentName]
|
33
37
|
if(componentObj && componentObj.is_a?(Kubeclient::Resource))
|
@@ -1,8 +1,10 @@
|
|
1
1
|
module DTK::CrdParser
|
2
2
|
class ComponentDef
|
3
3
|
class AttributeTypeInfo < BaseClass
|
4
|
-
def initialize(params)
|
5
4
|
|
5
|
+
attr_reader :name, :type, :required, :dynamic
|
6
|
+
|
7
|
+
def initialize(params)
|
6
8
|
@name = params[:name]
|
7
9
|
@type = params[:type]
|
8
10
|
@required = params[:required] || false
|
@@ -13,9 +15,6 @@ module DTK::CrdParser
|
|
13
15
|
AttributeTypeInfo.new(attribute)
|
14
16
|
end
|
15
17
|
|
16
|
-
protected
|
17
|
-
|
18
|
-
attr_reader :name
|
19
18
|
end
|
20
19
|
end
|
21
20
|
end
|
@@ -4,7 +4,8 @@ module DTK::CrdParser
|
|
4
4
|
require_relative('error')
|
5
5
|
|
6
6
|
MODE_DEFAULT = :component_instance
|
7
|
-
attr_reader :name, :namespace, :executable_actions, :attribute_type_info
|
7
|
+
attr_reader :name, :namespace, :executable_actions, :attribute_type_info, :resource_version
|
8
|
+
|
8
9
|
def initialize(metadata, componentDefActions, componentDefAttributes)
|
9
10
|
@name = fail_if_nil(metadata[:name], 'metadata[:name]')
|
10
11
|
@namespace = fail_if_nil(metadata[:namespace], 'metadata[:namespace]')
|
@@ -82,11 +83,7 @@ module DTK::CrdParser
|
|
82
83
|
action: action
|
83
84
|
}
|
84
85
|
end
|
85
|
-
|
86
86
|
protected
|
87
|
-
|
88
|
-
attr_reader :resource_version, :attribute_type_info, :bash_script, :entrypoint, :type
|
89
|
-
|
90
87
|
def self.metadata(componentDef)
|
91
88
|
componentDef[:metadata]
|
92
89
|
end
|