init_command.rb 703 字节
Newer Older
1 2 3
module Gitlab
  module Kubernetes
    module Helm
4 5 6 7 8 9 10 11 12 13
      class InitCommand
        include BaseCommand

        attr_reader :name, :files

        def initialize(name:, files:)
          @name = name
          @files = files
        end

14 15 16 17 18 19 20 21 22
        def generate_script
          super + [
            init_helm_command
          ].join("\n")
        end

        private

        def init_helm_command
23 24 25 26 27 28
          tls_opts = "--tiller-tls" \
            " --tiller-tls-verify --tls-ca-cert #{files_dir}/ca.pem" \
            " --tiller-tls-cert #{files_dir}/cert.pem" \
            " --tiller-tls-key #{files_dir}/key.pem"

          "helm init #{tls_opts} >/dev/null"
29 30 31 32 33
        end
      end
    end
  end
end