Class: KuberKit::ServiceDeployer::Deployer
- Defined in:
- lib/kuber_kit/service_deployer/deployer.rb
Constant Summary collapse
- StrategyNotFoundError =
Class.new(KuberKit::NotFoundError)
Instance Method Summary collapse
- #add_default_strategies ⇒ Object
- #deploy(shell, service, strategy_name) ⇒ Object
- #register_strategy(strategy_name, strategy) ⇒ Object
- #reset! ⇒ Object
Instance Method Details
#add_default_strategies ⇒ Object
30 31 32 |
# File 'lib/kuber_kit/service_deployer/deployer.rb', line 30 def add_default_strategies register_strategy(:kubernetes, kubernetes) end |
#deploy(shell, service, strategy_name) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/kuber_kit/service_deployer/deployer.rb', line 20 def deploy(shell, service, strategy_name) add_default_strategies deployer = @@strategies[strategy_name] raise StrategyNotFoundError, "Can't find strategy with name #{strategy_name}" if deployer.nil? deployer.deploy(shell, service) end |
#register_strategy(strategy_name, strategy) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/kuber_kit/service_deployer/deployer.rb', line 9 def register_strategy(strategy_name, strategy) @@strategies ||= {} if !strategy.is_a?(KuberKit::ServiceDeployer::Strategies::Abstract) raise ArgumentError.new("should be an instance of KuberKit::ServiceDeployer::Strategies::Abstract, got: #{strategy.inspect}") end @@strategies[strategy_name] = strategy end |
#reset! ⇒ Object
34 35 36 |
# File 'lib/kuber_kit/service_deployer/deployer.rb', line 34 def reset! @@strategies = {} end |