Class: Kubecontrol::Resources::Deployment
- Inherits:
-
Object
- Object
- Kubecontrol::Resources::Deployment
- Defined in:
- lib/kubecontrol/resources/deployment.rb
Constant Summary collapse
- RESOURCE_NAME =
'deployments'.freeze
Instance Attribute Summary collapse
-
#age ⇒ Object
readonly
Returns the value of attribute age.
-
#available ⇒ Object
readonly
Returns the value of attribute available.
-
#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.
-
#up_to_date ⇒ Object
readonly
Returns the value of attribute up_to_date.
Instance Method Summary collapse
- #all_ready? ⇒ Boolean
- #available? ⇒ Boolean
-
#initialize(name, ready, up_to_date, available, age, namespace, client) ⇒ Deployment
constructor
A new instance of Deployment.
- #ready? ⇒ Boolean
- #scale(count) ⇒ Object
- #up_to_date? ⇒ Boolean
Constructor Details
#initialize(name, ready, up_to_date, available, age, namespace, client) ⇒ Deployment
Returns a new instance of Deployment.
8 9 10 11 12 13 14 15 16 |
# File 'lib/kubecontrol/resources/deployment.rb', line 8 def initialize(name, ready, up_to_date, available, age, namespace, client) @name = name @ready = ready @up_to_date = up_to_date @available = available @age = age @namespace = namespace @client = client end |
Instance Attribute Details
#age ⇒ Object (readonly)
Returns the value of attribute age.
6 7 8 |
# File 'lib/kubecontrol/resources/deployment.rb', line 6 def age @age end |
#available ⇒ Object (readonly)
Returns the value of attribute available.
6 7 8 |
# File 'lib/kubecontrol/resources/deployment.rb', line 6 def available @available end |
#client ⇒ Object (readonly)
Returns the value of attribute client.
6 7 8 |
# File 'lib/kubecontrol/resources/deployment.rb', line 6 def client @client end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/kubecontrol/resources/deployment.rb', line 6 def name @name end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
6 7 8 |
# File 'lib/kubecontrol/resources/deployment.rb', line 6 def namespace @namespace end |
#ready ⇒ Object (readonly)
Returns the value of attribute ready.
6 7 8 |
# File 'lib/kubecontrol/resources/deployment.rb', line 6 def ready @ready end |
#up_to_date ⇒ Object (readonly)
Returns the value of attribute up_to_date.
6 7 8 |
# File 'lib/kubecontrol/resources/deployment.rb', line 6 def up_to_date @up_to_date end |
Instance Method Details
#all_ready? ⇒ Boolean
22 23 24 25 |
# File 'lib/kubecontrol/resources/deployment.rb', line 22 def all_ready? max_pods = @ready.split('/').last @ready == "#{max_pods}/#{max_pods}" end |
#available? ⇒ Boolean
27 28 29 |
# File 'lib/kubecontrol/resources/deployment.rb', line 27 def available? @available.to_i > 1 end |
#ready? ⇒ Boolean
18 19 20 |
# File 'lib/kubecontrol/resources/deployment.rb', line 18 def ready? @ready.split('/').first != '0' end |
#scale(count) ⇒ Object
35 36 37 |
# File 'lib/kubecontrol/resources/deployment.rb', line 35 def scale(count) @client.kubectl_command("scale deployment #{@name} --replicas=#{count}") end |
#up_to_date? ⇒ Boolean
31 32 33 |
# File 'lib/kubecontrol/resources/deployment.rb', line 31 def up_to_date? @up_to_date.to_i > 1 end |