Sha256: 525002f4558271ce076640cff80cde65d3e4cc5c1b29176efb2aa198e9a05674
Contents?: true
Size: 1.81 KB
Versions: 5
Compression:
Stored size: 1.81 KB
Contents
require 'kube-dsl' module Kuby module Kubernetes module Plugins class NginxIngress < Plugin class Config extend ::KubeDSL::ValueFields value_fields :provider end 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 def configure(&block) @config.instance_eval(&block) if block end def setup Kuby.logger.info('Deploying nginx ingress resources') if already_deployed? Kuby.logger.info('Nginx ingress already deployed, skipping') return end 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 def namespace NAMESPACE end def service_name SERVICE_NAME end private def already_deployed? kubernetes_cli.get_object('Service', 'ingress-nginx', 'ingress-nginx') true rescue KubernetesCLI::GetResourceError return false end def after_initialize @config = Config.new end def kubernetes_cli definition.kubernetes.provider.kubernetes_cli end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems