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
1804227b
Commit
1804227b
authored
Feb 09, 2020
by
GitLab Bot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add latest changes from gitlab-org/gitlab@master
parent
204311cd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
1 deletion
+20
-1
lib/gitlab/kubernetes/kube_client.rb
lib/gitlab/kubernetes/kube_client.rb
+10
-1
spec/lib/gitlab/kubernetes/kube_client_spec.rb
spec/lib/gitlab/kubernetes/kube_client_spec.rb
+10
-0
No files found.
lib/gitlab/kubernetes/kube_client.rb
View file @
1804227b
...
...
@@ -90,12 +90,21 @@ module Gitlab
attr_reader
:api_prefix
,
:kubeclient_options
DEFAULT_KUBECLIENT_OPTIONS
=
{
timeouts:
{
open:
10
,
read:
30
}
}.
freeze
# We disable redirects through 'http_max_redirects: 0',
# so that KubeClient does not follow redirects and
# expose internal services.
def
initialize
(
api_prefix
,
**
kubeclient_options
)
@api_prefix
=
api_prefix
@kubeclient_options
=
kubeclient_options
.
merge
(
http_max_redirects:
0
)
@kubeclient_options
=
DEFAULT_KUBECLIENT_OPTIONS
.
deep_merge
(
kubeclient_options
)
.
merge
(
http_max_redirects:
0
)
validate_url!
end
...
...
spec/lib/gitlab/kubernetes/kube_client_spec.rb
View file @
1804227b
...
...
@@ -92,6 +92,16 @@ describe Gitlab::Kubernetes::KubeClient do
it_behaves_like
'local address'
end
it
'falls back to default options, but allows overriding'
do
client
=
Gitlab
::
Kubernetes
::
KubeClient
.
new
(
api_url
,
{})
defaults
=
Gitlab
::
Kubernetes
::
KubeClient
::
DEFAULT_KUBECLIENT_OPTIONS
expect
(
client
.
kubeclient_options
[
:timeouts
]).
to
eq
(
defaults
[
:timeouts
])
client
=
Gitlab
::
Kubernetes
::
KubeClient
.
new
(
api_url
,
timeouts:
{
read:
7
})
expect
(
client
.
kubeclient_options
[
:timeouts
][
:read
]).
to
eq
(
7
)
expect
(
client
.
kubeclient_options
[
:timeouts
][
:open
]).
to
eq
(
defaults
[
:timeouts
][
:open
])
end
end
describe
'#core_client'
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