Class: GlooIngressAdapter::Controller

Inherits:
Object
  • Object
show all
Defined in:
lib/gloo_ingress_adapter/controller.rb

Overview

Controller responsible for creating virtual services from ingress resources

Constant Summary collapse

CONTROLLER_NAME =
"caperwhite.com/gloo-ingress-adapter"
RETRY_ON =
{
  StandardError: nil,
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(kubeconfig:, logger:, route_table_builder:) ⇒ Controller

Returns a new instance of Controller.



20
21
22
23
24
25
26
# File 'lib/gloo_ingress_adapter/controller.rb', line 20

def initialize(kubeconfig:, logger:, route_table_builder:)
  @client_factory = ClientFactory.new(kubeconfig:, logger:).freeze
  @logger = logger
  @route_table_builder = route_table_builder
  @ingress_classes = {}
  @ingresses = {}
end

Instance Method Details

#runObject



28
29
30
# File 'lib/gloo_ingress_adapter/controller.rb', line 28

def run
  logger.info("Running ingress adapter")
end

#watchObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/gloo_ingress_adapter/controller.rb', line 32

def watch
  logger.info("Starting ingress adapter")

  queue = Thread::Queue.new

  ingress_class_observer = create_ingress_class_observer

  ingress_class_observer.start(queue:)

  ingress_observer = create_ingress_observer

  ingress_observer.start(queue:)

  loop do
    event = queue.shift
    handle_event(event)
  end
rescue StandardError => e
  log_exception(e)
end