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
Boxiang Sun
gitlab-ce
Commits
7237ed59
Commit
7237ed59
authored
Mar 06, 2018
by
Mayra Cabrera
Committed by
Kamil Trzciński
Mar 06, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve "Enable privileged mode for Runner installed on Kubernetes"
parent
2e87923d
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
58 additions
and
5 deletions
+58
-5
app/models/clusters/applications/runner.rb
app/models/clusters/applications/runner.rb
+3
-2
changelogs/unreleased/43793-enable-privileged-mode-for-runner.yml
...gs/unreleased/43793-enable-privileged-mode-for-runner.yml
+5
-0
db/migrate/20180305144721_add_privileged_to_runner.rb
db/migrate/20180305144721_add_privileged_to_runner.rb
+18
-0
db/schema.rb
db/schema.rb
+2
-1
spec/models/clusters/applications/runner_spec.rb
spec/models/clusters/applications/runner_spec.rb
+30
-0
vendor/runner/values.yaml
vendor/runner/values.yaml
+0
-2
No files found.
app/models/clusters/applications/runner.rb
View file @
7237ed59
...
@@ -56,12 +56,13 @@ module Clusters
...
@@ -56,12 +56,13 @@ module Clusters
def
specification
def
specification
{
{
"gitlabUrl"
=>
gitlab_url
,
"gitlabUrl"
=>
gitlab_url
,
"runnerToken"
=>
ensure_runner
.
token
"runnerToken"
=>
ensure_runner
.
token
,
"runners"
=>
{
"privileged"
=>
privileged
}
}
}
end
end
def
content_values
def
content_values
specification
.
merge
(
YAML
.
load_file
(
chart_values_file
)
)
YAML
.
load_file
(
chart_values_file
).
deep_merge!
(
specification
)
end
end
end
end
end
end
...
...
changelogs/unreleased/43793-enable-privileged-mode-for-runner.yml
0 → 100644
View file @
7237ed59
---
title
:
Enable privileged mode for GitLab Runner
merge_request
:
17528
author
:
type
:
added
db/migrate/20180305144721_add_privileged_to_runner.rb
0 → 100644
View file @
7237ed59
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class
AddPrivilegedToRunner
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
add_column_with_default
:clusters_applications_runners
,
:privileged
,
:boolean
,
default:
true
,
allow_null:
false
end
def
down
remove_column
:clusters_applications_runners
,
:privileged
end
end
db/schema.rb
View file @
7237ed59
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
#
#
# It's strongly recommended that you check this file into your version control system.
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
2018030
4204842
)
do
ActiveRecord
::
Schema
.
define
(
version:
2018030
5144721
)
do
# These are extensions that must be enabled in order to support this database
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
enable_extension
"plpgsql"
...
@@ -603,6 +603,7 @@ ActiveRecord::Schema.define(version: 20180304204842) do
...
@@ -603,6 +603,7 @@ ActiveRecord::Schema.define(version: 20180304204842) do
t
.
datetime_with_timezone
"updated_at"
,
null:
false
t
.
datetime_with_timezone
"updated_at"
,
null:
false
t
.
string
"version"
,
null:
false
t
.
string
"version"
,
null:
false
t
.
text
"status_reason"
t
.
text
"status_reason"
t
.
boolean
"privileged"
,
default:
true
,
null:
false
end
end
add_index
"clusters_applications_runners"
,
[
"cluster_id"
],
name:
"index_clusters_applications_runners_on_cluster_id"
,
unique:
true
,
using: :btree
add_index
"clusters_applications_runners"
,
[
"cluster_id"
],
name:
"index_clusters_applications_runners_on_cluster_id"
,
unique:
true
,
using: :btree
...
...
spec/models/clusters/applications/runner_spec.rb
View file @
7237ed59
...
@@ -34,6 +34,8 @@ describe Clusters::Applications::Runner do
...
@@ -34,6 +34,8 @@ describe Clusters::Applications::Runner do
is_expected
.
to
include
(
'checkInterval'
)
is_expected
.
to
include
(
'checkInterval'
)
is_expected
.
to
include
(
'rbac'
)
is_expected
.
to
include
(
'rbac'
)
is_expected
.
to
include
(
'runners'
)
is_expected
.
to
include
(
'runners'
)
is_expected
.
to
include
(
'privileged: true'
)
is_expected
.
to
include
(
'image: ubuntu:16.04'
)
is_expected
.
to
include
(
'resources'
)
is_expected
.
to
include
(
'resources'
)
is_expected
.
to
include
(
"runnerToken:
#{
ci_runner
.
token
}
"
)
is_expected
.
to
include
(
"runnerToken:
#{
ci_runner
.
token
}
"
)
is_expected
.
to
include
(
"gitlabUrl:
#{
Gitlab
::
Routing
.
url_helpers
.
root_url
}
"
)
is_expected
.
to
include
(
"gitlabUrl:
#{
Gitlab
::
Routing
.
url_helpers
.
root_url
}
"
)
...
@@ -65,5 +67,33 @@ describe Clusters::Applications::Runner do
...
@@ -65,5 +67,33 @@ describe Clusters::Applications::Runner do
expect
(
gitlab_runner
.
runner
).
not_to
be_nil
expect
(
gitlab_runner
.
runner
).
not_to
be_nil
end
end
end
end
context
'with duplicated values on vendor/runner/values.yaml'
do
let
(
:values
)
do
{
"concurrent"
=>
4
,
"checkInterval"
=>
3
,
"rbac"
=>
{
"create"
=>
false
},
"clusterWideAccess"
=>
false
,
"runners"
=>
{
"privileged"
=>
false
,
"image"
=>
"ubuntu:16.04"
,
"builds"
=>
{},
"services"
=>
{},
"helpers"
=>
{}
}
}
end
before
do
allow
(
gitlab_runner
).
to
receive
(
:chart_values
).
and_return
(
values
)
end
it
'should overwrite values.yaml'
do
is_expected
.
to
include
(
"privileged:
#{
gitlab_runner
.
privileged
}
"
)
end
end
end
end
end
end
vendor/runner/values.yaml
View file @
7237ed59
...
@@ -15,10 +15,8 @@ rbac:
...
@@ -15,10 +15,8 @@ rbac:
clusterWideAccess
:
false
clusterWideAccess
:
false
## Configuration for the Pods that that the runner launches for each new job
## Configuration for the Pods that that the runner launches for each new job
##
runners
:
runners
:
image
:
ubuntu:16.04
image
:
ubuntu:16.04
privileged
:
false
builds
:
{}
builds
:
{}
services
:
{}
services
:
{}
helpers
:
{}
helpers
:
{}
...
...
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