Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
GitLab
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
projects.thm.de
GitLab
Commits
0d454802
Commit
0d454802
authored
Dec 22, 2017
by
Mayra Cabrera
Committed by
Kamil Trzciński
Dec 22, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extend Cluster Applications to allow installation of Prometheus
parent
79cbfedf
Changes
39
Hide whitespace changes
Inline
Side-by-side
Showing
39 changed files
with
805 additions
and
327 deletions
+805
-327
app/assets/javascripts/clusters/clusters_bundle.js
app/assets/javascripts/clusters/clusters_bundle.js
+2
-0
app/assets/javascripts/clusters/components/applications.vue
app/assets/javascripts/clusters/components/applications.vue
+20
-0
app/assets/javascripts/clusters/services/clusters_service.js
app/assets/javascripts/clusters/services/clusters_service.js
+1
-0
app/assets/javascripts/clusters/stores/clusters_store.js
app/assets/javascripts/clusters/stores/clusters_store.js
+7
-0
app/assets/stylesheets/pages/clusters.scss
app/assets/stylesheets/pages/clusters.scss
+1
-1
app/models/clusters/applications/helm.rb
app/models/clusters/applications/helm.rb
+2
-15
app/models/clusters/applications/ingress.rb
app/models/clusters/applications/ingress.rb
+2
-21
app/models/clusters/applications/prometheus.rb
app/models/clusters/applications/prometheus.rb
+26
-0
app/models/clusters/cluster.rb
app/models/clusters/cluster.rb
+5
-2
app/models/clusters/concerns/application_core.rb
app/models/clusters/concerns/application_core.rb
+29
-0
app/services/clusters/applications/base_helm_service.rb
app/services/clusters/applications/base_helm_service.rb
+1
-1
app/views/projects/clusters/show.html.haml
app/views/projects/clusters/show.html.haml
+1
-0
changelogs/unreleased/41053-extend-cluster-applications-to-allow-install-to-prometheus.yml
...d-cluster-applications-to-allow-install-to-prometheus.yml
+5
-0
db/migrate/20171212203433_create_clusters_applications_prometheus.rb
...20171212203433_create_clusters_applications_prometheus.rb
+18
-0
db/schema.rb
db/schema.rb
+9
-0
lib/gitlab/kubernetes/helm.rb
lib/gitlab/kubernetes/helm.rb
+1
-89
lib/gitlab/kubernetes/helm/api.rb
lib/gitlab/kubernetes/helm/api.rb
+42
-0
lib/gitlab/kubernetes/helm/install_command.rb
lib/gitlab/kubernetes/helm/install_command.rb
+53
-0
lib/gitlab/kubernetes/helm/pod.rb
lib/gitlab/kubernetes/helm/pod.rb
+69
-0
spec/controllers/projects/clusters/applications_controller_spec.rb
...rollers/projects/clusters/applications_controller_spec.rb
+1
-1
spec/factories/clusters/applications/helm.rb
spec/factories/clusters/applications/helm.rb
+4
-1
spec/factories/clusters/applications/ingress.rb
spec/factories/clusters/applications/ingress.rb
+0
-35
spec/features/projects/clusters/applications_spec.rb
spec/features/projects/clusters/applications_spec.rb
+1
-1
spec/javascripts/clusters/components/applications_spec.js
spec/javascripts/clusters/components/applications_spec.js
+5
-0
spec/javascripts/clusters/services/mock_data.js
spec/javascripts/clusters/services/mock_data.js
+6
-0
spec/javascripts/clusters/stores/clusters_store_spec.js
spec/javascripts/clusters/stores/clusters_store_spec.js
+7
-0
spec/lib/gitlab/kubernetes/helm/api_spec.rb
spec/lib/gitlab/kubernetes/helm/api_spec.rb
+9
-40
spec/lib/gitlab/kubernetes/helm/install_command_spec.rb
spec/lib/gitlab/kubernetes/helm/install_command_spec.rb
+111
-0
spec/lib/gitlab/kubernetes/helm/pod_spec.rb
spec/lib/gitlab/kubernetes/helm/pod_spec.rb
+86
-0
spec/models/clusters/applications/helm_spec.rb
spec/models/clusters/applications/helm_spec.rb
+6
-6
spec/models/clusters/applications/ingress_spec.rb
spec/models/clusters/applications/ingress_spec.rb
+1
-101
spec/models/clusters/applications/prometheus_spec.rb
spec/models/clusters/applications/prometheus_spec.rb
+16
-0
spec/models/clusters/cluster_spec.rb
spec/models/clusters/cluster_spec.rb
+7
-3
spec/serializers/cluster_application_entity_spec.rb
spec/serializers/cluster_application_entity_spec.rb
+2
-2
spec/services/clusters/applications/check_installation_progress_service_spec.rb
.../applications/check_installation_progress_service_spec.rb
+2
-2
spec/services/clusters/applications/install_service_spec.rb
spec/services/clusters/applications/install_service_spec.rb
+7
-5
spec/services/clusters/applications/schedule_installation_service_spec.rb
...usters/applications/schedule_installation_service_spec.rb
+1
-1
spec/support/cluster_application_spec.rb
spec/support/cluster_application_spec.rb
+105
-0
vendor/prometheus/values.yaml
vendor/prometheus/values.yaml
+134
-0
No files found.
app/assets/javascripts/clusters/clusters_bundle.js
View file @
0d454802
...
...
@@ -30,6 +30,7 @@ export default class Clusters {
installHelmPath
,
installIngressPath
,
installRunnerPath
,
installPrometheusPath
,
clusterStatus
,
clusterStatusReason
,
helpPath
,
...
...
@@ -44,6 +45,7 @@ export default class Clusters {
installHelmEndpoint
:
installHelmPath
,
installIngressEndpoint
:
installIngressPath
,
installRunnerEndpoint
:
installRunnerPath
,
installPrometheusEndpoint
:
installPrometheusPath
,
});
this
.
toggle
=
this
.
toggle
.
bind
(
this
);
...
...
app/assets/javascripts/clusters/components/applications.vue
View file @
0d454802
...
...
@@ -67,6 +67,16 @@ export default {
and send the results back to GitLab.`
,
));
},
prometheusDescription
()
{
return
sprintf
(
_
.
escape
(
s__
(
'
ClusterIntegration|Prometheus is an open-source monitoring system with %{gitlabIntegrationLink} to monitor deployed applications.
'
)),
{
gitlabIntegrationLink
:
`<a href="https://docs.gitlab.com/ce/user/project/integrations/prometheus.html", target="_blank" rel="noopener noreferrer">
${
_
.
escape
(
s__
(
'
ClusterIntegration|Gitlab Integration
'
))}
</a>`
,
},
false
,
);
},
},
};
</
script
>
...
...
@@ -105,6 +115,16 @@ export default {
:status-reason=
"applications.ingress.statusReason"
:request-status=
"applications.ingress.requestStatus"
:request-reason=
"applications.ingress.requestReason"
/>
<application-row
id=
"prometheus"
:title=
"applications.prometheus.title"
title-link=
"https://prometheus.io/docs/introduction/overview/"
:description=
"prometheusDescription"
:status=
"applications.prometheus.status"
:status-reason=
"applications.prometheus.statusReason"
:request-status=
"applications.prometheus.requestStatus"
:request-reason=
"applications.prometheus.requestReason"
/>
<!-- NOTE: Don't forget to update `clusters.scss` min-height for this block and uncomment `application_spec` tests -->
<!-- Add GitLab Runner row, all other plumbing is complete -->
...
...
app/assets/javascripts/clusters/services/clusters_service.js
View file @
0d454802
...
...
@@ -7,6 +7,7 @@ export default class ClusterService {
helm
:
this
.
options
.
installHelmEndpoint
,
ingress
:
this
.
options
.
installIngressEndpoint
,
runner
:
this
.
options
.
installRunnerEndpoint
,
prometheus
:
this
.
options
.
installPrometheusEndpoint
,
};
}
...
...
app/assets/javascripts/clusters/stores/clusters_store.js
View file @
0d454802
...
...
@@ -28,6 +28,13 @@ export default class ClusterStore {
requestStatus
:
null
,
requestReason
:
null
,
},
prometheus
:
{
title
:
s__
(
'
ClusterIntegration|Prometheus
'
),
status
:
null
,
statusReason
:
null
,
requestStatus
:
null
,
requestReason
:
null
,
},
},
};
}
...
...
app/assets/stylesheets/pages/clusters.scss
View file @
0d454802
...
...
@@ -6,7 +6,7 @@
.cluster-applications-table
{
// Wait for the Vue to kick-in and render the applications block
min-height
:
302
px
;
min-height
:
400
px
;
}
.clusters-dropdown-menu
{
...
...
app/models/clusters/applications/helm.rb
View file @
0d454802
...
...
@@ -3,32 +3,19 @@ module Applications
class
Helm
<
ActiveRecord
::
Base
self
.
table_name
=
'clusters_applications_helm'
include
::
Clusters
::
Concerns
::
ApplicationCore
include
::
Clusters
::
Concerns
::
ApplicationStatus
belongs_to
:cluster
,
class_name:
'Clusters::Cluster'
,
foreign_key: :cluster_id
default_value_for
:version
,
Gitlab
::
Kubernetes
::
Helm
::
HELM_VERSION
validates
:cluster
,
presence:
true
after_initialize
:set_initial_status
def
self
.
application_name
self
.
to_s
.
demodulize
.
underscore
end
def
set_initial_status
return
unless
not_installable?
self
.
status
=
'installable'
if
cluster
&
.
platform_kubernetes_active?
end
def
name
self
.
class
.
application_name
end
def
install_command
Gitlab
::
Kubernetes
::
Helm
::
InstallCommand
.
new
(
name
,
true
)
Gitlab
::
Kubernetes
::
Helm
::
InstallCommand
.
new
(
name
,
install_helm:
true
)
end
end
end
...
...
app/models/clusters/applications/ingress.rb
View file @
0d454802
...
...
@@ -3,41 +3,22 @@ module Applications
class
Ingress
<
ActiveRecord
::
Base
self
.
table_name
=
'clusters_applications_ingress'
include
::
Clusters
::
Concerns
::
ApplicationCore
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
after_initialize
:set_initial_status
enum
ingress_type:
{
nginx:
1
}
def
self
.
application_name
self
.
to_s
.
demodulize
.
underscore
end
def
set_initial_status
return
unless
not_installable?
self
.
status
=
'installable'
if
cluster
&
.
application_helm_installed?
end
def
name
self
.
class
.
application_name
end
def
chart
'stable/nginx-ingress'
end
def
install_command
Gitlab
::
Kubernetes
::
Helm
::
InstallCommand
.
new
(
name
,
false
,
chart
)
Gitlab
::
Kubernetes
::
Helm
::
InstallCommand
.
new
(
name
,
chart:
chart
)
end
end
end
...
...
app/models/clusters/applications/prometheus.rb
0 → 100644
View file @
0d454802
module
Clusters
module
Applications
class
Prometheus
<
ActiveRecord
::
Base
VERSION
=
"2.0.0"
.
freeze
self
.
table_name
=
'clusters_applications_prometheus'
include
::
Clusters
::
Concerns
::
ApplicationCore
include
::
Clusters
::
Concerns
::
ApplicationStatus
default_value_for
:version
,
VERSION
def
chart
'stable/prometheus'
end
def
chart_values_file
"
#{
Rails
.
root
}
/vendor/
#{
name
}
/values.yaml"
end
def
install_command
Gitlab
::
Kubernetes
::
Helm
::
InstallCommand
.
new
(
name
,
chart:
chart
,
chart_values_file:
chart_values_file
)
end
end
end
end
app/models/clusters/cluster.rb
View file @
0d454802
...
...
@@ -6,7 +6,8 @@ class Cluster < ActiveRecord::Base
APPLICATIONS
=
{
Applications
::
Helm
.
application_name
=>
Applications
::
Helm
,
Applications
::
Ingress
.
application_name
=>
Applications
::
Ingress
Applications
::
Ingress
.
application_name
=>
Applications
::
Ingress
,
Applications
::
Prometheus
.
application_name
=>
Applications
::
Prometheus
}.
freeze
belongs_to
:user
...
...
@@ -21,6 +22,7 @@ class Cluster < ActiveRecord::Base
has_one
:application_helm
,
class_name:
'Clusters::Applications::Helm'
has_one
:application_ingress
,
class_name:
'Clusters::Applications::Ingress'
has_one
:application_prometheus
,
class_name:
'Clusters::Applications::Prometheus'
accepts_nested_attributes_for
:provider_gcp
,
update_only:
true
accepts_nested_attributes_for
:platform_kubernetes
,
update_only:
true
...
...
@@ -62,7 +64,8 @@ def created?
def
applications
[
application_helm
||
build_application_helm
,
application_ingress
||
build_application_ingress
application_ingress
||
build_application_ingress
,
application_prometheus
||
build_application_prometheus
]
end
...
...
app/models/clusters/concerns/application_core.rb
0 → 100644
View file @
0d454802
module
Clusters
module
Concerns
module
ApplicationCore
extend
ActiveSupport
::
Concern
included
do
belongs_to
:cluster
,
class_name:
'Clusters::Cluster'
,
foreign_key: :cluster_id
validates
:cluster
,
presence:
true
after_initialize
:set_initial_status
def
set_initial_status
return
unless
not_installable?
self
.
status
=
'installable'
if
cluster
&
.
application_helm_installed?
end
def
self
.
application_name
self
.
to_s
.
demodulize
.
underscore
end
def
name
self
.
class
.
application_name
end
end
end
end
end
app/services/clusters/applications/base_helm_service.rb
View file @
0d454802
...
...
@@ -18,7 +18,7 @@ def kubeclient
end
def
helm_api
@helm_api
||=
Gitlab
::
Kubernetes
::
Helm
.
new
(
kubeclient
)
@helm_api
||=
Gitlab
::
Kubernetes
::
Helm
::
Api
.
new
(
kubeclient
)
end
def
install_command
...
...
app/views/projects/clusters/show.html.haml
View file @
0d454802
...
...
@@ -9,6 +9,7 @@
.edit-cluster-form.js-edit-cluster-form
{
data:
{
status_path:
status_path
,
install_helm_path:
install_applications_namespace_project_cluster_path
(
@cluster
.
project
.
namespace
,
@cluster
.
project
,
@cluster
,
:helm
),
install_ingress_path:
install_applications_namespace_project_cluster_path
(
@cluster
.
project
.
namespace
,
@cluster
.
project
,
@cluster
,
:ingress
),
install_prometheus_path:
install_applications_namespace_project_cluster_path
(
@cluster
.
project
.
namespace
,
@cluster
.
project
,
@cluster
,
:prometheus
),
toggle_status:
@cluster
.
enabled?
?
'true'
:
'false'
,
cluster_status:
@cluster
.
status_name
,
cluster_status_reason:
@cluster
.
status_reason
,
...
...
changelogs/unreleased/41053-extend-cluster-applications-to-allow-install-to-prometheus.yml
0 → 100644
View file @
0d454802
---
title
:
Add Prometheus to available Cluster applications
merge_request
:
15895
author
:
type
:
added
db/migrate/20171212203433_create_clusters_applications_prometheus.rb
0 → 100644
View file @
0d454802
class
CreateClustersApplicationsPrometheus
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
def
change
create_table
:clusters_applications_prometheus
do
|
t
|
t
.
references
:cluster
,
null:
false
,
unique:
true
,
foreign_key:
{
on_delete: :cascade
}
t
.
integer
:status
,
null:
false
t
.
string
:version
,
null:
false
t
.
text
:status_reason
t
.
timestamps_with_timezone
null:
false
end
end
end
db/schema.rb
View file @
0d454802
...
...
@@ -568,6 +568,15 @@
t
.
text
"status_reason"
end
create_table
"clusters_applications_prometheus"
,
force: :cascade
do
|
t
|
t
.
integer
"cluster_id"
,
null:
false
t
.
integer
"status"
,
null:
false
t
.
string
"version"
,
null:
false
t
.
text
"status_reason"
t
.
datetime_with_timezone
"created_at"
,
null:
false
t
.
datetime_with_timezone
"updated_at"
,
null:
false
end
create_table
"container_repositories"
,
force: :cascade
do
|
t
|
t
.
integer
"project_id"
,
null:
false
t
.
string
"name"
,
null:
false
...
...
lib/gitlab/kubernetes/helm.rb
View file @
0d454802
module
Gitlab
module
Kubernetes
class
Helm
module
Helm
HELM_VERSION
=
'2.7.0'
.
freeze
NAMESPACE
=
'gitlab-managed-apps'
.
freeze
INSTALL_DEPS
=
<<-
EOS
.
freeze
set -eo pipefail
apk add -U ca-certificates openssl >/dev/null
wget -q -O - https://kubernetes-helm.storage.googleapis.com/helm-v${HELM_VERSION}-linux-amd64.tar.gz | tar zxC /tmp >/dev/null
mv /tmp/linux-amd64/helm /usr/bin/
EOS
InstallCommand
=
Struct
.
new
(
:name
,
:install_helm
,
:chart
)
do
def
pod_name
"install-
#{
name
}
"
end
end
def
initialize
(
kubeclient
)
@kubeclient
=
kubeclient
@namespace
=
Gitlab
::
Kubernetes
::
Namespace
.
new
(
NAMESPACE
,
kubeclient
)
end
def
install
(
command
)
@namespace
.
ensure_exists!
@kubeclient
.
create_pod
(
pod_resource
(
command
))
end
##
# Returns Pod phase
#
# https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-phase
#
# values: "Pending", "Running", "Succeeded", "Failed", "Unknown"
#
def
installation_status
(
pod_name
)
@kubeclient
.
get_pod
(
pod_name
,
@namespace
.
name
).
status
.
phase
end
def
installation_log
(
pod_name
)
@kubeclient
.
get_pod_log
(
pod_name
,
@namespace
.
name
).
body
end
def
delete_installation_pod!
(
pod_name
)
@kubeclient
.
delete_pod
(
pod_name
,
@namespace
.
name
)
end
private
def
pod_resource
(
command
)
labels
=
{
'gitlab.org/action'
:
'install'
,
'gitlab.org/application'
:
command
.
name
}
metadata
=
{
name:
command
.
pod_name
,
namespace:
@namespace
.
name
,
labels:
labels
}
container
=
{
name:
'helm'
,
image:
'alpine:3.6'
,
env:
generate_pod_env
(
command
),
command:
%w(/bin/sh)
,
args:
%w(-c $(COMMAND_SCRIPT))
}
spec
=
{
containers:
[
container
],
restartPolicy:
'Never'
}
::
Kubeclient
::
Resource
.
new
(
metadata:
metadata
,
spec:
spec
)
end
def
generate_pod_env
(
command
)
{
HELM_VERSION
:
HELM_VERSION
,
TILLER_NAMESPACE
:
@namespace
.
name
,
COMMAND_SCRIPT
:
generate_script
(
command
)
}.
map
{
|
key
,
value
|
{
name:
key
,
value:
value
}
}
end
def
generate_script
(
command
)
[
INSTALL_DEPS
,
helm_init_command
(
command
),
helm_install_command
(
command
)
].
join
(
"
\n
"
)
end
def
helm_init_command
(
command
)
if
command
.
install_helm
'helm init >/dev/null'
else
'helm init --client-only >/dev/null'
end
end
def
helm_install_command
(
command
)
return
if
command
.
chart
.
nil?
"helm install
#{
command
.
chart
}
--name
#{
command
.
name
}
--namespace
#{
@namespace
.
name
}
>/dev/null"
end
end
end
end
lib/gitlab/kubernetes/helm/api.rb
0 → 100644
View file @
0d454802
module
Gitlab
module
Kubernetes
module
Helm
class
Api
def
initialize
(
kubeclient
)
@kubeclient
=
kubeclient
@namespace
=
Gitlab
::
Kubernetes
::
Namespace
.
new
(
Gitlab
::
Kubernetes
::
Helm
::
NAMESPACE
,
kubeclient
)
end
def
install
(
command
)
@namespace
.
ensure_exists!
@kubeclient
.
create_pod
(
pod_resource
(
command
))
end
##
# Returns Pod phase
#
# https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-phase
#
# values: "Pending", "Running", "Succeeded", "Failed", "Unknown"
#
def
installation_status
(
pod_name
)
@kubeclient
.
get_pod
(
pod_name
,
@namespace
.
name
).
status
.
phase
end
def
installation_log
(
pod_name
)
@kubeclient
.
get_pod_log
(
pod_name
,
@namespace
.
name
).
body
end
def
delete_installation_pod!
(
pod_name
)
@kubeclient
.
delete_pod
(
pod_name
,
@namespace
.
name
)
end
private
def
pod_resource
(
command
)
Pod
.
new
(
command
,
@namespace
.
name
,
@kubeclient
).
generate
end
end
end
end
end
lib/gitlab/kubernetes/helm/install_command.rb
0 → 100644
View file @
0d454802
module
Gitlab
module
Kubernetes
module
Helm
class
InstallCommand
attr_reader
:name
,
:install_helm
,
:chart
,
:chart_values_file
def
initialize
(
name
,
install_helm:
false
,
chart:
false
,
chart_values_file:
false
)
@name
=
name
@install_helm
=
install_helm
@chart
=
chart
@chart_values_file
=
chart_values_file
end
def
pod_name
"install-
#{
name
}
"
end
def
generate_script
(
namespace_name
)
[
install_dps_command
,
init_command
,
complete_command
(
namespace_name
)
].
join
(
"
\n
"
)
end
private
def
init_command
if
install_helm
'helm init >/dev/null'
else
'helm init --client-only >/dev/null'
end
end
def
complete_command
(
namespace_name
)
return
unless
chart
"helm install
#{
chart
}
--name
#{
name
}
--namespace
#{
namespace_name
}
>/dev/null"
end
def
install_dps_command
<<~
HEREDOC
set -eo pipefail
apk add -U ca-certificates openssl >/dev/null
wget -q -O - https://kubernetes-helm.storage.googleapis.com/helm-v
#{
Gitlab
::
Kubernetes
::
Helm
::
HELM_VERSION
}
-linux-amd64.tar.gz | tar zxC /tmp >/dev/null
mv /tmp/linux-amd64/helm /usr/bin/
HEREDOC
end
end
end
end
end
lib/gitlab/kubernetes/helm/pod.rb
0 → 100644
View file @
0d454802
module
Gitlab
module
Kubernetes
module
Helm
class
Pod
def
initialize
(
command
,
namespace_name
,
kubeclient
)
@command
=
command
@namespace_name
=
namespace_name
@kubeclient
=
kubeclient
end
def
generate
spec
=
{
containers:
[
container_specification
],
restartPolicy:
'Never'
}
if
command
.
chart_values_file
generate_config_map
spec
[
'volumes'
]
=
volumes_specification
end
::
Kubeclient
::
Resource
.
new
(
metadata:
metadata
,
spec:
spec
)
end
private
attr_reader
:command
,
:namespace_name
,
:kubeclient
def
container_specification
container
=
{
name:
'helm'
,
image:
'alpine:3.6'
,
env:
generate_pod_env
(
command
),
command:
%w(/bin/sh)
,
args:
%w(-c $(COMMAND_SCRIPT))
}
container
[
:volumeMounts
]
=
volume_mounts_specification
if
command
.
chart_values_file
container
end
def
labels
{
'gitlab.org/action'
:
'install'
,
'gitlab.org/application'
:
command
.
name
}
end
def
metadata
{
name:
command
.
pod_name
,
namespace:
namespace_name
,
labels:
labels
}
end
def
volume_mounts_specification
[{
name:
'config-volume'
,
mountPath:
'/etc/config'
}]
end
def
volumes_specification
[{
name:
'config-volume'
,
configMap:
{
name:
'values-config'
}
}]
end
def
generate_pod_env
(
command
)
{
HELM_VERSION
:
Gitlab
::
Kubernetes
::
Helm
::
HELM_VERSION
,
TILLER_NAMESPACE
:
namespace_name
,
COMMAND_SCRIPT
:
command
.
generate_script
(
namespace_name
)
}.
map
{
|
key
,
value
|
{
name:
key
,
value:
value
}
}
end
def
generate_config_map
resource
=
::
Kubeclient
::
Resource
.
new
resource
.
metadata
=
{
name:
'values-config'
,
namespace:
namespace_name
}
resource
.
data
=
YAML
.
load_file
(
command
.
chart_values_file
)
kubeclient
.
create_config_map
(
resource
)
end
end
end
end
end
spec/controllers/projects/clusters/applications_controller_spec.rb
View file @
0d454802
...
...
@@ -52,7 +52,7 @@ def current_application
context
'when application is already installing'
do
before
do
create
(
:cluster_applications_helm
,
:installing
,
cluster:
cluster
)
create
(
:cluster
s
_applications_helm
,
:installing
,
cluster:
cluster
)
end
it
'returns 400'
do
...
...
spec/factories/clusters/applications/helm.rb
View file @
0d454802
FactoryBot
.
define
do
factory
:cluster_applications_helm
,
class:
Clusters
::
Applications
::
Helm
do
factory
:cluster
s
_applications_helm
,
class:
Clusters
::
Applications
::
Helm
do
cluster
factory:
%i(cluster provided_by_gcp)
trait
:not_installable
do
...
...
@@ -31,5 +31,8 @@
installing
updated_at
ClusterWaitForAppInstallationWorker
::
TIMEOUT
.
ago
end
factory
:clusters_applications_ingress
,
class:
Clusters
::
Applications
::
Ingress
factory
:clusters_applications_prometheus
,
class:
Clusters
::
Applications
::
Prometheus
end
end
spec/factories/clusters/applications/ingress.rb
deleted
100644 → 0
View file @
79cbfedf
FactoryBot
.
define
do
factory
:cluster_applications_ingress
,
class:
Clusters
::
Applications
::
Ingress
do
cluster
factory:
%i(cluster provided_by_gcp)
trait
:not_installable
do
status
(
-
2
)
end
trait
:installable
do
status
0
end
trait
:scheduled
do
status
1
end
trait
:installing
do
status
2
end