Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
a8e2094c
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a8e2094c
编写于
11月 21, 2017
作者:
S
Shinya Maeda
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove logic which glues with KubernetesService, from Platforms::Kubernetes
上级
3cf53cc6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
3 addition
and
57 deletion
+3
-57
app/models/clusters/cluster.rb
app/models/clusters/cluster.rb
+1
-8
app/models/clusters/platforms/kubernetes.rb
app/models/clusters/platforms/kubernetes.rb
+2
-49
未找到文件。
app/models/clusters/cluster.rb
浏览文件 @
a8e2094c
...
...
@@ -17,8 +17,7 @@ module Clusters
# we force autosave to happen when we save `Cluster` model
has_one
:provider_gcp
,
class_name:
'Clusters::Providers::Gcp'
,
autosave:
true
# We have to ":destroy" it today to ensure that we clean also the Kubernetes Integration
has_one
:platform_kubernetes
,
class_name:
'Clusters::Platforms::Kubernetes'
,
autosave:
true
,
dependent: :destroy
# rubocop:disable Cop/ActiveRecordDependent
has_one
:platform_kubernetes
,
class_name:
'Clusters::Platforms::Kubernetes'
has_one
:application_helm
,
class_name:
'Clusters::Applications::Helm'
has_one
:application_ingress
,
class_name:
'Clusters::Applications::Ingress'
...
...
@@ -29,15 +28,9 @@ module Clusters
validates
:name
,
cluster_name:
true
validate
:restrict_modification
,
on: :update
# TODO: Move back this into Clusters::Platforms::Kubernetes in 10.3
# We need callback here because `enabled` belongs to Clusters::Cluster
# Callbacks in Clusters::Platforms::Kubernetes will not be called after update
after_save
:update_kubernetes_integration!
delegate
:status
,
to: :provider
,
allow_nil:
true
delegate
:status_reason
,
to: :provider
,
allow_nil:
true
delegate
:on_creation?
,
to: :provider
,
allow_nil:
true
delegate
:update_kubernetes_integration!
,
to: :platform
,
allow_nil:
true
delegate
:active?
,
to: :platform_kubernetes
,
prefix:
true
,
allow_nil:
true
delegate
:installed?
,
to: :application_helm
,
prefix:
true
,
allow_nil:
true
...
...
app/models/clusters/platforms/kubernetes.rb
浏览文件 @
a8e2094c
...
...
@@ -36,9 +36,6 @@ module Clusters
after_save
:clear_reactive_cache!
# TODO: Glue code till we migrate Kubernetes Integration into Platforms::Kubernetes
after_destroy
:destroy_kubernetes_integration!
alias_attribute
:ca_pem
,
:ca_cert
delegate
:project
,
to: :cluster
,
allow_nil:
true
...
...
@@ -85,33 +82,14 @@ module Clusters
# Caches resources in the namespace so other calls don't need to block on
# network access
def
calculate_reactive_cache
return
unless
active
?
&&
project
&&
!
project
.
pending_delete?
return
unless
enabled
?
&&
project
&&
!
project
.
pending_delete?
# We may want to cache extra things in the future
{
pods:
read_pods
}
end
def
kubeclient
@kubeclient
||=
kubernetes_service
.
kubeclient
if
manages_kubernetes_service?
end
def
update_kubernetes_integration!
raise
'Kubernetes service already configured'
unless
manages_kubernetes_service?
# This is neccesary, otheriwse enabled? returns true even though cluster updated with enabled: false
cluster
.
reload
ensure_kubernetes_service
&
.
update!
(
active:
enabled?
,
api_url:
api_url
,
namespace:
namespace
,
token:
token
,
ca_pem:
ca_cert
)
end
def
active?
manages_kubernetes_service?
@kubeclient
||=
build_kubeclient!
end
private
...
...
@@ -192,31 +170,6 @@ module Clusters
def
enforce_namespace_to_lower_case
self
.
namespace
=
self
.
namespace
&
.
downcase
end
def
enforce_namespace_to_lower_case
self
.
namespace
=
self
.
namespace
&
.
downcase
end
# TODO: glue code till we migrate Kubernetes Service into Platforms::Kubernetes class
def
manages_kubernetes_service?
return
true
unless
kubernetes_service
&
.
active?
kubernetes_service
.
api_url
==
api_url
end
def
destroy_kubernetes_integration!
return
unless
manages_kubernetes_service?
kubernetes_service
&
.
destroy!
end
def
kubernetes_service
@kubernetes_service
||=
project
&
.
kubernetes_service
end
def
ensure_kubernetes_service
@kubernetes_service
||=
kubernetes_service
||
project
&
.
build_kubernetes_service
end
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录