Module: Eien

Defined in:
lib/eien.rb,
lib/eien/task.rb,
lib/eien/cli/cli.rb,
lib/eien/version.rb,
lib/eien/cli/apps.rb,
lib/eien/cli/eien.rb,
lib/eien/init_task.rb,
lib/eien/cli/config.rb,
lib/eien/cli/deploy.rb,
lib/eien/cli/routes.rb,
lib/eien/cli/domains.rb,
lib/eien/cli/secrets.rb,
lib/eien/task_config.rb,
lib/eien/errors/error.rb,
lib/eien/local_config.rb,
lib/eien/cli/processes.rb,
lib/eien/apps/list_task.rb,
lib/eien/apps/create_task.rb,
lib/eien/apps/delete_task.rb,
lib/eien/apps/select_task.rb,
lib/eien/apps/status_task.rb,
lib/eien/config/list_task.rb,
lib/eien/routes/list_task.rb,
lib/eien/deploy/apply_task.rb,
lib/eien/domains/list_task.rb,
lib/eien/secrets/list_task.rb,
lib/eien/config/export_task.rb,
lib/eien/config/update_task.rb,
lib/eien/kubeclient_builder.rb,
lib/eien/renderers/renderer.rb,
lib/eien/routes/create_task.rb,
lib/eien/routes/delete_task.rb,
lib/eien/routes/update_task.rb,
lib/eien/domains/create_task.rb,
lib/eien/domains/delete_task.rb,
lib/eien/domains/update_task.rb,
lib/eien/processes/list_task.rb,
lib/eien/secrets/export_task.rb,
lib/eien/secrets/update_task.rb,
lib/eien/deploy/generate_task.rb,
lib/eien/helpers/time_helpers.rb,
lib/eien/processes/create_task.rb,
lib/eien/processes/delete_task.rb,
lib/eien/processes/update_task.rb,
lib/eien/errors/user_input_error.rb,
lib/eien/renderers/service_renderer.rb,
lib/eien/renderers/deployment_renderer.rb

Defined Under Namespace

Modules: Apps, CLI, Config, Deploy, Domains, Errors, Helpers, Processes, Renderers, Routes, Secrets Classes: InitTask, KubeclientBuilder, LocalConfig, Task, TaskConfig

Constant Summary collapse

LABEL_PREFIX =
"eien.freevision.sk"
CRD_OWNER_SELECTOR_VALUE =
"eien.freevision.sk"
VERSION =
"0.1.3"

Class Method Summary collapse

Class Method Details

.app_from_name(context, name) ⇒ Object



60
61
62
63
64
65
# File 'lib/eien.rb', line 60

def self.app_from_name(context, name)
  kubeclient = build_eien_kubeclient(context)
  kubeclient.get_app(name)
rescue Kubeclient::ResourceNotFoundError
  raise Errors::UserInputError, "App #{name} does not exist."
end

.app_or_default(app) ⇒ Object



51
52
53
# File 'lib/eien.rb', line 51

def self.app_or_default(app)
  app.nil? ? config.app : app
end

.build_eien_kubeclient(context) ⇒ Object



55
56
57
58
# File 'lib/eien.rb', line 55

def self.build_eien_kubeclient(context)
  task_config = TaskConfig.new(context, nil)
  task_config.kubeclient_builder.build_eien_kubeclient(context)
end

.clear_config!Object



32
33
34
# File 'lib/eien.rb', line 32

def self.clear_config!
  @config = nil
end

.configObject



36
37
38
# File 'lib/eien.rb', line 36

def self.config
  @config ||= LocalConfig.build
end

.config_map_name(name) ⇒ Object



71
72
73
# File 'lib/eien.rb', line 71

def self.config_map_name(name)
  "#{name}-config"
end

.context_or_default(context) ⇒ Object



47
48
49
# File 'lib/eien.rb', line 47

def self.context_or_default(context)
  context.nil? ? config.context : context
end

.crd_dirObject



28
29
30
# File 'lib/eien.rb', line 28

def self.crd_dir
  File.join(root, "crds")
end

.prepare_krane_options(krane_options) ⇒ Object



40
41
42
43
44
45
# File 'lib/eien.rb', line 40

def self.prepare_krane_options(krane_options)
  krane_options
    .each_with_object(HashWithIndifferentAccess.new) do |(key, option), options|
    options[key] = option[:default]
  end
end

.rootObject



24
25
26
# File 'lib/eien.rb', line 24

def self.root
  File.expand_path(File.join(__dir__, ".."))
end

.secret_name(name) ⇒ Object



67
68
69
# File 'lib/eien.rb', line 67

def self.secret_name(name)
  "#{name}-secret"
end