Skip to content

mmpyro/vc-env

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vc-env

A version manager for vcluster CLI, similar to tfenv and pyenv.

Manage multiple versions of the vcluster CLI and switch between them seamlessly.

Documentation

Downloads (latest release)

Latest release: v1.0.0 (tag: v1.0.0).

Platform Asset Download
macOS (Intel) vc-env-darwin-amd64 Download
macOS (Apple Silicon) vc-env-darwin-arm64 Download
Linux (x86_64) vc-env-linux-amd64 Download
Linux (ARM64) vc-env-linux-arm64 Download

Features

  • Install and manage multiple vcluster CLI versions
  • Automatic version switching based on project directory (.vcluster-version)
  • Shell-level, local (directory), and global version configuration
  • Version priority: shell > local > global
  • Auto-detection of OS and architecture for binary downloads
  • Shim-based transparent proxying of vcluster commands

Installation

From Source

git clone https://github.com/mmpyro/vc-env.git
cd vc-env
make build

The binary will be at build/vc-env. Move it to a directory in your PATH:

sudo mv build/vc-env /usr/local/bin/

Cross-compile for All Platforms

make build-all

This produces binaries for:

  • linux/amd64
  • linux/arm64
  • darwin/amd64
  • darwin/arm64

Quick Start

1. Set up VCENV_ROOT

Add to your ~/.bashrc or ~/.zshrc:

export VCENV_ROOT="$HOME/.vcenv"

Reload your shell:

source ~/.bashrc  # or source ~/.zshrc

2. Initialize vc-env

Add the following to your ~/.bashrc or ~/.zshrc (after the VCENV_ROOT export):

eval "$(vc-env init)"

This sets up:

  • A vc-env shell function for vc-env shell support
  • PATH prepend for the vcluster shim

3. Install a vcluster version

# Install a specific version
vc-env install 0.21.1

# Install the latest stable version
vc-env install

4. Set a version

# Set global default
vc-env global 0.21.1

# Set for current directory (creates .vcluster-version)
vc-env local 0.21.1

# Set for current shell session
vc-env shell 0.21.1

5. Use vcluster

vcluster version

The shim automatically resolves and uses the correct version.

Command Reference

Full reference: docs/cli-reference.md

Command Description
vc-env help Display help and all available commands
vc-env list List all installed versions
vc-env list-remote List all available vcluster versions from GitHub
vc-env list-remote --prerelease Include pre-release vcluster versions
vc-env latest Print the latest available version of vcluster from GitHub
vc-env init Initialize vc-env setup
vc-env status Show current environment status
vc-env install [VERSION] Install a specific version (or latest)
vc-env uninstall VERSION Uninstall a specific version
vc-env exec VERSION CMD Run a command using a specific vcluster version
vc-env shell [VERSION] Set/show shell version (VCENV_VERSION)
vc-env local [VERSION] Set/show local version (.vcluster-version)
vc-env global [VERSION] Set/show global version ($VCENV_ROOT/version)
vc-env which Print path to active vcluster binary
vc-env version Print vc-env version
vc-env upgrade Download the latest stable release of vc-env from GitHub and replace the current binary in-place
ev-env autocompletion Generate a Bash autocompletion script for a smoother CLI experience

Version Priority

When vcluster is invoked, the version is resolved in this order:

  1. ShellVCENV_VERSION environment variable (set via vc-env shell)
  2. Local.vcluster-version file in the current or parent directories (set via vc-env local)
  3. Global$VCENV_ROOT/version file (set via vc-env global)

If no version is configured at any level, the command fails with an informative error.

Shell Setup

Bash

Add the following to your ~/.bashrc:

# vc-env setup
export VCENV_ROOT="$HOME/.vcenv"
eval "$(vc-env init)"
source <(vc-env autocompletion)

Zsh

Add the following to your ~/.zshrc:

# vc-env setup
export VCENV_ROOT="$HOME/.vcenv"
eval "$(vc-env init)"
source <(vc-env autocompletion)

Caching

vc-env uses a three-layer caching strategy to keep list-remote and latest fast and reliable. For more details on how it works and how to configure it, see docs/caching.md.

Directory Structure

$VCENV_ROOT/
├── versions/           # Installed vcluster versions
│   ├── 0.21.1/
│   │   └── vcluster    # vcluster binary
│   └── 0.22.0/
│       └── vcluster
├── shims/
│   └── vcluster        # Shim script (auto-generated)
└── version             # Global version file

Development

Run Tests

make test

Run Docker Integration Tests

make test-docker

Build

make build          # Current platform
make build-all      # All platforms

License

See LICENSE for details.

About

version manager for vcluster

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors