Skip to main content

A development tool for creating Kubernetes clusters and syncing code changes to the cluster

Project description

pyk8sdev

A development tool for creating Kubernetes clusters and syncing code changes to the cluster

This tool extends the functionality of pytest-kubernetes by adding support for caching container images, a CLI tool for spinning up a cluster during development, and support for automatically syncing changes to the cluster.

Features

  • Creates Kubernetes clusters with container caching to speed up development cycles
  • Watches for code changes and syncs changes to the cluster
  • talosctl provider for pytest-kubernetes
  • Provides pytest fixtures
  • Standalone CLI tool
  • Optional TUI tool

Only talosctl and kind providers have been tested

Installation

Install pyk8sdev for use as a pytest fixture or with the simple CLI in your project:

uv add pyk8sdev

To install the full TUI tool:

uv tool install "pyk8sdev[tui]"

Usage

Standalone CLI

pyk8sdev

As pytest plugin

from pyk8sdev import CachedK8sCluster


def test_cluster(cached_k8s_cluster: CachedK8sCluster):
    nodes = cached_k8s_cluster.cluster.kubectl(["get", "nodes"])
    assert len(nodes.get("items", [])) > 0

Configuration

Configuration is managed through .pyk8sdev.yaml in your project root:

cluster_name: test
provider: kind
api_version: 1.34.0
provider_config: tests/kind.yaml
containers:
  - name: my-app
    tag: latest
    containerfile: Containerfile
    directory: .
resources:
  - source: |-
      https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.4.1/standard-install.yaml
  - name: cilium
    namespace: kube-system
    version: 1.19.1
    repository_url: oci://quay.io/cilium/charts/cilium
    values_override: |-
      ---
      image:
        pullPolicy: IfNotPresent
      ipam:
        mode: kubernetes
  - source: tests/manifests.yaml
  - name: my-app
    directory: charts/my-app
    values_file: tests/values.yaml
  - command: /usr/local/bin/telepresence helm install

All relative paths are relative to the configuration file's directory. Containers are built before resources are applied. Containers and resources are applied in the order they are listed. A schema can be created to assist in managing the config using:

pyk8sdev --schema

The schema will have the same path and name as the config you provide, but with the .schema.json extension.

License

This project is licensed under the Apache-2.0 License - see the LICENSE file for details.

Contributing

PRs are welcome!

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

pyk8sdev-0.2.0.tar.gz (32.9 kB view details)

Uploaded Source

Built Distribution

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

pyk8sdev-0.2.0-py3-none-any.whl (26.3 kB view details)

Uploaded Python 3

File details

Details for the file pyk8sdev-0.2.0.tar.gz.

File metadata

  • Download URL: pyk8sdev-0.2.0.tar.gz
  • Upload date:
  • Size: 32.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pyk8sdev-0.2.0.tar.gz
Algorithm Hash digest
SHA256 bf526171055dba7a9d399938947eabb1fc4e4a1a548e80f1dc3fac7ae1e6872a
MD5 aa6b7203ebcb1e9f2c37b126a4c1f6b4
BLAKE2b-256 daa3d48574a596842bf3770468425817cfc2926d4f5a5f32890fd508e73f7686

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyk8sdev-0.2.0.tar.gz:

Publisher: publish-to-pypi.yml on WIJIT-tech/pyk8sdev

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

File details

Details for the file pyk8sdev-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pyk8sdev-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 26.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pyk8sdev-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a1e42ac3f7f3fee1a9308ee94a417f0871cb2a5c0cd2684724dc275dd933d570
MD5 b4f3e276460bfa3c1056aef1a77c0afd
BLAKE2b-256 7fb6df58d70cac5a977d5d69840d8e09f9523359ac1bb6b99ae038ea524e801c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyk8sdev-0.2.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on WIJIT-tech/pyk8sdev

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