ahmetb / kubectx

Faster way to switch between clusters and namespaces in kubectl
https://kubectx.dev
Apache License 2.0
17.71k stars 1.26k forks source link

Puppet Module to install kubectx #184

Open TJM opened 4 years ago

TJM commented 4 years ago

I would like to have a puppet module (and will probably make one) to install kubectx/kubens to Linux systems. If someone wanted to, it wouldn't be very hard to add Windows support as well. This would be fairly simple, just fetch the zip or tar.gz from GitHub, unzip, and link as appropriate. It would be a lot easier if #140 and #17 are complete first, but for my case, we need Enterprise Linux support anyhow.

I am mostly posting this to gather interest and ideas.

~tommy

ahmetb commented 4 years ago

Personally I don’t want to get to package management business for Linux, the space is vastly segmented fragmented and I don’t use Linux myself. I’ve personally built a cross-platform package manager (see: krew.dev) so this is way too much for me to support reliably.

Although if there’s someone willing to sign up to do this in the long term (especially with something like fpm, that handles multiple pkg managers at once) I’d be happier.

TJM commented 4 years ago

This request is not for package management, but it would be a lot easier if there were OS level packages (as noted). Puppet is a configuration management software, similar in effect to Chef or Ansible.

I have a rough version (POC) from last night's dabbling..

  # TODO: kubens/kubectx (should be a module)
  # These will be parameters...
  $version = '0.7.1'
  $install_path = '/usr/local'
  $pkg_name = 'kubectx'

  # Install kubens and kubectx
  archive { "${pkg_name}-${version}":
    source       => "https://github.com/ahmetb/${pkg_name}/archive/v${version}.tar.gz",
    path         => "/var/tmp/${pkg_name}-${version}.tar.gz",
    extract      => true,
    cleanup      => true,
    extract_path => $install_path,
    creates      => "${install_path}/${pkg_name}-${version}",
    user         => 0,
    group        => 0,
  }

  file { '/usr/local/bin/kubectx':
    ensure => 'link',
    target => "${install_path}/${pkg_name}-${version}/kubectx",
  }

  file { '/usr/local/bin/kubens':
    ensure => 'link',
    target => "${install_path}/${pkg_name}-${version}/kubens",
  }

  # Probably should add in a link for the bash completion
dhollinger commented 4 years ago

Personally I don’t want to get to package management business for Linux, the space is vastly segmented fragmented and I don’t use Linux myself. I’ve personally built a cross-platform package manager (see: krew.dev) so this is way too much for me to support reliably.

For desktops, this is probably a fine stance to have (though for the future of the Go implementation you could make the binary self-updating). That said, many enterprises require system level packages or they won't allow installation on the servers or jump hosts. Additionally, despite the current amount of package managers, the ones still largely used for CLI tools are apt and yum. Sometimes brew. Flatpak, Snap, and AppImage are largely still used for desktop apps.