cdk8s-cli


Namecdk8s-cli JSON
Version 0.1.0a5 PyPI version JSON
download
home_pageNone
SummaryA simple CLI for cdk8s
upload_time2024-10-26 12:12:05
maintainerNone
docs_urlNone
authorMatthew Cane
requires_python<4.0,>=3.12
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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

```python
# 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)
```

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

```bash
> 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

```bash
python3 main.py synth
```

#### Deploy all apps

```bash
python3 main.py deploy
```

#### Deploy selected apps

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

### Options

```text
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. If supplied, unnamed apps will always 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`
- [x] 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](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

[Link](examples/complex)

A more complex example with multiple charts and multiple stages.

### Jobs Example

[Link](examples/jobs)

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


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "cdk8s-cli",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.12",
    "maintainer_email": null,
    "keywords": null,
    "author": "Matthew Cane",
    "author_email": "matthew.cane0@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/91/55/35d361f1c016a326114446484c179ecd4917b3efe5d1dad05c5d5f2de5e3/cdk8s_cli-0.1.0a5.tar.gz",
    "platform": null,
    "description": "# CDK8S CLI\n\n**A CLI helper for cdk8s.**\n\nThis is a work-in-progress project with no promise of continued support or development. This is not sutable for production applications.\n\n## Features\n\nThis project provides a simple CLI to help with applying cdk8s charts.\n\n## Usage\n\n```python\n# Import the dependencies\nfrom cdk8s_cli.cdk8s_cli import cdk8s_cli\nfrom cdk8s import App, Chart\n\nclass ApplicationChart(Chart):\n  # Define cdk8s chart here\n  ...\n\n# Construct your Apps and charts as you normally would:\napp = App()\nApplicationChart(app, \"chart-name\")\n\n# Then call the CLI with:\ncdk8s_cli(app)\n```\n\nThat's it! You can now run your application with the desired flags\n\n```bash\n> python3 my-app.py apply\nResources synthed to /Users/exampleuser/project/my-project/dist\nDeploy resources? [y/N]: y\nResource simple-cdk8s-chart-c81aeaa7                    applied.\nResource simple-cdk8s-chart-deployment-c83ea641         applied in namespace simple-cdk8s-chart-c81aeaa7.\nResource simple-cdk8s-chart-deployment-service-c8f17013 applied in namespace simple-cdk8s-chart-c81aeaa7.\nApply complete\n```\n\n### Example CLI Usage\n\n#### Synth all apps\n\n```bash\npython3 main.py synth\n```\n\n#### Deploy all apps\n\n```bash\npython3 main.py deploy\n```\n\n#### Deploy selected apps\n\n```bash\npython3 main.py deploy --apps dev prod\n```\n\n### Options\n\n```text\npositional arguments:\n  {synth,apply}         the action to perform. synth will synth the resources to the output directory. apply will apply the resources to the Kubernetes cluster\n\noptions:\n  -h, --help            show this help message and exit\n  --apps APPS [APPS ...]\n                        the apps to apply. If supplied, unnamed apps will always be skipped\n  --kube-context KUBE_CONTEXT\n                        the Kubernetes context to use. Defaults to minikube\n  --kube-config-file KUBE_CONFIG_FILE\n                        the path to a kubeconfig file\n  --verbose             enable verbose output\n  --unattended          enable unattended mode. This will not prompt for confirmation before applying\n  --debug               enable debug mode. This will print debug information\n  --validate            experimental feature. Will enable validation mode. This will wait for resources to report ready before exiting\n  --validate-timeout-minutes VALIDATE_TIMEOUT_MINUTES\n                        the number of minutes to wait for resources to report ready before timing out. Needs --validate to be set\n```\n\n## Development\n\nThis project is built using:\n\n- Poetry as the package manager\n- Ruff for formatting and linting\n\n### Features to be implemented\n\n- [ ] Unit tests\n- [ ] End-to-end tests\n  - Use the example projects for this\n- [ ] Complete documentation\n- [ ] Improve customisation\n  - More inputs, more flexability\n- [ ] Diff functionality\n  - Similar to `kubectl diff`\n- [ ] Destroy functionality\n  - Similar to `kubectl delete`\n- [x] List functionality\n  - List all resources in an app\n  - Useful, hierarchical view\n\n## Examples\n\nExamples can be run using `poetry run python3 examples/<example>/<example>.py synth`\n\n### Simple Example\n\n[Link](examples/simple)\n\nA very basic example containing a chart with a few simple resources in a single file deployed as a single stage.\n\n### Complex Example\n\n[Link](examples/complex)\n\nA more complex example with multiple charts and multiple stages.\n\n### Jobs Example\n\n[Link](examples/jobs)\n\nAn example job runner that executes Python scripts from a directory of scripts as jobs.\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A simple CLI for cdk8s",
    "version": "0.1.0a5",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fbffa903a60d1cebe0090e78656e167435dfe3c3aa44dd278718539883353911",
                "md5": "967e71d1b3e1198e708ab3d8ff9c8c5d",
                "sha256": "5334cfe9fae8593108aa7ac6e9d1b6ddfb7c52f1e9238462321b6e1b124aaf0e"
            },
            "downloads": -1,
            "filename": "cdk8s_cli-0.1.0a5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "967e71d1b3e1198e708ab3d8ff9c8c5d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.12",
            "size": 6802,
            "upload_time": "2024-10-26T12:12:03",
            "upload_time_iso_8601": "2024-10-26T12:12:03.929711Z",
            "url": "https://files.pythonhosted.org/packages/fb/ff/a903a60d1cebe0090e78656e167435dfe3c3aa44dd278718539883353911/cdk8s_cli-0.1.0a5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "915535d361f1c016a326114446484c179ecd4917b3efe5d1dad05c5d5f2de5e3",
                "md5": "9c68ae39ef2831c9c2d105331803662e",
                "sha256": "6e2db4faff3bff10213d3fbcaacd6e15395f6a5c60805a7b3d0c0808a0e18966"
            },
            "downloads": -1,
            "filename": "cdk8s_cli-0.1.0a5.tar.gz",
            "has_sig": false,
            "md5_digest": "9c68ae39ef2831c9c2d105331803662e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.12",
            "size": 6058,
            "upload_time": "2024-10-26T12:12:05",
            "upload_time_iso_8601": "2024-10-26T12:12:05.180724Z",
            "url": "https://files.pythonhosted.org/packages/91/55/35d361f1c016a326114446484c179ecd4917b3efe5d1dad05c5d5f2de5e3/cdk8s_cli-0.1.0a5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-26 12:12:05",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "cdk8s-cli"
}
        
Elapsed time: 0.63610s