Skip to main content

lazo

Project description

Lazo

PyPI version

Small utility to work with Rancher. It has been developd to be used in CI environments.

Current features:

  • get infos on running cluster/project/workload
  • get docker image info
  • upgrade workload
  • execute commands in running containers

Install

$ pip install lazo

or using pipx

$ pipx install lazo

Help

$ lazo --help
Usage: lazo [OPTIONS] COMMAND [ARGS]...

Options:
  --version        Show the version and exit.
  --env
  -v, --verbosity  verbosity level
  -q, --quit       no output
  -d, --dry-run    dry-run mode
  --debug          debug mode
  -h, --help       Show this message and exit.

Commands:
  docker
  rancher    

Environment varialbles

  • RANCHER_BASE_URL as --base-url
  • RANCHER_KEY as --key
  • RANCHER_SECRET as --secret
  • RANCHER_CLUSTER as --cluster
  • RANCHER_PROJECT as --project
  • RANCHER_INSECURE as --inxecure
  • DOCKER_REPOSITORY as --repository

You can inspect your default configuration with:

$ lazo --defaults
Env                  Value                                              Origin
repository           https://hub.docker.com/v2
auth
base_url
cluster
insecure             False
project
use_names            False

or list handler environment variables with:

$ lazo --env
Env                  Value
DOCKER_REPOSITORY    -- not set --
RANCHER_AUTH         -- not set --
RANCHER_BASE_URL     -- not set --
RANCHER_CLUSTER      -- not set --
RANCHER_INSECURE     -- not set --
RANCHER_PROJECT      -- not set --
RANCHER_USE_NAMES    -- not set --      

Examples

Rancher

get infos on running workload
$ lazo rancher -i -n info -p cluster1:bitcaster -w bitcaster:bitcaster
Workload infos:
Image: bitcaster/bitcaster:0.3.0a15
Command: ['stack']
imagePullPolicy: Always    
upgrading workload
$ export RANCHER_KEY=key
$ export RANCHER_SECRET=secret
$ lazo upgrade saxix/devpi:latest \
       --base-url https://rancher.example.com/v3/
       --cluster c-wwk6v
       --project p-xd4dg
use stdin to read credentials
$  cat .pass.txt | lazo --stdin \
    upgrade bitcaster:bitcaster \
    bitcaster/bitcaster:0.3.0a10 \
    --insecure
execute command in running container
$ lazo shell bitcaster:db -- ls -al /var/log
total 432
drwxr-xr-x 1 root        root       4096 Jan  1 01:39 .
drwxr-xr-x 1 root        root       4096 Dec 26 00:00 ..
drwxr-xr-x 1 root        root       4096 Jan  1 01:39 apt
-rw-r--r-- 1 root        root      74886 Jan  1 01:39 dpkg.log
-rw-r--r-- 1 root        root      32000 Jan  1 01:39 faillog
drwxr-xr-x 2 root        root       4096 May 25  2017 sysstat

Docker

list image available tags
$ lazo docker info saxix/devpi
latest
2.3
2.2
2.1
2.0
1.1
get information on image
$ lazo docker info library/python --filter '3\.6.*alpine3.8' --size
3.6-alpine3.8                  26.2MiB
3.6.8-alpine3.8                26.2MiB
3.6.7-alpine3.8                26.2MiB
3.6.6-alpine3.8                26.2MiB

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lazo-2.0.3.tar.gz (13.4 kB view details)

Uploaded Source

File details

Details for the file lazo-2.0.3.tar.gz.

File metadata

  • Download URL: lazo-2.0.3.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.2

File hashes

Hashes for lazo-2.0.3.tar.gz
Algorithm Hash digest
SHA256 fd0f98167ae631fca8665fa184db4395d53409902b0c3530c546bc6aedb7d103
MD5 aa5042746f237dc947ef4200a9c4ba2c
BLAKE2b-256 2e4fa9253b8c8b9d409c0de5b869f585e136e31eefb2a236d220f125e04327e6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page