Class: Kubecontrol::Deployment
- Inherits:
-
Object
- Object
- Kubecontrol::Deployment
- Defined in:
- lib/kubecontrol/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.
7 8 9 10 11 12 13 14 15 |
# File 'lib/kubecontrol/deployment.rb', line 7 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.
5 6 7 |
# File 'lib/kubecontrol/deployment.rb', line 5 def age @age end |
#available ⇒ Object (readonly)
Returns the value of attribute available.
5 6 7 |
# File 'lib/kubecontrol/deployment.rb', line 5 def available @available end |
#client ⇒ Object (readonly)
Returns the value of attribute client.
5 6 7 |
# File 'lib/kubecontrol/deployment.rb', line 5 def client @client end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/kubecontrol/deployment.rb', line 5 def name @name end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
5 6 7 |
# File 'lib/kubecontrol/deployment.rb', line 5 def namespace @namespace end |
#ready ⇒ Object (readonly)
Returns the value of attribute ready.
5 6 7 |
# File 'lib/kubecontrol/deployment.rb', line 5 def ready @ready end |
#up_to_date ⇒ Object (readonly)
Returns the value of attribute up_to_date.
5 6 7 |
# File 'lib/kubecontrol/deployment.rb', line 5 def up_to_date @up_to_date end |
Instance Method Details
#all_ready? ⇒ Boolean
21 22 23 24 |
# File 'lib/kubecontrol/deployment.rb', line 21 def all_ready? max_pods = @ready.split('/').last @ready == "#{max_pods}/#{max_pods}" end |
#available? ⇒ Boolean
26 27 28 |
# File 'lib/kubecontrol/deployment.rb', line 26 def available? @available.to_i > 1 end |
#ready? ⇒ Boolean
17 18 19 |
# File 'lib/kubecontrol/deployment.rb', line 17 def ready? @ready.split('/').first != '0' end |
#scale(count) ⇒ Object
34 35 36 |
# File 'lib/kubecontrol/deployment.rb', line 34 def scale(count) @client.kubectl_command("scale deployment #{@name} --replicas=#{count}") end |
#up_to_date? ⇒ Boolean
30 31 32 |
# File 'lib/kubecontrol/deployment.rb', line 30 def up_to_date? @up_to_date.to_i > 1 end |