Module: Floe::ContainerRunner::Kubernetes::HostPathVolumeHandler

Included in:
Floe::ContainerRunner::Kubernetes
Defined in:
lib/floe/container_runner/kubernetes/host_path_volume_handler.rb

Overview

Mixin that handles host_path volumes for Kubernetes by staging the host-side directory to S3 for download by an init container.

Constant Summary collapse

DEFAULT_INIT_IMAGE =
"curlimages/curl:latest"
INIT_CONTAINER_NAME =
"floe-init"

Instance Method Summary collapse

Instance Method Details

#cleanup_staged_volumes(staged_volumes) ⇒ Object

Deletes every S3 object represented by staged_volumes, suppressing errors for each deletion.



22
23
24
25
26
27
28
29
# File 'lib/floe/container_runner/kubernetes/host_path_volume_handler.rb', line 22

def cleanup_staged_volumes(staged_volumes)
  Array(staged_volumes).each do |volume|
    key = volume[:s3_key] || volume["s3_key"]
    Floe.logger.debug("Deleting s3://#{s3_bucket}/#{key}...")
    delete_s3_object(key)
    Floe.logger.debug("Deleting s3://#{s3_bucket}/#{key}...Complete")
  end
end

#init_host_path_volume_options(options) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/floe/container_runner/kubernetes/host_path_volume_handler.rb', line 12

def init_host_path_volume_options(options)
  @s3_endpoint   = options["s3_endpoint"]
  @s3_bucket     = options["s3_bucket"]
  @s3_access_key = options["s3_access_key"]
  @s3_secret_key = options["s3_secret_key"]
  @init_image    = options.fetch("init_image", DEFAULT_INIT_IMAGE)
end