Class: Kubecontrol::StatefulSet
- Inherits:
-
Object
- Object
- Kubecontrol::StatefulSet
- Defined in:
- lib/kubecontrol/stateful_set.rb
Constant Summary collapse
- RESOURCE_NAME =
'statefulsets'.freeze
Instance Attribute Summary collapse
-
#age ⇒ Object
readonly
Returns the value of attribute age.
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
-
#ready ⇒ Object
readonly
Returns the value of attribute ready.
Instance Method Summary collapse
- #all_ready? ⇒ Boolean
-
#initialize(name, ready, age, namespace, client) ⇒ StatefulSet
constructor
A new instance of StatefulSet.
- #ready? ⇒ Boolean
- #scale(count) ⇒ Object
Constructor Details
#initialize(name, ready, age, namespace, client) ⇒ StatefulSet
Returns a new instance of StatefulSet.
7 8 9 10 11 12 13 |
# File 'lib/kubecontrol/stateful_set.rb', line 7 def initialize(name, ready, age, namespace, client) @name = name @ready = ready @age = age @namespace = namespace @client = client end |
Instance Attribute Details
#age ⇒ Object (readonly)
Returns the value of attribute age.
5 6 7 |
# File 'lib/kubecontrol/stateful_set.rb', line 5 def age @age end |
#client ⇒ Object (readonly)
Returns the value of attribute client.
5 6 7 |
# File 'lib/kubecontrol/stateful_set.rb', line 5 def client @client end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/kubecontrol/stateful_set.rb', line 5 def name @name end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
5 6 7 |
# File 'lib/kubecontrol/stateful_set.rb', line 5 def namespace @namespace end |
#ready ⇒ Object (readonly)
Returns the value of attribute ready.
5 6 7 |
# File 'lib/kubecontrol/stateful_set.rb', line 5 def ready @ready end |
Instance Method Details
#all_ready? ⇒ Boolean
19 20 21 22 |
# File 'lib/kubecontrol/stateful_set.rb', line 19 def all_ready? max_pods = @ready.split('/').last @ready == "#{max_pods}/#{max_pods}" end |
#ready? ⇒ Boolean
15 16 17 |
# File 'lib/kubecontrol/stateful_set.rb', line 15 def ready? @ready.split('/').first != '0' end |
#scale(count) ⇒ Object
24 25 26 |
# File 'lib/kubecontrol/stateful_set.rb', line 24 def scale(count) @client.kubectl_command("scale statefulset #{@name} --replicas=#{count}") end |