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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
486297a3
Commit
486297a3
authored
Apr 01, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
dcf3b314
97ab074e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
3 deletions
+21
-3
changelogs/unreleased/59441-add-base-domain-to-cluster-api.yml
...elogs/unreleased/59441-add-base-domain-to-cluster-api.yml
+5
-0
doc/api/project_clusters.md
doc/api/project_clusters.md
+6
-1
lib/api/entities.rb
lib/api/entities.rb
+1
-1
lib/api/project_clusters.rb
lib/api/project_clusters.rb
+2
-0
spec/requests/api/project_clusters_spec.rb
spec/requests/api/project_clusters_spec.rb
+7
-1
No files found.
changelogs/unreleased/59441-add-base-domain-to-cluster-api.yml
0 → 100644
View file @
486297a3
---
title
:
Add cluster domain to Project Cluster API
merge_request
:
26735
author
:
type
:
other
doc/api/project_clusters.md
View file @
486297a3
...
@@ -33,6 +33,7 @@ Example response:
...
@@ -33,6 +33,7 @@ Example response:
{
{
"id"
:
18
,
"id"
:
18
,
"name"
:
"cluster-1"
,
"name"
:
"cluster-1"
,
"domain"
:
"example.com"
,
"created_at"
:
"2019-01-02T20:18:12.563Z"
,
"created_at"
:
"2019-01-02T20:18:12.563Z"
,
"provider_type"
:
"user"
,
"provider_type"
:
"user"
,
"platform_type"
:
"kubernetes"
,
"platform_type"
:
"kubernetes"
,
...
@@ -90,6 +91,7 @@ Example response:
...
@@ -90,6 +91,7 @@ Example response:
{
{
"id"
:
18
,
"id"
:
18
,
"name"
:
"cluster-1"
,
"name"
:
"cluster-1"
,
"domain"
:
"example.com"
,
"created_at"
:
"2019-01-02T20:18:12.563Z"
,
"created_at"
:
"2019-01-02T20:18:12.563Z"
,
"provider_type"
:
"user"
,
"provider_type"
:
"user"
,
"platform_type"
:
"kubernetes"
,
"platform_type"
:
"kubernetes"
,
...
@@ -157,6 +159,7 @@ Parameters:
...
@@ -157,6 +159,7 @@ Parameters:
| --------- | ---- | -------- | ----------- |
| --------- | ---- | -------- | ----------- |
|
`id`
| integer | yes | The ID of the project owned by the authenticated user |
|
`id`
| integer | yes | The ID of the project owned by the authenticated user |
|
`name`
| String | yes | The name of the cluster |
|
`name`
| String | yes | The name of the cluster |
|
`domain`
| String | no | The
[
base domain
](
../user/project/clusters/index.md#base_domain
)
of the cluster |
|
`enabled`
| Boolean | no | Determines if cluster is active or not, defaults to true |
|
`enabled`
| Boolean | no | Determines if cluster is active or not, defaults to true |
|
`platform_kubernetes_attributes[api_url]`
| String | yes | The URL to access the Kubernetes API |
|
`platform_kubernetes_attributes[api_url]`
| String | yes | The URL to access the Kubernetes API |
|
`platform_kubernetes_attributes[token]`
| String | yes | The token to authenticate against Kubernetes |
|
`platform_kubernetes_attributes[token]`
| String | yes | The token to authenticate against Kubernetes |
...
@@ -248,6 +251,7 @@ Parameters:
...
@@ -248,6 +251,7 @@ Parameters:
|
`id`
| integer | yes | The ID of the project owned by the authenticated user |
|
`id`
| integer | yes | The ID of the project owned by the authenticated user |
|
`cluster_id`
| integer | yes | The ID of the cluster |
|
`cluster_id`
| integer | yes | The ID of the cluster |
|
`name`
| String | no | The name of the cluster |
|
`name`
| String | no | The name of the cluster |
|
`domain`
| String | no | The
[
base domain
](
../user/project/clusters/index.md#base_domain
)
of the cluster |
|
`platform_kubernetes_attributes[api_url]`
| String | no | The URL to access the Kubernetes API |
|
`platform_kubernetes_attributes[api_url]`
| String | no | The URL to access the Kubernetes API |
|
`platform_kubernetes_attributes[token]`
| String | no | The token to authenticate against Kubernetes |
|
`platform_kubernetes_attributes[token]`
| String | no | The token to authenticate against Kubernetes |
|
`platform_kubernetes_attributes[ca_cert]`
| String | no | TLS certificate (needed if API is using a self-signed TLS certificate |
|
`platform_kubernetes_attributes[ca_cert]`
| String | no | TLS certificate (needed if API is using a self-signed TLS certificate |
...
@@ -264,7 +268,7 @@ Example request:
...
@@ -264,7 +268,7 @@ Example request:
```
bash
```
bash
curl
--header
'Private-Token: <your_access_token>'
https://gitlab.example.com/api/v4/projects/26/clusters/24
\
curl
--header
'Private-Token: <your_access_token>'
https://gitlab.example.com/api/v4/projects/26/clusters/24
\
-H
"Content-Type:application/json"
\
-H
"Content-Type:application/json"
\
-X
PUT
--data
'{"name":"new-cluster-name","api_url":"https://new-api-url.com"}'
-X
PUT
--data
'{"name":"new-cluster-name","
domain":"new-domain.com","
api_url":"https://new-api-url.com"}'
```
```
Example response:
Example response:
...
@@ -273,6 +277,7 @@ Example response:
...
@@ -273,6 +277,7 @@ Example response:
{
{
"id"
:
24
,
"id"
:
24
,
"name"
:
"new-cluster-name"
,
"name"
:
"new-cluster-name"
,
"domain"
:
"new-domain.com"
,
"created_at"
:
"2019-01-03T21:53:40.610Z"
,
"created_at"
:
"2019-01-03T21:53:40.610Z"
,
"provider_type"
:
"user"
,
"provider_type"
:
"user"
,
"platform_type"
:
"kubernetes"
,
"platform_type"
:
"kubernetes"
,
...
...
lib/api/entities.rb
View file @
486297a3
...
@@ -1588,7 +1588,7 @@ module API
...
@@ -1588,7 +1588,7 @@ module API
end
end
class
Cluster
<
Grape
::
Entity
class
Cluster
<
Grape
::
Entity
expose
:id
,
:name
,
:created_at
expose
:id
,
:name
,
:created_at
,
:domain
expose
:provider_type
,
:platform_type
,
:environment_scope
,
:cluster_type
expose
:provider_type
,
:platform_type
,
:environment_scope
,
:cluster_type
expose
:user
,
using:
Entities
::
UserBasic
expose
:user
,
using:
Entities
::
UserBasic
expose
:platform_kubernetes
,
using:
Entities
::
Platform
::
Kubernetes
expose
:platform_kubernetes
,
using:
Entities
::
Platform
::
Kubernetes
...
...
lib/api/project_clusters.rb
View file @
486297a3
...
@@ -55,6 +55,7 @@ module API
...
@@ -55,6 +55,7 @@ module API
params
do
params
do
requires
:name
,
type:
String
,
desc:
'Cluster name'
requires
:name
,
type:
String
,
desc:
'Cluster name'
optional
:enabled
,
type:
Boolean
,
default:
true
,
desc:
'Determines if cluster is active or not, defaults to true'
optional
:enabled
,
type:
Boolean
,
default:
true
,
desc:
'Determines if cluster is active or not, defaults to true'
optional
:domain
,
type:
String
,
desc:
'Cluster base domain'
requires
:platform_kubernetes_attributes
,
type:
Hash
,
desc:
%q(Platform Kubernetes data)
do
requires
:platform_kubernetes_attributes
,
type:
Hash
,
desc:
%q(Platform Kubernetes data)
do
requires
:api_url
,
type:
String
,
allow_blank:
false
,
desc:
'URL to access the Kubernetes API'
requires
:api_url
,
type:
String
,
allow_blank:
false
,
desc:
'URL to access the Kubernetes API'
requires
:token
,
type:
String
,
desc:
'Token to authenticate against Kubernetes'
requires
:token
,
type:
String
,
desc:
'Token to authenticate against Kubernetes'
...
@@ -85,6 +86,7 @@ module API
...
@@ -85,6 +86,7 @@ module API
params
do
params
do
requires
:cluster_id
,
type:
Integer
,
desc:
'The cluster ID'
requires
:cluster_id
,
type:
Integer
,
desc:
'The cluster ID'
optional
:name
,
type:
String
,
desc:
'Cluster name'
optional
:name
,
type:
String
,
desc:
'Cluster name'
optional
:domain
,
type:
String
,
desc:
'Cluster base domain'
optional
:platform_kubernetes_attributes
,
type:
Hash
,
desc:
%q(Platform Kubernetes data)
do
optional
:platform_kubernetes_attributes
,
type:
Hash
,
desc:
%q(Platform Kubernetes data)
do
optional
:api_url
,
type:
String
,
desc:
'URL to access the Kubernetes API'
optional
:api_url
,
type:
String
,
desc:
'URL to access the Kubernetes API'
optional
:token
,
type:
String
,
desc:
'Token to authenticate against Kubernetes'
optional
:token
,
type:
String
,
desc:
'Token to authenticate against Kubernetes'
...
...
spec/requests/api/project_clusters_spec.rb
View file @
486297a3
...
@@ -60,7 +60,7 @@ describe API::ProjectClusters do
...
@@ -60,7 +60,7 @@ describe API::ProjectClusters do
end
end
let
(
:cluster
)
do
let
(
:cluster
)
do
create
(
:cluster
,
:project
,
:provided_by_gcp
,
create
(
:cluster
,
:project
,
:provided_by_gcp
,
:with_domain
,
platform_kubernetes:
platform_kubernetes
,
platform_kubernetes:
platform_kubernetes
,
user:
current_user
,
user:
current_user
,
projects:
[
project
])
projects:
[
project
])
...
@@ -88,6 +88,7 @@ describe API::ProjectClusters do
...
@@ -88,6 +88,7 @@ describe API::ProjectClusters do
expect
(
json_response
[
'platform_type'
]).
to
eq
(
'kubernetes'
)
expect
(
json_response
[
'platform_type'
]).
to
eq
(
'kubernetes'
)
expect
(
json_response
[
'environment_scope'
]).
to
eq
(
'*'
)
expect
(
json_response
[
'environment_scope'
]).
to
eq
(
'*'
)
expect
(
json_response
[
'cluster_type'
]).
to
eq
(
'project_type'
)
expect
(
json_response
[
'cluster_type'
]).
to
eq
(
'project_type'
)
expect
(
json_response
[
'domain'
]).
to
eq
(
'example.com'
)
end
end
it
'returns project information'
do
it
'returns project information'
do
...
@@ -187,6 +188,7 @@ describe API::ProjectClusters do
...
@@ -187,6 +188,7 @@ describe API::ProjectClusters do
let
(
:cluster_params
)
do
let
(
:cluster_params
)
do
{
{
name:
'test-cluster'
,
name:
'test-cluster'
,
domain:
'domain.example.com'
,
platform_kubernetes_attributes:
platform_kubernetes_attributes
platform_kubernetes_attributes:
platform_kubernetes_attributes
}
}
end
end
...
@@ -217,6 +219,7 @@ describe API::ProjectClusters do
...
@@ -217,6 +219,7 @@ describe API::ProjectClusters do
expect
(
cluster_result
).
to
be_kubernetes
expect
(
cluster_result
).
to
be_kubernetes
expect
(
cluster_result
.
project
).
to
eq
(
project
)
expect
(
cluster_result
.
project
).
to
eq
(
project
)
expect
(
cluster_result
.
name
).
to
eq
(
'test-cluster'
)
expect
(
cluster_result
.
name
).
to
eq
(
'test-cluster'
)
expect
(
cluster_result
.
domain
).
to
eq
(
'domain.example.com'
)
expect
(
platform_kubernetes
.
rbac?
).
to
be_truthy
expect
(
platform_kubernetes
.
rbac?
).
to
be_truthy
expect
(
platform_kubernetes
.
api_url
).
to
eq
(
api_url
)
expect
(
platform_kubernetes
.
api_url
).
to
eq
(
api_url
)
expect
(
platform_kubernetes
.
namespace
).
to
eq
(
namespace
)
expect
(
platform_kubernetes
.
namespace
).
to
eq
(
namespace
)
...
@@ -294,6 +297,7 @@ describe API::ProjectClusters do
...
@@ -294,6 +297,7 @@ describe API::ProjectClusters do
let
(
:update_params
)
do
let
(
:update_params
)
do
{
{
domain:
'new-domain.com'
,
platform_kubernetes_attributes:
platform_kubernetes_attributes
platform_kubernetes_attributes:
platform_kubernetes_attributes
}
}
end
end
...
@@ -330,6 +334,7 @@ describe API::ProjectClusters do
...
@@ -330,6 +334,7 @@ describe API::ProjectClusters do
end
end
it
'should update cluster attributes'
do
it
'should update cluster attributes'
do
expect
(
cluster
.
domain
).
to
eq
(
'new-domain.com'
)
expect
(
cluster
.
platform_kubernetes
.
namespace
).
to
eq
(
'new-namespace'
)
expect
(
cluster
.
platform_kubernetes
.
namespace
).
to
eq
(
'new-namespace'
)
end
end
end
end
...
@@ -342,6 +347,7 @@ describe API::ProjectClusters do
...
@@ -342,6 +347,7 @@ describe API::ProjectClusters do
end
end
it
'should not update cluster attributes'
do
it
'should not update cluster attributes'
do
expect
(
cluster
.
domain
).
not_to
eq
(
'new_domain.com'
)
expect
(
cluster
.
platform_kubernetes
.
namespace
).
not_to
eq
(
'invalid_namespace'
)
expect
(
cluster
.
platform_kubernetes
.
namespace
).
not_to
eq
(
'invalid_namespace'
)
expect
(
cluster
.
kubernetes_namespace
.
namespace
).
not_to
eq
(
'invalid_namespace'
)
expect
(
cluster
.
kubernetes_namespace
.
namespace
).
not_to
eq
(
'invalid_namespace'
)
end
end
...
...
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