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
f2f98d7f
Commit
f2f98d7f
authored
Sep 16, 2019
by
João Cunha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve logic to associate applications
parent
4a990ecb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
app/models/clusters/cluster.rb
app/models/clusters/cluster.rb
+12
-3
No files found.
app/models/clusters/cluster.rb
View file @
f2f98d7f
...
...
@@ -37,10 +37,19 @@ module Clusters
has_one
:platform_kubernetes
,
class_name:
'Clusters::Platforms::Kubernetes'
,
inverse_of: :cluster
,
autosave:
true
APPLICATIONS
.
values
.
each
do
|
application
|
def
self
.
has_one_cluster_application
(
name
)
application
=
APPLICATIONS
[
name
.
to_s
]
has_one
application
.
association_name
,
class_name:
application
.
to_s
# rubocop:disable Rails/ReflectionClassName
end
has_one_cluster_application
:helm
has_one_cluster_application
:ingress
has_one_cluster_application
:cert_manager
has_one_cluster_application
:prometheus
has_one_cluster_application
:runner
has_one_cluster_application
:jupyter
has_one_cluster_application
:knative
has_many
:kubernetes_namespaces
accepts_nested_attributes_for
:provider_gcp
,
update_only:
true
...
...
@@ -123,8 +132,8 @@ module Clusters
end
def
applications
APPLICATIONS
.
values
.
map
do
|
application
|
public_send
(
application
.
association_name
)
||
public_send
(
"build_
#{
application
.
association_name
}
"
)
# rubocop:disable GitlabSecurity/PublicSend
APPLICATIONS
.
values
.
map
do
|
application
_class
|
public_send
(
application
_class
.
association_name
)
||
public_send
(
"build_
#{
application_class
.
association_name
}
"
)
# rubocop:disable GitlabSecurity/PublicSend
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