runway.env_mgr.kbenv module

Kubectl version management.

runway.env_mgr.kbenv.verify_kb_release(kb_url: str, download_dir: str, filename: str)None[source]

Compare checksum and exit if it doesn’t match.

Different releases provide varying checksum files. To account for this, start at SHA512 and work down to the first available checksum.

requests is used for downloading these small files because of difficulty in getting 404 status from urllib on py2. Once py2 support is dropped, downloads can be moved to urllib.

https://stackoverflow.com/questions/1308542/how-to-catch-404-error-in-urllib-urlretrieve

runway.env_mgr.kbenv.download_kb_release(version: str, versions_dir: Path, kb_platform: Optional[str] = None, arch: Optional[str] = None)None[source]

Download kubectl and return path to it.

runway.env_mgr.kbenv.get_version_requested(path: Path)str[source]

Return string listing requested kubectl version.

class runway.env_mgr.kbenv.KBEnvManager(path: Optional[Path] = None)[source]

Bases: runway.env_mgr.EnvManager

kubectl version management.

Designed to be compatible with https://github.com/alexppg/kbenv.

Initialize class.

install(version_requested: Optional[str] = None)str[source]

Ensure kubectl is available.

property bin

Path to the version binary.

Returns

Path

property command_suffix

Return command suffix based on platform.system.

property env_dir

Return the directory used to store version binaries.

property versions_dir

Return the directory used to store binary.

When first used, the existence of the directory is checked and it is created if needed.