Sha256: 7eda44b2e26e41762b4994112c0d3d664b6444cfd869a9ca259587fe438d6d06

Contents?: true

Size: 923 Bytes

Versions: 4

Compression:

Stored size: 923 Bytes

Contents

# frozen_string_literal: true

require "cloud/sh/commands/base"

module Cloud
  module Sh
    module Commands
      class K8sTail < Base
        def execute
          puts "Command: #{command}"
          puts "Env: #{env.inspect}\n"
          exec env, command
        end

        def command
          [
            exe,
            "^" + (options[:pod] == "all" ? "." : options[:pod]),
            "--context #{options[:context]}",
            "--namespace #{options[:namespace]}",
            "--regex",
            "--tail #{options[:tail]}",
            "--since 240h",
            "--colored-output pod",
            "--follow true"
          ].join(" ")
        end

        def exe
          File.expand_path("../../../../exe/kubetail", __dir__)
        end

        def env
          {
            "KUBECONFIG" => Cloud::Sh::Providers::DigitalOcean.kube_config
          }
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cloud-sh-1.0.6 lib/cloud/sh/commands/k8s_tail.rb
cloud-sh-1.0.5 lib/cloud/sh/commands/k8s_tail.rb
cloud-sh-1.0.4 lib/cloud/sh/commands/k8s_tail.rb
cloud-sh-1.0.3 lib/cloud/sh/commands/k8s_tail.rb