# Nautikos
*A lightweight CI/CD tool for updating image tags in Kubernetes manifests.*
[![PyPI version](https://badge.fury.io/py/nautikos.svg)](https://badge.fury.io/py/nautikos)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Python versions](https://img.shields.io/pypi/pyversions/nautikos)]()
## Rationale
A GitOps CI/CD process often uses a deployment or ops repo containing Kubernetes manifests for multiple services and environments. Tools like *Argo-CD* or *Flux* then track these repo's, and apply any changes to the cluster. When a new image of an application is created, you want the corresponding tags to be updated in the manifests housed in the deployment repo. Doing this manually is error prone. Having to write logic in every repo or pipeline to perform this is tedious.
This is where Nautikos comes in.
## Installation
```bash
pip install nautikos
```
## Basic usage
Nautikos is configured through a YAML-file (`./nautikos.yaml`), that specifies where the manifests for the different images and environments can be found:
```yaml
environments:
- name: prod
manifests:
- path: prod/app1/deployment.yaml # Path relative to configuration file
type: kubernetes # Type can be 'kubernetes' or 'kustomize'
labels: # Optional specification of labels for more granular control
- app1
- refs/heads/main
- path: prod/app2/kustomize.yaml
type: kustomize
- name: dev
manifests:
- path: dev/app1/deployment.yaml
type: kubernetes
labels:
- app1
- refs/heads/dev
- path: dev/app3/feature-A/deployment.yaml
type: kubernetes
labels:
- app1
- refs/heads/feature-A
```
Next, you can run Nautikos to update the image tags of specific images in different environments.
```bash
nautikos my-repo 1.2.3 # Updates all occurences of `my-repo` to `1.2.3` in all manifests
nautikos --env prod my-repo 2.3.4 # Updates all occurences of `my-repo` to `2.3.4` in `prod/app1/deployment.yaml` and `prod/app2/deployment`
nautikos --env dev --labels app1 my-repo 4.5.6 # Updates all occurences of `my-repo` to `4.5.6` in `dev/app1/deployment.yaml`
nautikos --labels 'app1,refs/heads/main' my-repo 5.6.7 # Updates all occurences of `my-repo` to `5.6.7` in `prod/app1/deployment.yaml`
```
## Supported tools
The tool works with standard **Kubernetes** manifests and **Kustomize** - **Helm** might be added later. Each have their own format for defining image tags.
```yaml
# Kubernetes manifests
spec:
template:
spec:
containers:
- image: some-repository:tag
# Kustomize
images:
- name: some-repository
newTag: tag
```
## Advanced usage
Nautikos takes several options:
* `--dry-run`: prints the modified files to stdout, but doesn't edit in place
* `--config config-file.yaml`: path to config YAML, default is `./nautikos.yaml`
## Alternatives
There are basically three alternatives to do the same thing:
* **Update manifests manually** - of course this works, but this is not really proper CD
* **Write your own bash scripts in a pipeline using a tool like `sed` or `yq`** - This works, but having to write this logic for every project is tedious.
* **Use a tool like [Argo-CD Image updater](https://argocd-image-updater.readthedocs.io/en/stable/)** - very nice, but a bit heavy-weight, not very actively developed, and doesn't seem to support Azure Container Registry.
## Notes
Multiple YAML docs in one file is not yet supported.
## Dependencies
* **`typer`** - for creating a CLI
* **`ruamel.yaml`** - for handling YAML files while maintaining ordering and comments
Raw data
{
"_id": null,
"home_page": "https://www.github.com/janheindejong/nautikos",
"name": "nautikos",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10,<4.0",
"maintainer_email": "",
"keywords": "Kubernetes,DevOps,CI/CD,Kustomize,GitOps",
"author": "Jan Hein de Jong",
"author_email": "janhein.dejong@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/49/36/4b52f56e5e735b312e69e406621e36eb61d725e89d990487147ef198d135/nautikos-0.3.3.tar.gz",
"platform": null,
"description": "# Nautikos \n\n*A lightweight CI/CD tool for updating image tags in Kubernetes manifests.* \n\n[![PyPI version](https://badge.fury.io/py/nautikos.svg)](https://badge.fury.io/py/nautikos)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Python versions](https://img.shields.io/pypi/pyversions/nautikos)]()\n\n## Rationale\n\nA GitOps CI/CD process often uses a deployment or ops repo containing Kubernetes manifests for multiple services and environments. Tools like *Argo-CD* or *Flux* then track these repo's, and apply any changes to the cluster. When a new image of an application is created, you want the corresponding tags to be updated in the manifests housed in the deployment repo. Doing this manually is error prone. Having to write logic in every repo or pipeline to perform this is tedious. \n\nThis is where Nautikos comes in. \n\n## Installation \n\n```bash\npip install nautikos\n```\n\n## Basic usage \n\nNautikos is configured through a YAML-file (`./nautikos.yaml`), that specifies where the manifests for the different images and environments can be found: \n\n```yaml\nenvironments: \n- name: prod \n manifests: \n - path: prod/app1/deployment.yaml # Path relative to configuration file\n type: kubernetes # Type can be 'kubernetes' or 'kustomize'\n labels: # Optional specification of labels for more granular control\n - app1\n - refs/heads/main\n - path: prod/app2/kustomize.yaml\n type: kustomize\n- name: dev\n manifests: \n - path: dev/app1/deployment.yaml\n type: kubernetes\n labels: \n - app1\n - refs/heads/dev\n - path: dev/app3/feature-A/deployment.yaml\n type: kubernetes\n labels: \n - app1\n - refs/heads/feature-A\n```\n\nNext, you can run Nautikos to update the image tags of specific images in different environments.\n\n```bash\nnautikos my-repo 1.2.3 # Updates all occurences of `my-repo` to `1.2.3` in all manifests\nnautikos --env prod my-repo 2.3.4 # Updates all occurences of `my-repo` to `2.3.4` in `prod/app1/deployment.yaml` and `prod/app2/deployment`\nnautikos --env dev --labels app1 my-repo 4.5.6 # Updates all occurences of `my-repo` to `4.5.6` in `dev/app1/deployment.yaml`\nnautikos --labels 'app1,refs/heads/main' my-repo 5.6.7 # Updates all occurences of `my-repo` to `5.6.7` in `prod/app1/deployment.yaml`\n```\n\n## Supported tools\n\nThe tool works with standard **Kubernetes** manifests and **Kustomize** - **Helm** might be added later. Each have their own format for defining image tags. \n\n```yaml\n# Kubernetes manifests\nspec:\n template:\n spec:\n containers:\n - image: some-repository:tag\n\n# Kustomize\nimages: \n- name: some-repository\n newTag: tag \n```\n\n## Advanced usage\n\nNautikos takes several options: \n\n* `--dry-run`: prints the modified files to stdout, but doesn't edit in place \n* `--config config-file.yaml`: path to config YAML, default is `./nautikos.yaml`\n\n## Alternatives \n\nThere are basically three alternatives to do the same thing: \n\n* **Update manifests manually** - of course this works, but this is not really proper CD\n* **Write your own bash scripts in a pipeline using a tool like `sed` or `yq`** - This works, but having to write this logic for every project is tedious. \n* **Use a tool like [Argo-CD Image updater](https://argocd-image-updater.readthedocs.io/en/stable/)** - very nice, but a bit heavy-weight, not very actively developed, and doesn't seem to support Azure Container Registry. \n\n## Notes \n\nMultiple YAML docs in one file is not yet supported. \n\n## Dependencies \n\n* **`typer`** - for creating a CLI \n* **`ruamel.yaml`** - for handling YAML files while maintaining ordering and comments\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A CD tool for updating image tags in Kubernetes manifests",
"version": "0.3.3",
"split_keywords": [
"kubernetes",
"devops",
"ci/cd",
"kustomize",
"gitops"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1ee8fca0e7ef553847100602643017ee51a6638c3b67a494a9561fec8294d658",
"md5": "a560721f58828c8bf1b6ac724cef57ca",
"sha256": "724a959a18942617be37978a64a91e08c14d364024994a5b0fbaaccbbdf1b7b1"
},
"downloads": -1,
"filename": "nautikos-0.3.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a560721f58828c8bf1b6ac724cef57ca",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10,<4.0",
"size": 6337,
"upload_time": "2023-04-11T15:27:52",
"upload_time_iso_8601": "2023-04-11T15:27:52.221020Z",
"url": "https://files.pythonhosted.org/packages/1e/e8/fca0e7ef553847100602643017ee51a6638c3b67a494a9561fec8294d658/nautikos-0.3.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "49364b52f56e5e735b312e69e406621e36eb61d725e89d990487147ef198d135",
"md5": "8f5437acb066242f9478b690cf7fcb87",
"sha256": "8ea6fa732ccd79c0bedc50c3cbfe97fc50c4deececf58a3ebef162914b9c4306"
},
"downloads": -1,
"filename": "nautikos-0.3.3.tar.gz",
"has_sig": false,
"md5_digest": "8f5437acb066242f9478b690cf7fcb87",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10,<4.0",
"size": 6065,
"upload_time": "2023-04-11T15:27:53",
"upload_time_iso_8601": "2023-04-11T15:27:53.579156Z",
"url": "https://files.pythonhosted.org/packages/49/36/4b52f56e5e735b312e69e406621e36eb61d725e89d990487147ef198d135/nautikos-0.3.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-11 15:27:53",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "janheindejong",
"github_project": "nautikos",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "nautikos"
}