Class: Clusters::Applications::Jupyter

Inherits:
ApplicationRecord show all
Includes:
Concerns::ApplicationCore, Concerns::ApplicationData, Concerns::ApplicationStatus, Concerns::ApplicationVersion
Defined in:
app/models/clusters/applications/jupyter.rb

Constant Summary collapse

VERSION =
'0.9.0'

Instance Method Summary collapse

Methods included from Concerns::ApplicationData

#files, #uninstall_command

Methods included from Concerns::ApplicationVersion

#update_available?

Methods included from Concerns::ApplicationStatus

#available?, #status_states, #update_in_progress?, #updateable?

Methods inherited from ApplicationRecord

at_most, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, underscore, without_order

Instance Method Details

#callback_urlObject


52
53
54
# File 'app/models/clusters/applications/jupyter.rb', line 52

def callback_url
  "http://#{hostname}/hub/oauth_callback"
end

#chartObject


29
30
31
# File 'app/models/clusters/applications/jupyter.rb', line 29

def chart
  "#{name}/jupyterhub"
end

#install_commandObject


41
42
43
44
45
46
47
48
49
50
# File 'app/models/clusters/applications/jupyter.rb', line 41

def install_command
  Gitlab::Kubernetes::Helm::InstallCommand.new(
    name: name,
    version: VERSION,
    rbac: cluster.platform_kubernetes_rbac?,
    chart: chart,
    files: files,
    repository: repository
  )
end

#oauth_scopesObject


56
57
58
# File 'app/models/clusters/applications/jupyter.rb', line 56

def oauth_scopes
  'api read_repository write_repository'
end

#repositoryObject


33
34
35
# File 'app/models/clusters/applications/jupyter.rb', line 33

def repository
  'https://jupyterhub.github.io/helm-chart/'
end

#set_initial_statusObject


21
22
23
24
25
26
27
# File 'app/models/clusters/applications/jupyter.rb', line 21

def set_initial_status
  return unless not_installable?
  return unless cluster&.application_ingress_available?

  ingress = cluster.application_ingress
  self.status = status_states[:installable] if ingress.external_ip_or_hostname?
end

#valuesObject


37
38
39
# File 'app/models/clusters/applications/jupyter.rb', line 37

def values
  content_values.to_yaml
end