Class: Clusters::Applications::Knative

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

Constant Summary collapse

VERSION =
'0.9.0'
REPOSITORY =
'https://charts.gitlab.io'
METRICS_CONFIG =
'https://gitlab.com/gitlab-org/charts/knative/-/raw/v0.9.0/vendor/istio-metrics.yml'
FETCH_IP_ADDRESS_DELAY =
30.seconds
API_GROUPS_PATH =
'config/knative/api_groups.yml'

Instance Method Summary collapse

Methods included from AfterCommitQueue

#run_after_commit, #run_after_commit_or_now

Methods included from Concerns::ApplicationData

#files, #repository

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

#allowed_to_uninstall?Boolean

Returns:

  • (Boolean)

68
69
70
# File 'app/models/clusters/applications/knative.rb', line 68

def allowed_to_uninstall?
  !pre_installed?
end

#available_domainsObject


60
61
62
# File 'app/models/clusters/applications/knative.rb', line 60

def available_domains
  PagesDomain.instance_serverless
end

#chartObject


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

def chart
  'knative/knative'
end

#find_available_domain(pages_domain_id) ⇒ Object


64
65
66
# File 'app/models/clusters/applications/knative.rb', line 64

def find_available_domain(pages_domain_id)
  available_domains.find_by(id: pages_domain_id)
end

#ingress_serviceObject


92
93
94
# File 'app/models/clusters/applications/knative.rb', line 92

def ingress_service
  cluster.kubeclient.get_service('istio-ingressgateway', Clusters::Kubernetes::ISTIO_SYSTEM_NAMESPACE)
end

#install_commandObject


72
73
74
75
76
77
78
79
80
81
82
# File 'app/models/clusters/applications/knative.rb', line 72

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

#original_set_initial_statusObject


22
# File 'app/models/clusters/applications/knative.rb', line 22

alias_method :original_set_initial_status, :set_initial_status

#schedule_status_updateObject


84
85
86
87
88
89
90
# File 'app/models/clusters/applications/knative.rb', line 84

def schedule_status_update
  return unless installed?
  return if external_ip
  return if external_hostname

  ClusterWaitForIngressIpAddressWorker.perform_async(name, id)
end

#set_initial_statusObject


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

def set_initial_status
  return unless cluster&.platform_kubernetes_rbac?

  original_set_initial_status
end

#uninstall_commandObject


96
97
98
99
100
101
102
103
104
# File 'app/models/clusters/applications/knative.rb', line 96

def uninstall_command
  Gitlab::Kubernetes::Helm::DeleteCommand.new(
    name: name,
    rbac: cluster.platform_kubernetes_rbac?,
    files: files,
    predelete: delete_knative_services_and_metrics,
    postdelete: delete_knative_istio_leftovers
  )
end

#valuesObject


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

def values
  { "domain" => hostname }.to_yaml
end