Class: Karafka::Instrumentation::Vendors::Kubernetes::BaseListener

Inherits:
Object
  • Object
show all
Includes:
Core::Helpers::Time
Defined in:
lib/karafka/instrumentation/vendors/kubernetes/base_listener.rb

Overview

Base Kubernetes Listener providing basic HTTP server capabilities to respond with health

Direct Known Subclasses

LivenessListener, SwarmLivenessListener

Instance Method Summary collapse

Constructor Details

#initialize(hostname: nil, port: 3000) ⇒ BaseListener

Returns a new instance of BaseListener.

Parameters:

  • hostname (String, nil) (defaults to: nil)

    hostname or nil to bind on all

  • port (Integer) (defaults to: 3000)

    TCP port on which we want to run our HTTP status server



24
25
26
27
28
29
30
# File 'lib/karafka/instrumentation/vendors/kubernetes/base_listener.rb', line 24

def initialize(
  hostname: nil,
  port: 3000
)
  @hostname = hostname
  @port = port
end

Instance Method Details

#healthy?Boolean

Returns true if all good, false if we should tell k8s to kill this process.

Returns:

  • (Boolean)

    true if all good, false if we should tell k8s to kill this process

Raises:

  • (NotImplementedError)


33
34
35
# File 'lib/karafka/instrumentation/vendors/kubernetes/base_listener.rb', line 33

def healthy?
  raise NotImplementedError, 'Implement in a subclass'
end