2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module Kubernetes
|
|
|
|
module KubectlCmd
|
|
|
|
class << self
|
|
|
|
def delete(*args)
|
|
|
|
%w(kubectl delete).concat(args).shelljoin
|
|
|
|
end
|
|
|
|
|
|
|
|
def apply_file(filename, *args)
|
|
|
|
raise ArgumentError, "filename is not present" unless filename.present?
|
|
|
|
|
|
|
|
%w(kubectl apply -f).concat([filename], args).shelljoin
|
|
|
|
end
|
2020-01-01 13:55:28 +05:30
|
|
|
|
|
|
|
def delete_crds_from_group(group)
|
|
|
|
api_resources_args = %w(-o name --api-group).push(group)
|
|
|
|
|
2021-03-08 18:12:59 +05:30
|
|
|
PodCmd.retry_command(api_resources(*api_resources_args) + " | xargs -r " + delete('--ignore-not-found', 'crd'))
|
2020-01-01 13:55:28 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def api_resources(*args)
|
|
|
|
%w(kubectl api-resources).concat(args).shelljoin
|
|
|
|
end
|
2019-10-12 21:52:04 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|