Sha256: 504a40bcace29d693d233a344930aa0ecf2a22adb9f7f052dd4f324ed341247c

Contents?: true

Size: 1.08 KB

Versions: 58

Compression:

Stored size: 1.08 KB

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

    disabled_services  = KuberKit.current_configuration.disabled_services.map(&:to_s)
    if disabled_services.any?
      services = services.select{ |s| !disabled_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

58 entries across 58 versions & 1 rubygems

Version Path
kuber_kit-1.3.8 lib/kuber_kit/actions/service_checker.rb
kuber_kit-1.3.7 lib/kuber_kit/actions/service_checker.rb
kuber_kit-1.1.8 lib/kuber_kit/actions/service_checker.rb
kuber_kit-1.3.6 lib/kuber_kit/actions/service_checker.rb
kuber_kit-1.1.7 lib/kuber_kit/actions/service_checker.rb
kuber_kit-1.3.5 lib/kuber_kit/actions/service_checker.rb
kuber_kit-1.3.4 lib/kuber_kit/actions/service_checker.rb
kuber_kit-1.1.6 lib/kuber_kit/actions/service_checker.rb
kuber_kit-1.3.3 lib/kuber_kit/actions/service_checker.rb
kuber_kit-1.3.2 lib/kuber_kit/actions/service_checker.rb
kuber_kit-1.1.5 lib/kuber_kit/actions/service_checker.rb
kuber_kit-1.3.1 lib/kuber_kit/actions/service_checker.rb
kuber_kit-1.3.0 lib/kuber_kit/actions/service_checker.rb
kuber_kit-1.1.4 lib/kuber_kit/actions/service_checker.rb
kuber_kit-1.2.7 lib/kuber_kit/actions/service_checker.rb
kuber_kit-1.2.6 lib/kuber_kit/actions/service_checker.rb
kuber_kit-1.2.5 lib/kuber_kit/actions/service_checker.rb
kuber_kit-1.2.4 lib/kuber_kit/actions/service_checker.rb
kuber_kit-1.2.2 lib/kuber_kit/actions/service_checker.rb
kuber_kit-1.1.2 lib/kuber_kit/actions/service_checker.rb