Sha256: 08add55c8550f0bebbb6fdafe3f4382e469cfea6f11b0112de620a7b2c7e02e6

Contents?: true

Size: 911 Bytes

Versions: 3

Compression:

Stored size: 911 Bytes

Contents

class KuberKit::Actions::ServiceChecker
  include KuberKit::Import[
    "kubernetes.resources_fetcher",
    "shell.local_shell",
    "core.service_store",
    "ui",
  ]

  Contract Hash => Any
  def call(options)
    services = service_store.all_definitions.values.map(&:service_name).map(&:to_s)

    enabled_services  = KuberKit.current_configuration.enabled_services.map(&:to_s)
    if enabled_services.any?
      services = services.select{ |s| enabled_services.include?(s) }
    end

    resources = resources_fetcher.call("deployments") + resources_fetcher.call("cronjobs")

    missing_services = services.select{ |s| !resources.include?(s.gsub("_", "-")) }

    ui.print_warning("Warning", "This command will only check services deployed using k8s")

    ui.print_info("Missing", missing_services.inspect)

    {}
  rescue KuberKit::Error => e
    ui.print_error("Error", e.message)

    false
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kuber_kit-0.5.3 lib/kuber_kit/actions/service_checker.rb
kuber_kit-0.5.2 lib/kuber_kit/actions/service_checker.rb
kuber_kit-0.5.1 lib/kuber_kit/actions/service_checker.rb