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
dbb313c2
Commit
dbb313c2
authored
Jul 06, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Encode certificate-authority-data in base64
parent
e7acc881
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
6 deletions
+15
-6
lib/gitlab/kubernetes.rb
lib/gitlab/kubernetes.rb
+1
-1
spec/fixtures/config/kubeconfig.yml
spec/fixtures/config/kubeconfig.yml
+1
-1
spec/models/project_services/kubernetes_service_spec.rb
spec/models/project_services/kubernetes_service_spec.rb
+13
-4
No files found.
lib/gitlab/kubernetes.rb
View file @
dbb313c2
...
@@ -113,7 +113,7 @@ module Gitlab
...
@@ -113,7 +113,7 @@ module Gitlab
def
kubeconfig_embed_ca_pem
(
config
,
ca_pem
)
def
kubeconfig_embed_ca_pem
(
config
,
ca_pem
)
cluster
=
config
.
dig
(
:clusters
,
0
,
:cluster
)
cluster
=
config
.
dig
(
:clusters
,
0
,
:cluster
)
cluster
[
:'certificate-authority-data'
]
=
ca_pem
cluster
[
:'certificate-authority-data'
]
=
Base64
.
encode64
(
ca_pem
)
end
end
end
end
end
end
spec/fixtures/config/kubeconfig.yml
View file @
dbb313c2
...
@@ -4,7 +4,7 @@ clusters:
...
@@ -4,7 +4,7 @@ clusters:
-
name
:
gitlab-deploy
-
name
:
gitlab-deploy
cluster
:
cluster
:
server
:
https://kube.domain.com
server
:
https://kube.domain.com
certificate-authority-data
:
PEM
certificate-authority-data
:
"
UEVN
\n
"
contexts
:
contexts
:
-
name
:
gitlab-deploy
-
name
:
gitlab-deploy
context
:
context
:
...
...
spec/models/project_services/kubernetes_service_spec.rb
View file @
dbb313c2
...
@@ -202,10 +202,19 @@ describe KubernetesService, models: true, caching: true do
...
@@ -202,10 +202,19 @@ describe KubernetesService, models: true, caching: true do
describe
'#predefined_variables'
do
describe
'#predefined_variables'
do
let
(
:kubeconfig
)
do
let
(
:kubeconfig
)
do
File
.
read
(
expand_fixture_path
(
'config/kubeconfig.yml'
))
config
=
.
gsub
(
'TOKEN'
,
'token'
)
YAML
.
load
(
File
.
read
(
expand_fixture_path
(
'config/kubeconfig.yml'
)))
.
gsub
(
'PEM'
,
'CA PEM DATA'
)
.
gsub
(
'NAMESPACE'
,
namespace
)
config
.
dig
(
'users'
,
0
,
'user'
)[
'token'
]
=
'token'
config
.
dig
(
'clusters'
,
0
,
'cluster'
)[
'certificate-authority-data'
]
=
Base64
.
encode64
(
'CA PEM DATA'
)
config
.
dig
(
'contexts'
,
0
,
'context'
)[
'namespace'
]
=
namespace
YAML
.
dump
(
config
)
end
end
before
do
before
do
...
...
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