Skip to main content

A CD tool for updating image tags in Kubernetes manifests

Project description

Nautikos

A lightweight CI/CD tool for updating image tags in Kubernetes manifests.

PyPI version Code style: black Python versions

Rationale

A GitOps CI/CD process usually 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. 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

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:

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.

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.

# 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 - 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

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

nautikos-0.3.2.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

nautikos-0.3.2-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file nautikos-0.3.2.tar.gz.

File metadata

  • Download URL: nautikos-0.3.2.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.10.9 Windows/10

File hashes

Hashes for nautikos-0.3.2.tar.gz
Algorithm Hash digest
SHA256 1f274ce2e92c866c7b3faf0d92c391d8e774d498415f53c8ca727ddf464246d6
MD5 f8c725f272b82aad00dd0650281d72f2
BLAKE2b-256 60944862bbe032cc1e8f91cfbc7cadbb4605144008be509cba207a74617d9038

See more details on using hashes here.

Provenance

File details

Details for the file nautikos-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: nautikos-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.10.9 Windows/10

File hashes

Hashes for nautikos-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ab94d72bda4e0de4becb8177e4f0d736b9e5378116a36fc217c753b10fda78e4
MD5 8996bc3053d2462ca4c516571dbb7551
BLAKE2b-256 15a9c13fbbfd7a30837aafdf938b7e19d899b6ecb98cd13e71b14f353a08332b

See more details on using hashes here.

Provenance

Supported by

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