Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
327892b2
Commit
327892b2
authored
Nov 15, 2018
by
Chris Baumbauer
Committed by
Kamil Trzciński
Nov 15, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add knative client to kubeclient library
parent
0f25d2b3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
1 deletion
+38
-1
app/models/clusters/applications/knative.rb
app/models/clusters/applications/knative.rb
+4
-0
changelogs/unreleased/triggermesh-phase2-serverless.yml
changelogs/unreleased/triggermesh-phase2-serverless.yml
+5
-0
lib/gitlab/kubernetes/kube_client.rb
lib/gitlab/kubernetes/kube_client.rb
+2
-1
spec/lib/gitlab/kubernetes/kube_client_spec.rb
spec/lib/gitlab/kubernetes/kube_client_spec.rb
+14
-0
spec/support/helpers/kubernetes_helpers.rb
spec/support/helpers/kubernetes_helpers.rb
+13
-0
No files found.
app/models/clusters/applications/knative.rb
View file @
327892b2
...
@@ -41,6 +41,10 @@ module Clusters
...
@@ -41,6 +41,10 @@ module Clusters
)
)
end
end
def
client
cluster
.
platform_kubernetes
.
kubeclient
.
knative_client
end
private
private
def
install_script
def
install_script
...
...
changelogs/unreleased/triggermesh-phase2-serverless.yml
0 → 100644
View file @
327892b2
---
title
:
Add knative client to kubeclient library
merge_request
:
22968
author
:
cab105
type
:
added
lib/gitlab/kubernetes/kube_client.rb
View file @
327892b2
...
@@ -16,7 +16,8 @@ module Gitlab
...
@@ -16,7 +16,8 @@ module Gitlab
SUPPORTED_API_GROUPS
=
{
SUPPORTED_API_GROUPS
=
{
core:
{
group:
'api'
,
version:
'v1'
},
core:
{
group:
'api'
,
version:
'v1'
},
rbac:
{
group:
'apis/rbac.authorization.k8s.io'
,
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
}.
freeze
SUPPORTED_API_GROUPS
.
each
do
|
name
,
params
|
SUPPORTED_API_GROUPS
.
each
do
|
name
,
params
|
...
...
spec/lib/gitlab/kubernetes/kube_client_spec.rb
View file @
327892b2
...
@@ -66,6 +66,20 @@ describe Gitlab::Kubernetes::KubeClient do
...
@@ -66,6 +66,20 @@ describe Gitlab::Kubernetes::KubeClient do
end
end
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
describe
'core API'
do
let
(
:core_client
)
{
client
.
core_client
}
let
(
:core_client
)
{
client
.
core_client
}
...
...
spec/support/helpers/kubernetes_helpers.rb
View file @
327892b2
...
@@ -17,6 +17,7 @@ module KubernetesHelpers
...
@@ -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
+
'/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/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/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
end
def
stub_kubeclient_pods
(
response
=
nil
)
def
stub_kubeclient_pods
(
response
=
nil
)
...
@@ -134,6 +135,18 @@ module KubernetesHelpers
...
@@ -134,6 +135,18 @@ module KubernetesHelpers
}
}
end
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
def
kube_pods_body
{
{
"kind"
=>
"PodList"
,
"kind"
=>
"PodList"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment