Class: Runners::Kubernetes::CreateClient

Inherits:
Object
  • Object
show all
Defined in:
app/services/runners/kubernetes/create_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nodeObject (readonly)

Returns the value of attribute node.



6
7
8
# File 'app/services/runners/kubernetes/create_client.rb', line 6

def node
  @node
end

Instance Method Details

#perform(node:) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/services/runners/kubernetes/create_client.rb', line 8

def perform(node:)
  @node = node

  raise(Runners::InvalidRunner, "Node must be a kubernetes runner") unless node.kubernetes?

  raise(Runners::InvalidConfig, "Invalid configuration (#{node.runner_config}) for kubernetes") unless valid?

  KubernetesClient.new(
    uri: node.hostname,
    bearer_token: node.runner_config["bearer_token"],
    namespace: node.runner_config["namespace"]
  )
end