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
19dbedda
Commit
19dbedda
authored
Apr 30, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
717ef5a7
a96e96d5
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
6 deletions
+40
-6
app/models/clusters/platforms/kubernetes.rb
app/models/clusters/platforms/kubernetes.rb
+4
-0
app/models/project_services/kubernetes_service.rb
app/models/project_services/kubernetes_service.rb
+4
-0
danger/roulette/Dangerfile
danger/roulette/Dangerfile
+3
-1
lib/gitlab/prometheus/query_variables.rb
lib/gitlab/prometheus/query_variables.rb
+5
-1
spec/lib/gitlab/prometheus/query_variables_spec.rb
spec/lib/gitlab/prometheus/query_variables_spec.rb
+24
-4
No files found.
app/models/clusters/platforms/kubernetes.rb
View file @
19dbedda
...
...
@@ -76,6 +76,10 @@ module Clusters
end
end
def
namespace_for
(
project
)
cluster
.
find_or_initialize_kubernetes_namespace_for_project
(
project
).
namespace
end
def
predefined_variables
(
project
:)
Gitlab
::
Ci
::
Variables
::
Collection
.
new
.
tap
do
|
variables
|
variables
.
append
(
key:
'KUBE_URL'
,
value:
api_url
)
...
...
app/models/project_services/kubernetes_service.rb
View file @
19dbedda
...
...
@@ -94,6 +94,10 @@ class KubernetesService < DeploymentService
end
end
def
namespace_for
(
project
)
actual_namespace
end
# Check we can connect to the Kubernetes API
def
test
(
*
args
)
kubeclient
=
build_kube_client!
...
...
danger/roulette/Dangerfile
View file @
19dbedda
...
...
@@ -57,10 +57,12 @@ def spin_for_person(people, random:)
people
.
size
.
times
do
person
=
people
.
sample
(
random:
random
)
return
person
unless
out_of_office?
(
person
)
break
person
unless
out_of_office?
(
person
)
people
-=
[
person
]
end
person
end
def
out_of_office?
(
person
)
...
...
lib/gitlab/prometheus/query_variables.rb
View file @
19dbedda
...
...
@@ -4,9 +4,13 @@ module Gitlab
module
Prometheus
module
QueryVariables
def
self
.
call
(
environment
)
deployment_platform
=
environment
.
deployment_platform
namespace
=
deployment_platform
&
.
namespace_for
(
environment
.
project
)
||
deployment_platform
&
.
actual_namespace
||
''
{
ci_environment_slug:
environment
.
slug
,
kube_namespace:
environment
.
deployment_platform
&
.
actual_namespace
||
''
,
kube_namespace:
namespace
,
environment_filter:
%{container_name!="POD",environment="#{environment.slug}"}
}
end
...
...
spec/lib/gitlab/prometheus/query_variables_spec.rb
View file @
19dbedda
...
...
@@ -4,6 +4,7 @@ require 'spec_helper'
describe
Gitlab
::
Prometheus
::
QueryVariables
do
describe
'.call'
do
let
(
:project
)
{
environment
.
project
}
let
(
:environment
)
{
create
(
:environment
)
}
let
(
:slug
)
{
environment
.
slug
}
...
...
@@ -21,13 +22,32 @@ describe Gitlab::Prometheus::QueryVariables do
end
context
'with deployment platform'
do
let
(
:kube_namespace
)
{
environment
.
deployment_platform
.
actual_namespace
}
context
'with project cluster'
do
let
(
:kube_namespace
)
{
environment
.
deployment_platform
.
actual_namespace
}
before
do
create
(
:cluster
,
:provided_by_user
,
projects:
[
environment
.
project
])
before
do
create
(
:cluster
,
:project
,
:provided_by_user
,
projects:
[
project
])
end
it
{
is_expected
.
to
include
(
kube_namespace:
kube_namespace
)
}
end
it
{
is_expected
.
to
include
(
kube_namespace:
kube_namespace
)
}
context
'with group cluster'
do
let
(
:cluster
)
{
create
(
:cluster
,
:group
,
:provided_by_user
,
groups:
[
group
])
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:project2
)
{
create
(
:project
)
}
let
(
:kube_namespace
)
{
k8s_ns
.
namespace
}
let!
(
:k8s_ns
)
{
create
(
:cluster_kubernetes_namespace
,
cluster:
cluster
,
project:
project
)
}
let!
(
:k8s_ns2
)
{
create
(
:cluster_kubernetes_namespace
,
cluster:
cluster
,
project:
project2
)
}
before
do
group
.
projects
<<
project
group
.
projects
<<
project2
end
it
{
is_expected
.
to
include
(
kube_namespace:
kube_namespace
)
}
end
end
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