Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
d8223468
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,发现更多精彩内容 >>
提交
d8223468
编写于
11月 06, 2017
作者:
K
Kamil Trzcinski
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add ingress application
上级
3a174c99
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
72 addition
and
13 deletion
+72
-13
app/models/clusters/applications/ingress.rb
app/models/clusters/applications/ingress.rb
+32
-0
app/models/clusters/cluster.rb
app/models/clusters/cluster.rb
+5
-2
db/migrate/20171106101200_create_clusters_kubernetes_ingress_apps.rb
...20171106101200_create_clusters_kubernetes_ingress_apps.rb
+21
-0
db/schema.rb
db/schema.rb
+14
-11
未找到文件。
app/models/clusters/applications/ingress.rb
0 → 100644
浏览文件 @
d8223468
module
Clusters
module
Applications
class
Ingress
<
ActiveRecord
::
Base
self
.
table_name
=
'clusters_applications_ingress'
include
::
Clusters
::
Concerns
::
ApplicationStatus
belongs_to
:cluster
,
class_name:
'Clusters::Cluster'
,
foreign_key: :cluster_id
validates
:cluster
,
presence:
true
default_value_for
:ingress_type
,
:nginx
default_value_for
:version
,
:nginx
enum
ingress_type:
{
nginx:
1
}
def
self
.
application_name
self
.
to_s
.
demodulize
.
underscore
end
def
name
self
.
class
.
application_name
end
def
chart
'stable/nginx-ingress'
end
end
end
end
app/models/clusters/cluster.rb
浏览文件 @
d8223468
...
...
@@ -5,7 +5,8 @@ module Clusters
self
.
table_name
=
'clusters'
APPLICATIONS
=
{
Applications
::
Helm
.
application_name
=>
Applications
::
Helm
Applications
::
Helm
.
application_name
=>
Applications
::
Helm
,
Applications
::
Ingress
.
application_name
=>
Applications
::
Ingress
}.
freeze
belongs_to
:user
...
...
@@ -20,6 +21,7 @@ module Clusters
has_one
:platform_kubernetes
,
class_name:
'Clusters::Platforms::Kubernetes'
,
autosave:
true
,
dependent: :destroy
# rubocop:disable Cop/ActiveRecordDependent
has_one
:application_helm
,
class_name:
'Clusters::Applications::Helm'
has_one
:application_ingress
,
class_name:
'Clusters::Applications::Ingress'
accepts_nested_attributes_for
:provider_gcp
,
update_only:
true
accepts_nested_attributes_for
:platform_kubernetes
,
update_only:
true
...
...
@@ -59,7 +61,8 @@ module Clusters
def
applications
[
application_helm
||
build_application_helm
application_helm
||
build_application_helm
,
application_ingress
||
build_application_ingress
]
end
...
...
db/migrate/20171106101200_create_clusters_kubernetes_ingress_apps.rb
0 → 100644
浏览文件 @
d8223468
class
CreateClustersKubernetesIngressApps
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
def
change
create_table
:clusters_applications_ingress
do
|
t
|
t
.
references
:cluster
,
null:
false
,
unique:
true
,
foreign_key:
{
on_delete: :cascade
}
t
.
datetime_with_timezone
:created_at
,
null:
false
t
.
datetime_with_timezone
:updated_at
,
null:
false
t
.
integer
:status
,
null:
false
t
.
integer
:ingress_type
,
null:
false
t
.
string
:version
,
null:
false
t
.
string
:cluster_ip
t
.
text
:status_reason
end
end
end
db/schema.rb
浏览文件 @
d8223468
...
...
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
20171
03110071
0
)
do
ActiveRecord
::
Schema
.
define
(
version:
20171
10610120
0
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
...
...
@@ -464,9 +464,7 @@ ActiveRecord::Schema.define(version: 20171031100710) do
create_table
"cluster_platforms_kubernetes"
,
force: :cascade
do
|
t
|
t
.
integer
"cluster_id"
,
null:
false
t
.
datetime_with_timezone
"created_at"
,
null:
false
t
.
datetime_with_timezone
"updated_at"
,
null:
false
t
.
text
"api_url"
t
.
string
"api_url"
t
.
text
"ca_cert"
t
.
string
"namespace"
t
.
string
"username"
...
...
@@ -493,9 +491,6 @@ ActiveRecord::Schema.define(version: 20171031100710) do
create_table
"cluster_providers_gcp"
,
force: :cascade
do
|
t
|
t
.
integer
"cluster_id"
,
null:
false
t
.
integer
"status"
t
.
integer
"num_nodes"
,
null:
false
t
.
datetime_with_timezone
"created_at"
,
null:
false
t
.
datetime_with_timezone
"updated_at"
,
null:
false
t
.
text
"status_reason"
t
.
string
"gcp_project_id"
,
null:
false
t
.
string
"zone"
,
null:
false
...
...
@@ -513,10 +508,6 @@ ActiveRecord::Schema.define(version: 20171031100710) do
create_table
"clusters"
,
force: :cascade
do
|
t
|
t
.
integer
"user_id"
t
.
integer
"provider_type"
t
.
integer
"platform_type"
t
.
datetime_with_timezone
"created_at"
,
null:
false
t
.
datetime_with_timezone
"updated_at"
,
null:
false
t
.
boolean
"enabled"
,
default:
true
t
.
string
"name"
,
null:
false
t
.
integer
"provider_type"
...
...
@@ -534,6 +525,17 @@ ActiveRecord::Schema.define(version: 20171031100710) do
t
.
text
"status_reason"
end
create_table
"clusters_applications_ingress"
,
force: :cascade
do
|
t
|
t
.
integer
"cluster_id"
,
null:
false
t
.
datetime_with_timezone
"created_at"
,
null:
false
t
.
datetime_with_timezone
"updated_at"
,
null:
false
t
.
integer
"status"
,
null:
false
t
.
integer
"ingress_type"
,
null:
false
t
.
string
"version"
,
null:
false
t
.
string
"cluster_ip"
t
.
text
"status_reason"
end
create_table
"container_repositories"
,
force: :cascade
do
|
t
|
t
.
integer
"project_id"
,
null:
false
t
.
string
"name"
,
null:
false
...
...
@@ -1888,6 +1890,7 @@ ActiveRecord::Schema.define(version: 20171031100710) do
add_foreign_key
"cluster_providers_gcp"
,
"clusters"
,
on_delete: :cascade
add_foreign_key
"clusters"
,
"users"
,
on_delete: :nullify
add_foreign_key
"clusters_applications_helm"
,
"clusters"
,
on_delete: :cascade
add_foreign_key
"clusters_applications_ingress"
,
"clusters"
,
on_delete: :cascade
add_foreign_key
"container_repositories"
,
"projects"
add_foreign_key
"deploy_keys_projects"
,
"projects"
,
name:
"fk_58a901ca7e"
,
on_delete: :cascade
add_foreign_key
"deployments"
,
"projects"
,
name:
"fk_b9a3851b82"
,
on_delete: :cascade
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录