2018-05-11 09:29:55 -04:00
|
|
|
module Clusters
|
|
|
|
module Applications
|
|
|
|
class Jupyter < ActiveRecord::Base
|
|
|
|
VERSION = '0.0.1'.freeze
|
|
|
|
|
|
|
|
self.table_name = 'clusters_applications_jupyters'
|
|
|
|
|
|
|
|
include ::Clusters::Concerns::ApplicationCore
|
|
|
|
include ::Clusters::Concerns::ApplicationStatus
|
|
|
|
include ::Clusters::Concerns::ApplicationData
|
|
|
|
|
|
|
|
default_value_for :version, VERSION
|
|
|
|
|
|
|
|
def chart
|
2018-05-16 05:01:13 -04:00
|
|
|
"#{name}/jupyterhub"
|
|
|
|
end
|
|
|
|
|
|
|
|
def repository
|
|
|
|
'https://jupyterhub.github.io/helm-chart/'
|
|
|
|
end
|
|
|
|
|
|
|
|
def values
|
|
|
|
content_values.to_yaml
|
2018-05-11 09:29:55 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def install_command
|
|
|
|
Gitlab::Kubernetes::Helm::InstallCommand.new(
|
|
|
|
name,
|
|
|
|
chart: chart,
|
2018-05-16 05:01:13 -04:00
|
|
|
values: values,
|
|
|
|
repository: repository
|
2018-05-11 09:29:55 -04:00
|
|
|
)
|
|
|
|
end
|
2018-05-16 05:01:13 -04:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def specification
|
|
|
|
{
|
|
|
|
"ingress" => { "hosts" => [hostname] },
|
|
|
|
"hub" => { "cookieSecret" => SecureRandom.hex(32) },
|
|
|
|
"proxy" => { "secretToken" => SecureRandom.hex(32) }
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
def content_values
|
|
|
|
YAML.load_file(chart_values_file).deep_merge!(specification)
|
|
|
|
end
|
2018-05-11 09:29:55 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|