Skip to content

Commit

Permalink
Massive refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewCane committed Oct 11, 2024
1 parent 27f7c66 commit 2f57e93
Show file tree
Hide file tree
Showing 10 changed files with 281 additions and 649 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Python
__pycache__/
.venv

# Ruff
.ruff_cache/

# Application
dist/
dist/

56 changes: 41 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,67 @@
# CDK8S CLI

**A CLI extension to cdk8s.**
**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 provides extensions to standard cdk8s object to facilitate application deployments to a cluster without any external tooling using a simple CLI.
This project provides a simple CLI to help with applying cdk8s charts.

## Usage

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

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

# Then call the CLI with:
cdk8s_cli(app)
```

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

### Example CLI Usage

#### Synth all apps

```bash
python3 main.py synth --all
python3 main.py synth
```

#### Synth selected apps
#### Deploy all apps

```bash
python3 main.py synth --apps dev prod
python3 main.py deploy
```

#### Deploy selected apps

```bash
python3 main.py deploy --apps dev prod
```

### Options

```text
usage: complex.py [-h] [--apps APPS [APPS ...]] [--context CONTEXT] [--verbose] [--unattended] {synth,apply}
A CLI for deploying CDK8s apps.
positional arguments:
{deploy,synth,list} The action to perform.
{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 deploy in a space seperated list
--all deploy all apps
--context CONTEXT The Kubernetes context to use. Defaults to minikube
--kube-config-file KUBE_CONFIG_FILE
the path to a kubeconfig file
the apps to apply. If supplied, unnamed apps will always be skipped
--context CONTEXT the Kubernetes context to use. Defaults to minikube
--verbose enable verbose output
--unattended enable unattended mode. This will not prompt for confirmation before deploying.
--unattended enable unattended mode. This will not prompt for confirmation before applying
```

## Development
Expand All @@ -59,12 +81,16 @@ This project is built using:

## Examples

Examples can be run using `poetry run python3 examples/<example>/main.py synth --all`
Examples can be run using `poetry run python3 examples/<example>/<example>.py synth`

### Simple Example

### [Simple Example](examples/simple)
[Link](examples/simple)

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

### [Complex Example](examples/complex)
### Complex Example

[Link](examples/complex)

A more complex example with multiple charts and multiple stages.
Loading

0 comments on commit 2f57e93

Please sign in to comment.