Module: Gitlab::Kubernetes::KubectlCmd

Defined in:
lib/gitlab/kubernetes/kubectl_cmd.rb

Class Method Summary collapse

Class Method Details

.api_resources(*args) ⇒ Object


23
24
25
# File 'lib/gitlab/kubernetes/kubectl_cmd.rb', line 23

def api_resources(*args)
  %w(kubectl api-resources).concat(args).shelljoin
end

.apply_file(filename, *args) ⇒ Object

Raises:

  • (ArgumentError)

11
12
13
14
15
# File 'lib/gitlab/kubernetes/kubectl_cmd.rb', line 11

def apply_file(filename, *args)
  raise ArgumentError, "filename is not present" unless filename.present?

  %w(kubectl apply -f).concat([filename], args).shelljoin
end

.delete(*args) ⇒ Object


7
8
9
# File 'lib/gitlab/kubernetes/kubectl_cmd.rb', line 7

def delete(*args)
  %w(kubectl delete).concat(args).shelljoin
end

.delete_crds_from_group(group) ⇒ Object


17
18
19
20
21
# File 'lib/gitlab/kubernetes/kubectl_cmd.rb', line 17

def delete_crds_from_group(group)
  api_resources_args = %w(-o name --api-group).push(group)

  PodCmd.retry_command(api_resources(*api_resources_args) + " | xargs -r " + delete('--ignore-not-found', 'crd'))
end