Class: Kuby::Kubernetes::Plugins::NginxIngress

Inherits:
Kuby::Kubernetes::Plugin show all
Defined in:
lib/kuby/kubernetes/plugins/nginx_ingress.rb

Defined Under Namespace

Classes: Config

Constant Summary collapse

VERSION =
'0.27.1'.freeze
DEFAULT_PROVIDER =
'cloud-generic'.freeze
NAMESPACE =
'ingress-nginx'.freeze
SERVICE_NAME =
'ingress-nginx'.freeze
SETUP_RESOURCES =
[
  "https://raw.githubusercontent.com/kubernetes/ingress-nginx/nginx-#{VERSION}/deploy/static/mandatory.yaml",
  "https://raw.githubusercontent.com/kubernetes/ingress-nginx/nginx-#{VERSION}/deploy/static/provider/%{provider}.yaml"
].freeze

Instance Attribute Summary

Attributes inherited from Kuby::Kubernetes::Plugin

#definition

Instance Method Summary collapse

Methods inherited from Kuby::Kubernetes::Plugin

#after_configuration, #after_deploy, #after_setup, #before_deploy, #before_setup, #initialize, #resources

Constructor Details

This class inherits a constructor from Kuby::Kubernetes::Plugin

Instance Method Details

#configure(&block) ⇒ Object



23
24
25
# File 'lib/kuby/kubernetes/plugins/nginx_ingress.rb', line 23

def configure(&block)
  @config.instance_eval(&block) if block
end

#namespaceObject



41
42
43
# File 'lib/kuby/kubernetes/plugins/nginx_ingress.rb', line 41

def namespace
  NAMESPACE
end

#service_nameObject



45
46
47
# File 'lib/kuby/kubernetes/plugins/nginx_ingress.rb', line 45

def service_name
  SERVICE_NAME
end

#setupObject



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/kuby/kubernetes/plugins/nginx_ingress.rb', line 27

def setup
  Kuby.logger.info('Deploying nginx ingress resources')

  SETUP_RESOURCES.each do |uri|
    uri = uri % { provider: @config.provider || DEFAULT_PROVIDER }
    kubernetes_cli.apply_uri(uri)
  end

  Kuby.logger.info('Nginx ingress resources deployed!')
rescue => e
  Kuby.logger.fatal(e.message)
  raise
end