Class: Gitlab::Ci::Config::Entry::Kubernetes

Inherits:
Gitlab::Config::Entry::Node show all
Includes:
Gitlab::Config::Entry::Attributable, Gitlab::Config::Entry::Configurable, Gitlab::Config::Entry::Validatable
Defined in:
lib/gitlab/ci/config/entry/kubernetes.rb

Constant Summary collapse

ALLOWED_KEYS =
%i[namespace agent flux_resource_path managed_resources dashboard].freeze

Constants inherited from Gitlab::Config::Entry::Node

Gitlab::Config::Entry::Node::InvalidError

Instance Attribute Summary

Attributes inherited from Gitlab::Config::Entry::Node

#config, #default, #deprecation, #description, #key, #metadata, #parent

Instance Method Summary collapse

Methods included from Gitlab::Config::Entry::Configurable

#compose!, #entry_create!, #skip_config_hash_validation?

Methods included from Gitlab::Config::Entry::Validatable

#compose!, #errors, included, #validate, #validator

Methods inherited from Gitlab::Config::Entry::Node

#[], #add_warning, #ancestors, #array?, aspects, #compose!, default, #descendants, #errors, #hash?, #initialize, #inspect, #integer?, #leaf?, #location, #opt, #relevant?, #specified?, #string?, #valid?, #value, #warnings, with_aspect

Constructor Details

This class inherits a constructor from Gitlab::Config::Entry::Node

Instance Method Details

#agent_required?Boolean

Returns:

  • (Boolean)


57
58
59
60
61
# File 'lib/gitlab/ci/config/entry/kubernetes.rb', line 57

def agent_required?
  flux_resource_path.present? ||
    dashboard.present? ||
    managed_resources_enabled?
end

#dashboardObject



63
64
65
66
67
# File 'lib/gitlab/ci/config/entry/kubernetes.rb', line 63

def dashboard
  return {} unless @config.is_a?(Hash)

  @config[:dashboard] || {}
end

#managed_resources_enabled?Boolean

Returns:

  • (Boolean)


69
70
71
72
73
# File 'lib/gitlab/ci/config/entry/kubernetes.rb', line 69

def managed_resources_enabled?
  return false unless @config.is_a?(Hash) && @config[:managed_resources].is_a?(Hash)

  @config.dig(:managed_resources, :enabled) == true
end