Add knative client to kubeclient library
This commit is contained in:
parent
0f25d2b33f
commit
327892b23e
5 changed files with 38 additions and 1 deletions
|
@ -41,6 +41,10 @@ module Clusters
|
|||
)
|
||||
end
|
||||
|
||||
def client
|
||||
cluster.platform_kubernetes.kubeclient.knative_client
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def install_script
|
||||
|
|
5
changelogs/unreleased/triggermesh-phase2-serverless.yml
Normal file
5
changelogs/unreleased/triggermesh-phase2-serverless.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Add knative client to kubeclient library
|
||||
merge_request: 22968
|
||||
author: cab105
|
||||
type: added
|
|
@ -16,7 +16,8 @@ module Gitlab
|
|||
SUPPORTED_API_GROUPS = {
|
||||
core: { group: 'api', version: 'v1' },
|
||||
rbac: { group: 'apis/rbac.authorization.k8s.io', version: 'v1' },
|
||||
extensions: { group: 'apis/extensions', version: 'v1beta1' }
|
||||
extensions: { group: 'apis/extensions', version: 'v1beta1' },
|
||||
knative: { group: 'apis/serving.knative.dev', version: 'v1alpha1' }
|
||||
}.freeze
|
||||
|
||||
SUPPORTED_API_GROUPS.each do |name, params|
|
||||
|
|
|
@ -66,6 +66,20 @@ describe Gitlab::Kubernetes::KubeClient do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#knative_client' do
|
||||
subject { client.knative_client }
|
||||
|
||||
it_behaves_like 'a Kubeclient'
|
||||
|
||||
it 'has the extensions API group endpoint' do
|
||||
expect(subject.api_endpoint.to_s).to match(%r{\/apis\/serving.knative.dev\Z})
|
||||
end
|
||||
|
||||
it 'has the api_version' do
|
||||
expect(subject.instance_variable_get(:@api_version)).to eq('v1alpha1')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'core API' do
|
||||
let(:core_client) { client.core_client }
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ module KubernetesHelpers
|
|||
WebMock.stub_request(:get, api_url + '/api/v1').to_return(kube_response(kube_v1_discovery_body))
|
||||
WebMock.stub_request(:get, api_url + '/apis/extensions/v1beta1').to_return(kube_response(kube_v1beta1_discovery_body))
|
||||
WebMock.stub_request(:get, api_url + '/apis/rbac.authorization.k8s.io/v1').to_return(kube_response(kube_v1_rbac_authorization_discovery_body))
|
||||
WebMock.stub_request(:get, api_url + '/apis/serving.knative.dev/v1alpha1').to_return(kube_response(kube_v1alpha1_serving_knative_discovery_body))
|
||||
end
|
||||
|
||||
def stub_kubeclient_pods(response = nil)
|
||||
|
@ -134,6 +135,18 @@ module KubernetesHelpers
|
|||
}
|
||||
end
|
||||
|
||||
def kube_v1alpha1_serving_knative_discovery_body
|
||||
{
|
||||
"kind" => "APIResourceList",
|
||||
"resources" => [
|
||||
{ "name" => "revisions", "namespaced" => true, "kind" => "Revision" },
|
||||
{ "name" => "services", "namespaced" => true, "kind" => "Service" },
|
||||
{ "name" => "configurations", "namespaced" => true, "kind" => "Configuration" },
|
||||
{ "name" => "routes", "namespaced" => true, "kind" => "Route" }
|
||||
]
|
||||
}
|
||||
end
|
||||
|
||||
def kube_pods_body
|
||||
{
|
||||
"kind" => "PodList",
|
||||
|
|
Loading…
Reference in a new issue