Build, verify and push operators
Project description
Operator Courier
The Operator Courier is used to build, validate and push Operator Artifacts.
Usage
Command Line Interface
To install the operator courier project to use from the command line, just install the latest release from PyPI:
$ pip3 install operator-courier
Once the project is installed, you can verify that a set of files is valid and can be bundled and pushed. First, create a flat directory containing all of the CSV, CRD and PACKAGE files that are included in your bundle. Then just use operator-courier verify
to test it.
$ operator-courier verify $BUNDLE_DIR
To generate an operator bundle and push it to a quay.io app registry just use operator-courier push
. Just pass the directory, namespace, repository, release version and quay.io authorization token needed to push.
$ operator-courier push $BUNDLE_DIR $EXAMPLE_NAMESPACE $EXAMPLE_REPOSITORY $EXAMPLE_RELEASE "$AUTH_TOKEN"
Once that is created, you should be able to view your bundle on quay.io's Application page for your particular namespace, repo, and release version (https://quay.io/application/$EXAMPLE_NAMESPACE/$EXAMPLE_REPOSITORY?tab=$EXAMPLE_RELEASE)
For more info, run help on any of the subcommands
$ operator-courier -h
$ operator-courier push -h
Authentication
Currently, the quay API used by the courier can only be authenticated using quay.io's basic account token authentication. In order to get this token to authenticate with quay, a request needs to be made against the login API. This requires a normal quay.io account, and takes a username and password as parameters. This will return an auth token which can be passed to the courier.
$ AUTH_TOKEN=$(curl -sH "Content-Type: application/json" -XPOST https://quay.io/cnr/api/v1/users/login -d '
{
"user": {
"username": "'"${QUAY_USERNAME}"'",
"password": "'"${QUAY_PASSWORD}"'"
}
}' | jq -r '.token')
Expecting future enhancements, this authentication process will change somewhat in future releases.
Library
To use the Operator Courier in your project, simply install the Operator Courier pip package. Then import the api module:
from operatorcourier import api
def main():
api.build_verify_and_push($your_namespace, $your_repository, $your_release_version, $your_quay_authtoken, source_dir="./my/folder/to/bundle/")
We also support passing a list of strings that make up the bundle by specifying the yamls=
parameter, i.e.:
api.build_verify_and_push($your_namespace, $your_repository, $your_release_version, $your_quay_authtoken, yamls=$your_yamls_list)
Building and running the tool locally with pip
$ pip3 install --user .
$ operator-courier
Testing
Running the tests
Install tox and run:
$ tox
This will run the tests with several versions of Python 3, measure coverage, and run flake8 for code linting.
For further details, please see the contribution guide.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for operator_courier-1.2.0-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04d06077720fb2be6b38c91361ec3014c25dc37fc4196277dd1903d87830c011 |
|
MD5 | 8bd2e2c6c113b2edcd1e5b1b74fd4d9a |
|
BLAKE2b-256 | d020f1deadc3885607dc9912d9f3fd9530142a5f04de3bd169e5eea4aba2a23b |