Skip to main content

A simple CLI for cdk8s

Project description

CDK8S CLI

A CLI helper for cdk8s.

This is a work-in-progress project with no promise of continued support or development. This is not sutable for production applications.

Features

This project provides a simple CLI to help with applying cdk8s charts.

Usage

# Import the dependencies
from cdk8s_cli.cdk8s_cli import cdk8s_cli
from cdk8s import App, Chart

class ApplicationChart(Chart):
  # Define cdk8s chart here
  ...

# Construct your Apps and charts as you normally would:
app = App()
ApplicationChart(app, "chart-name")

# Then call the CLI with:
cdk8s_cli(app, name="my-app")

That's it! You can now run your application with the desired flags

> python3 my-app.py apply
Resources synthed to /Users/exampleuser/project/my-project/dist
Deploy resources? [y/N]: y
Resource simple-cdk8s-chart-c81aeaa7                    applied.
Resource simple-cdk8s-chart-deployment-c83ea641         applied in namespace simple-cdk8s-chart-c81aeaa7.
Resource simple-cdk8s-chart-deployment-service-c8f17013 applied in namespace simple-cdk8s-chart-c81aeaa7.
Apply complete

Example CLI Usage

Synth all apps

python3 main.py synth

Deploy all apps

python3 main.py deploy

Deploy selected apps

python3 main.py deploy --apps dev prod

Options

positional arguments:
  {synth,apply}         the action to perform. synth will synth the resources to the output directory. apply will apply the resources to the Kubernetes cluster

options:
  -h, --help            show this help message and exit
  --apps APPS [APPS ...]
                        the apps to apply. Defaults to all apps. If supplied, apps not in this list will be skipped
  --kube-context KUBE_CONTEXT
                        the Kubernetes context to use. Defaults to minikube
  --kube-config-file KUBE_CONFIG_FILE
                        the path to a kubeconfig file
  --verbose             enable verbose output
  --unattended          enable unattended mode. This will not prompt for confirmation before applying
  --debug               enable debug mode. This will print debug information
  --validate            experimental feature. Will enable validation mode. This will wait for resources to report ready before exiting
  --validate-timeout-minutes VALIDATE_TIMEOUT_MINUTES
                        the number of minutes to wait for resources to report ready before timing out. Needs --validate to be set

Development

This project is built using:

  • Poetry as the package manager
  • Ruff for formatting and linting

Features to be implemented

  • Unit tests
  • End-to-end tests
    • Use the example projects for this
  • Complete documentation
  • Improve customisation
    • More inputs, more flexability
  • Diff functionality
    • Similar to kubectl diff
  • Destroy functionality
    • Similar to kubectl delete
  • List functionality
    • List all resources in an app
    • Useful, hierarchical view

Examples

Examples can be run using poetry run python3 examples/<example>/<example>.py synth

Simple Example

Link

A very basic example containing a chart with a few simple resources in a single file deployed as a single stage.

Complex Example

Link

A more complex example with multiple charts and multiple stages.

Jobs Example

Link

An example job runner that executes Python scripts from a directory of scripts as jobs.

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

cdk8s_cli-0.1.0a7.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cdk8s_cli-0.1.0a7-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file cdk8s_cli-0.1.0a7.tar.gz.

File metadata

  • Download URL: cdk8s_cli-0.1.0a7.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for cdk8s_cli-0.1.0a7.tar.gz
Algorithm Hash digest
SHA256 a9ab53651ff9c5a14a457a456964643c52bc275ed36bbd81a44387282c446a68
MD5 71f2069c42d357d588e6a7c3eba5d2b3
BLAKE2b-256 88aa16f3bed7f3d9976f32793d997090c83a83f7c17c894780c69e1a296847a1

See more details on using hashes here.

Provenance

The following attestation bundles were made for cdk8s_cli-0.1.0a7.tar.gz:

Publisher: publish.yml on MatthewCane/cdk8s-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cdk8s_cli-0.1.0a7-py3-none-any.whl.

File metadata

  • Download URL: cdk8s_cli-0.1.0a7-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for cdk8s_cli-0.1.0a7-py3-none-any.whl
Algorithm Hash digest
SHA256 c35d876f1147e62c6344e4f6725784c35c145d6aded1c4a05af8ca7a8144f0c8
MD5 f3bc7506efe621ddf3d8667737ab894f
BLAKE2b-256 33a4b48900c52eddd6556bce34ad329b7d573415e119800c86eb471ad66ca741

See more details on using hashes here.

Provenance

The following attestation bundles were made for cdk8s_cli-0.1.0a7-py3-none-any.whl:

Publisher: publish.yml on MatthewCane/cdk8s-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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