Commit d12ed308 authored by Thong Kuah's avatar Thong Kuah

Update all usages of KubeClient

Find and replace everywhere we pass in `api_groups` to KubeClient, as no
longer needed
parent 7e0cfd95
...@@ -109,7 +109,7 @@ module Clusters ...@@ -109,7 +109,7 @@ module Clusters
end end
def kubeclient def kubeclient
@kubeclient ||= build_kube_client!(api_groups: ['api', 'apis/rbac.authorization.k8s.io']) @kubeclient ||= build_kube_client!
end end
private private
...@@ -138,7 +138,7 @@ module Clusters ...@@ -138,7 +138,7 @@ module Clusters
Gitlab::NamespaceSanitizer.sanitize(slug) Gitlab::NamespaceSanitizer.sanitize(slug)
end end
def build_kube_client!(api_groups: ['api'], api_version: 'v1') def build_kube_client!(api_version: 'v1')
raise "Incomplete settings" unless api_url && actual_namespace raise "Incomplete settings" unless api_url && actual_namespace
unless (username && password) || token unless (username && password) || token
...@@ -147,7 +147,6 @@ module Clusters ...@@ -147,7 +147,6 @@ module Clusters
Gitlab::Kubernetes::KubeClient.new( Gitlab::Kubernetes::KubeClient.new(
api_url, api_url,
api_groups,
api_version, api_version,
auth_options: kubeclient_auth_options, auth_options: kubeclient_auth_options,
ssl_options: kubeclient_ssl_options, ssl_options: kubeclient_ssl_options,
......
...@@ -146,7 +146,7 @@ class KubernetesService < DeploymentService ...@@ -146,7 +146,7 @@ class KubernetesService < DeploymentService
end end
def kubeclient def kubeclient
@kubeclient ||= build_kube_client!(api_groups: ['api', 'apis/rbac.authorization.k8s.io']) @kubeclient ||= build_kube_client!
end end
def deprecated? def deprecated?
...@@ -184,12 +184,11 @@ class KubernetesService < DeploymentService ...@@ -184,12 +184,11 @@ class KubernetesService < DeploymentService
slug.gsub(/[^-a-z0-9]/, '-').gsub(/^-+/, '') slug.gsub(/[^-a-z0-9]/, '-').gsub(/^-+/, '')
end end
def build_kube_client!(api_groups: ['api'], api_version: 'v1') def build_kube_client!(api_version: 'v1')
raise "Incomplete settings" unless api_url && actual_namespace && token raise "Incomplete settings" unless api_url && actual_namespace && token
Gitlab::Kubernetes::KubeClient.new( Gitlab::Kubernetes::KubeClient.new(
api_url, api_url,
api_groups,
api_version, api_version,
auth_options: kubeclient_auth_options, auth_options: kubeclient_auth_options,
ssl_options: kubeclient_ssl_options, ssl_options: kubeclient_ssl_options,
......
...@@ -60,17 +60,15 @@ module Clusters ...@@ -60,17 +60,15 @@ module Clusters
'https://' + gke_cluster.endpoint, 'https://' + gke_cluster.endpoint,
Base64.decode64(gke_cluster.master_auth.cluster_ca_certificate), Base64.decode64(gke_cluster.master_auth.cluster_ca_certificate),
gke_cluster.master_auth.username, gke_cluster.master_auth.username,
gke_cluster.master_auth.password, gke_cluster.master_auth.password
api_groups: ['api', 'apis/rbac.authorization.k8s.io']
) )
end end
def build_kube_client!(api_url, ca_pem, username, password, api_groups: ['api'], api_version: 'v1') def build_kube_client!(api_url, ca_pem, username, password, api_version: 'v1')
raise "Incomplete settings" unless api_url && username && password raise "Incomplete settings" unless api_url && username && password
Gitlab::Kubernetes::KubeClient.new( Gitlab::Kubernetes::KubeClient.new(
api_url, api_url,
api_groups,
api_version, api_version,
auth_options: { username: username, password: password }, auth_options: { username: username, password: password },
ssl_options: kubeclient_ssl_options(ca_pem), ssl_options: kubeclient_ssl_options(ca_pem),
......
...@@ -16,7 +16,6 @@ describe Clusters::Gcp::Kubernetes::CreateServiceAccountService do ...@@ -16,7 +16,6 @@ describe Clusters::Gcp::Kubernetes::CreateServiceAccountService do
let(:kubeclient) do let(:kubeclient) do
Gitlab::Kubernetes::KubeClient.new( Gitlab::Kubernetes::KubeClient.new(
api_url, api_url,
['api', 'apis/rbac.authorization.k8s.io'],
auth_options: { username: username, password: password } auth_options: { username: username, password: password }
) )
end end
......
...@@ -11,7 +11,6 @@ describe Clusters::Gcp::Kubernetes::FetchKubernetesTokenService do ...@@ -11,7 +11,6 @@ describe Clusters::Gcp::Kubernetes::FetchKubernetesTokenService do
let(:kubeclient) do let(:kubeclient) do
Gitlab::Kubernetes::KubeClient.new( Gitlab::Kubernetes::KubeClient.new(
api_url, api_url,
['api', 'apis/rbac.authorization.k8s.io'],
auth_options: { username: username, password: password } auth_options: { username: username, password: password }
) )
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment