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
Boxiang Sun
gitlab-ce
Commits
d8223468
Commit
d8223468
authored
Nov 06, 2017
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ingress application
parent
3a174c99
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
72 additions
and
13 deletions
+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
No files found.
app/models/clusters/applications/ingress.rb
0 → 100644
View file @
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
View file @
d8223468
...
@@ -5,7 +5,8 @@ module Clusters
...
@@ -5,7 +5,8 @@ module Clusters
self
.
table_name
=
'clusters'
self
.
table_name
=
'clusters'
APPLICATIONS
=
{
APPLICATIONS
=
{
Applications
::
Helm
.
application_name
=>
Applications
::
Helm
Applications
::
Helm
.
application_name
=>
Applications
::
Helm
,
Applications
::
Ingress
.
application_name
=>
Applications
::
Ingress
}.
freeze
}.
freeze
belongs_to
:user
belongs_to
:user
...
@@ -20,6 +21,7 @@ module Clusters
...
@@ -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
: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_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
:provider_gcp
,
update_only:
true
accepts_nested_attributes_for
:platform_kubernetes
,
update_only:
true
accepts_nested_attributes_for
:platform_kubernetes
,
update_only:
true
...
@@ -59,7 +61,8 @@ module Clusters
...
@@ -59,7 +61,8 @@ module Clusters
def
applications
def
applications
[
[
application_helm
||
build_application_helm
application_helm
||
build_application_helm
,
application_ingress
||
build_application_ingress
]
]
end
end
...
...
db/migrate/20171106101200_create_clusters_kubernetes_ingress_apps.rb
0 → 100644
View file @
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
View file @
d8223468
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
#
#
# It's strongly recommended that you check this file into your version control system.
# 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
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
enable_extension
"plpgsql"
...
@@ -464,9 +464,7 @@ ActiveRecord::Schema.define(version: 20171031100710) do
...
@@ -464,9 +464,7 @@ ActiveRecord::Schema.define(version: 20171031100710) do
create_table
"cluster_platforms_kubernetes"
,
force: :cascade
do
|
t
|
create_table
"cluster_platforms_kubernetes"
,
force: :cascade
do
|
t
|
t
.
integer
"cluster_id"
,
null:
false
t
.
integer
"cluster_id"
,
null:
false
t
.
datetime_with_timezone
"created_at"
,
null:
false
t
.
string
"api_url"
t
.
datetime_with_timezone
"updated_at"
,
null:
false
t
.
text
"api_url"
t
.
text
"ca_cert"
t
.
text
"ca_cert"
t
.
string
"namespace"
t
.
string
"namespace"
t
.
string
"username"
t
.
string
"username"
...
@@ -493,9 +491,6 @@ ActiveRecord::Schema.define(version: 20171031100710) do
...
@@ -493,9 +491,6 @@ ActiveRecord::Schema.define(version: 20171031100710) do
create_table
"cluster_providers_gcp"
,
force: :cascade
do
|
t
|
create_table
"cluster_providers_gcp"
,
force: :cascade
do
|
t
|
t
.
integer
"cluster_id"
,
null:
false
t
.
integer
"cluster_id"
,
null:
false
t
.
integer
"status"
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
.
text
"status_reason"
t
.
string
"gcp_project_id"
,
null:
false
t
.
string
"gcp_project_id"
,
null:
false
t
.
string
"zone"
,
null:
false
t
.
string
"zone"
,
null:
false
...
@@ -513,10 +508,6 @@ ActiveRecord::Schema.define(version: 20171031100710) do
...
@@ -513,10 +508,6 @@ ActiveRecord::Schema.define(version: 20171031100710) do
create_table
"clusters"
,
force: :cascade
do
|
t
|
create_table
"clusters"
,
force: :cascade
do
|
t
|
t
.
integer
"user_id"
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
.
boolean
"enabled"
,
default:
true
t
.
string
"name"
,
null:
false
t
.
string
"name"
,
null:
false
t
.
integer
"provider_type"
t
.
integer
"provider_type"
...
@@ -534,6 +525,17 @@ ActiveRecord::Schema.define(version: 20171031100710) do
...
@@ -534,6 +525,17 @@ ActiveRecord::Schema.define(version: 20171031100710) do
t
.
text
"status_reason"
t
.
text
"status_reason"
end
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
|
create_table
"container_repositories"
,
force: :cascade
do
|
t
|
t
.
integer
"project_id"
,
null:
false
t
.
integer
"project_id"
,
null:
false
t
.
string
"name"
,
null:
false
t
.
string
"name"
,
null:
false
...
@@ -1888,6 +1890,7 @@ ActiveRecord::Schema.define(version: 20171031100710) do
...
@@ -1888,6 +1890,7 @@ ActiveRecord::Schema.define(version: 20171031100710) do
add_foreign_key
"cluster_providers_gcp"
,
"clusters"
,
on_delete: :cascade
add_foreign_key
"cluster_providers_gcp"
,
"clusters"
,
on_delete: :cascade
add_foreign_key
"clusters"
,
"users"
,
on_delete: :nullify
add_foreign_key
"clusters"
,
"users"
,
on_delete: :nullify
add_foreign_key
"clusters_applications_helm"
,
"clusters"
,
on_delete: :cascade
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
"container_repositories"
,
"projects"
add_foreign_key
"deploy_keys_projects"
,
"projects"
,
name:
"fk_58a901ca7e"
,
on_delete: :cascade
add_foreign_key
"deploy_keys_projects"
,
"projects"
,
name:
"fk_58a901ca7e"
,
on_delete: :cascade
add_foreign_key
"deployments"
,
"projects"
,
name:
"fk_b9a3851b82"
,
on_delete: :cascade
add_foreign_key
"deployments"
,
"projects"
,
name:
"fk_b9a3851b82"
,
on_delete: :cascade
...
...
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