Class: Clusters::Applications::Prometheus

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

Constant Summary collapse

VERSION =
'10.4.1'

Constants included from Concerns::ApplicationVersion

Concerns::ApplicationVersion::EXTERNAL_VERSION

Constants inherited from ApplicationRecord

ApplicationRecord::MAX_PLUCK

Instance Method Summary collapse

Methods included from AfterCommitQueue

#run_after_commit, #run_after_commit_or_now

Methods included from Concerns::ApplicationData

#files, #values

Methods included from Concerns::ApplicationVersion

#update_available?

Methods included from Concerns::ApplicationStatus

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

Methods inherited from ApplicationRecord

cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order

Methods included from SensitiveSerializableHash

#serializable_hash

Instance Method Details

#chartObject


54
55
56
# File 'app/models/clusters/applications/prometheus.rb', line 54

def chart
  "#{name}/prometheus"
end

#files_with_replaced_values(replaced_values) ⇒ Object

Returns a copy of files where the values of 'values.yaml' are replaced by the argument.

See #values for the data format required


99
100
101
# File 'app/models/clusters/applications/prometheus.rb', line 99

def files_with_replaced_values(replaced_values)
  files.merge('values.yaml': replaced_values)
end

#install_commandObject


62
63
64
65
66
67
68
69
70
71
72
# File 'app/models/clusters/applications/prometheus.rb', line 62

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

#managed_prometheus?Boolean

Returns:

  • (Boolean)

44
45
46
# File 'app/models/clusters/applications/prometheus.rb', line 44

def managed_prometheus?
  !externally_installed? && !uninstalled?
end

#patch_command(values) ⇒ Object

Deprecated, to be removed in %14.0 as part of gitlab.com/groups/gitlab-org/-/epics/4280


75
76
77
78
79
80
81
82
83
84
# File 'app/models/clusters/applications/prometheus.rb', line 75

def patch_command(values)
  helm_command_module::PatchCommand.new(
    name: name,
    repository: repository,
    version: version,
    rbac: cluster.platform_kubernetes_rbac?,
    chart: chart,
    files: files_with_replaced_values(values)
  )
end

#repositoryObject


58
59
60
# File 'app/models/clusters/applications/prometheus.rb', line 58

def repository
  'https://gitlab-org.gitlab.io/cluster-integration/helm-stable-archive'
end

#uninstall_commandObject


86
87
88
89
90
91
92
93
# File 'app/models/clusters/applications/prometheus.rb', line 86

def uninstall_command
  helm_command_module::DeleteCommand.new(
    name: name,
    rbac: cluster.platform_kubernetes_rbac?,
    files: files,
    predelete: delete_knative_istio_metrics
  )
end

#updated_since?(timestamp) ⇒ Boolean

Returns:

  • (Boolean)

48
49
50
51
52
# File 'app/models/clusters/applications/prometheus.rb', line 48

def updated_since?(timestamp)
  last_update_started_at &&
    last_update_started_at > timestamp &&
    !update_errored?
end