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
3a1aa0a5
Commit
3a1aa0a5
authored
Dec 04, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve conflict in app/models/clusters/platforms/kubernetes.rb
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
a091e24d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
106 deletions
+0
-106
app/models/clusters/platforms/kubernetes.rb
app/models/clusters/platforms/kubernetes.rb
+0
-88
spec/models/clusters/platforms/kubernetes_spec.rb
spec/models/clusters/platforms/kubernetes_spec.rb
+0
-18
No files found.
app/models/clusters/platforms/kubernetes.rb
View file @
3a1aa0a5
...
...
@@ -5,11 +5,8 @@ module Clusters
include
Gitlab
::
Kubernetes
include
ReactiveCaching
<<<<<<<
HEAD
=======
prepend
EE
::
KubernetesService
>>>>>>>
origin
/
master
self
.
table_name
=
'cluster_platforms_kubernetes'
self
.
reactive_cache_key
=
->
(
kubernetes
)
{
[
kubernetes
.
class
.
model_name
.
singular
,
kubernetes
.
id
]
}
...
...
@@ -90,7 +87,6 @@ module Clusters
# network access
def
calculate_reactive_cache
return
unless
enabled?
&&
project
&&
!
project
.
pending_delete?
<<<<<<<
HEAD
# We may want to cache extra things in the future
{
pods:
read_pods
}
...
...
@@ -102,95 +98,12 @@ module Clusters
private
=======
# We may want to cache extra things in the future
{
pods:
read_pods
}
end
def
kubeclient
@kubeclient
||=
build_kubeclient!
end
private
>>>>>>>
origin
/
master
def
kubeconfig
to_kubeconfig
(
url:
api_url
,
namespace:
actual_namespace
,
token:
token
,
ca_pem:
ca_pem
)
<<<<<<<
HEAD
end
def
default_namespace
return
unless
project
slug
=
"
#{
project
.
path
}
-
#{
project
.
id
}
"
.
downcase
slug
.
gsub
(
/[^-a-z0-9]/
,
'-'
).
gsub
(
/^-+/
,
''
)
end
def
build_kubeclient!
(
api_path:
'api'
,
api_version:
'v1'
)
raise
"Incomplete settings"
unless
api_url
&&
actual_namespace
unless
(
username
&&
password
)
||
token
raise
"Either username/password or token is required to access API"
end
::
Kubeclient
::
Client
.
new
(
join_api_url
(
api_path
),
api_version
,
auth_options:
kubeclient_auth_options
,
ssl_options:
kubeclient_ssl_options
,
http_proxy_uri:
ENV
[
'http_proxy'
]
)
end
# Returns a hash of all pods in the namespace
def
read_pods
kubeclient
=
build_kubeclient!
kubeclient
.
get_pods
(
namespace:
actual_namespace
).
as_json
rescue
KubeException
=>
err
raise
err
unless
err
.
error_code
==
404
[]
end
def
kubeclient_ssl_options
opts
=
{
verify_ssl:
OpenSSL
::
SSL
::
VERIFY_PEER
}
if
ca_pem
.
present?
opts
[
:cert_store
]
=
OpenSSL
::
X509
::
Store
.
new
opts
[
:cert_store
].
add_cert
(
OpenSSL
::
X509
::
Certificate
.
new
(
ca_pem
))
end
opts
end
def
kubeclient_auth_options
{
bearer_token:
token
}
end
def
join_api_url
(
api_path
)
url
=
URI
.
parse
(
api_url
)
prefix
=
url
.
path
.
sub
(
%r{/+
\z
}
,
''
)
url
.
path
=
[
prefix
,
api_path
].
join
(
"/"
)
url
.
to_s
end
def
terminal_auth
{
token:
token
,
ca_pem:
ca_pem
,
max_session_time:
current_application_settings
.
terminal_max_session_time
}
end
=======
end
def
default_namespace
...
...
@@ -259,7 +172,6 @@ module Clusters
}
end
>>>>>>>
origin
/
master
def
enforce_namespace_to_lower_case
self
.
namespace
=
self
.
namespace
&
.
downcase
end
...
...
spec/models/clusters/platforms/kubernetes_spec.rb
View file @
3a1aa0a5
...
...
@@ -239,14 +239,6 @@ describe Clusters::Platforms::Kubernetes, :use_clean_rails_memory_store_caching
it
{
is_expected
.
to
be_nil
}
end
<<<<<<<
HEAD
context
'when kubernetes responds with valid pods'
do
before
do
stub_kubeclient_pods
end
it
{
is_expected
.
to
eq
(
pods:
[
kube_pod
])
}
=======
context
'when kubernetes responds with valid pods and deployments'
do
before
do
stub_kubeclient_pods
...
...
@@ -254,16 +246,12 @@ describe Clusters::Platforms::Kubernetes, :use_clean_rails_memory_store_caching
end
it
{
is_expected
.
to
eq
(
pods:
[
kube_pod
],
deployments:
[
kube_deployment
])
}
>>>>>>>
origin
/
master
end
context
'when kubernetes responds with 500s'
do
before
do
stub_kubeclient_pods
(
status:
500
)
<<<<<<<
HEAD
=======
stub_kubeclient_deployments
(
status:
500
)
>>>>>>>
origin
/
master
end
it
{
expect
{
subject
}.
to
raise_error
(
KubeException
)
}
...
...
@@ -272,16 +260,10 @@ describe Clusters::Platforms::Kubernetes, :use_clean_rails_memory_store_caching
context
'when kubernetes responds with 404s'
do
before
do
stub_kubeclient_pods
(
status:
404
)
<<<<<<<
HEAD
end
it
{
is_expected
.
to
eq
(
pods:
[])
}
=======
stub_kubeclient_deployments
(
status:
404
)
end
it
{
is_expected
.
to
eq
(
pods:
[],
deployments:
[])
}
>>>>>>>
origin
/
master
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