Class: KubeQueue::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/kube_queue/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#auth_tokenObject

Returns the value of attribute auth_token.



27
28
29
# File 'lib/kube_queue/client.rb', line 27

def auth_token
  @auth_token
end

#ssl_ca_fileObject

Returns the value of attribute ssl_ca_file.



27
28
29
# File 'lib/kube_queue/client.rb', line 27

def ssl_ca_file
  @ssl_ca_file
end

#urlObject

Returns the value of attribute url.



27
28
29
# File 'lib/kube_queue/client.rb', line 27

def url
  @url
end

Instance Method Details

#create_cron_job(manifest) ⇒ Object



21
22
23
24
25
# File 'lib/kube_queue/client.rb', line 21

def create_cron_job(manifest)
  cron_job = K8s::Resource.new(manifest)
  cron_job..namespace ||= 'default'
  client.api('batch/v1beta1').resource('cronjobs').create_resource(cron_job)
end

#create_job(manifest) ⇒ Object



6
7
8
9
10
# File 'lib/kube_queue/client.rb', line 6

def create_job(manifest)
  job = K8s::Resource.new(manifest)
  job..namespace ||= 'default'
  client.api('batch/v1').resource('jobs').create_resource(job)
end

#get_job(namespace, name) ⇒ Object



12
13
14
# File 'lib/kube_queue/client.rb', line 12

def get_job(namespace, name)
  client.api('batch/v1').resource('jobs', namespace: namespace).get(name)
end

#list_job(job_class, namespace = nil) ⇒ Object



16
17
18
19
# File 'lib/kube_queue/client.rb', line 16

def list_job(job_class, namespace = nil)
  selector = { 'kube-queue-job': 'true', 'kube-queue-job-class': job_class }
  client.api('batch/v1').resource('jobs', namespace: namespace).list(labelSelector: selector)
end