Skip to main content

cloudcoil-models-istio

Versioned istio models for cloudcoil.

PyPI Downloads License: Apache-2.0 CI

🔧 Installation

Using uv (recommended):

# Install with Istio support
uv add cloudcoil.models.istio

Using pip:

pip install cloudcoil.models.istio

💡 Examples

Using Istio Models

from cloudcoil import apimachinery
from cloudcoil.models.istio import networking

# Create a Gateway
gateway = networking.v1.Gateway(
    metadata=apimachinery.ObjectMeta(name="main-gateway"),
    spec=networking.v1.GatewaySpec(
        selector={"istio": "ingressgateway"},
        servers=[networking.v1.GatewaySpecServersItem(
            port=networking.v1.GatewaySpecServersItemPort(
                number=80,
                name="http",
                protocol="HTTP"
            ),
            hosts=["*.example.com"]
        )]
    )
).create()

# Create a VirtualService
virtual_service = networking.v1.VirtualService(
    metadata=apimachinery.ObjectMeta(name="website"),
    spec=networking.v1.VirtualServiceSpec(
        hosts=["website.example.com"],
        gateways=["main-gateway"],
        http=[networking.v1.VirtualServiceSpecHttpItem(
            route=[networking.v1.VirtualServiceSpecHttpItemRouteItem(
                destination=networking.v1.VirtualServiceSpecHttpItemRouteItemDestination(
                    host="website-svc",
                    port=networking.v1.VirtualServiceSpecHttpItemRouteItemDestinationPort(number=8080)
                )
            )]
        )]
    )
).create()

# List Virtual Services
for vs in networking.v1.VirtualService.list():
    print(f"Found VirtualService: {vs.metadata.name}")

Using the Fluent Builder API

from cloudcoil.models.istio import networking

# Create a Gateway using the fluent builder
gateway = (
    networking.v1.Gateway.builder()
    .metadata(lambda metadata: metadata
        .name("main-gateway")
        .namespace("default")
    )
    .spec(lambda gateway_spec: gateway_spec
        .selector({"istio": "ingressgateway"})
        .servers(lambda servers: servers.add(
            lambda server: server
            .port(lambda port: port
                .number(80)
                .name("http")
                .protocol("HTTP")
            )
            .hosts(["*.example.com"])
        ))
    )
    .build()
)

Using the Context Manager Builder API

from cloudcoil.models.istio import networking

# Create a Gateway using context managers
with networking.v1.Gateway.new() as gateway:
    with gateway.metadata() as metadata:
        metadata.name("main-gateway")
        metadata.namespace("default")
    
    with gateway.spec() as spec:
        spec.selector({"istio": "ingressgateway"})
        
        with spec.servers() as server_list:
            with server_list.add() as server:
                with server.port() as port:
                    port.number(80)
                    port.name("http")
                    port.protocol("HTTP")
                server.hosts(["*.example.com"])

# Create a VirtualService using context managers
with networking.v1.VirtualService.new() as vs:
    with vs.metadata() as metadata:
        metadata.name("website")
        metadata.namespace("default")
    
    with vs.spec() as vs_spec:
        vs_spec.hosts(["website.example.com"])
        vs_spec.gateways(["main-gateway"])
        
        with vs_spec.http() as http_list:
            with http_list.add() as route:
                with route.route() as route_list:
                    with route_list.add() as weight:
                        with weight.destination() as dest:
                            dest.host("website-svc")
                            with dest.port() as dest_port:
                                dest_port.number(8080)

final_vs = vs.build()

Mixing Builder Styles

from cloudcoil.models.istio import networking
from cloudcoil import apimachinery

# Create a Gateway mixing different builder styles
with networking.v1.Gateway.new() as gateway:
    # Direct object initialization
    gateway.metadata(apimachinery.ObjectMeta(
        name="main-gateway",
        namespace="default"
    ))
    
    with gateway.spec() as spec:
        # Simple field assignment
        spec.selector({"istio": "ingressgateway"})
        
        # Fluent style for complex structures
        spec.servers([
            networking.v1.GatewaySpecServersItem(
                port=networking.v1.GatewaySpecServersItemPort(
                    number=80,
                    name="http",
                    protocol="HTTP"
                ),
                hosts=["*.example.com"]
            )
        ])

final_gateway = gateway.build()

# Create a VirtualService mixing styles
with networking.v1.VirtualService.new() as vs:
    vs.metadata(lambda m: m
        .name("website")
        .namespace("default")
    )
    
    with vs.spec() as spec:
        # Simple assignments
        spec.hosts(["website.example.com"])
        spec.gateways(["main-gateway"])
        
        # Context managers for deep nesting
        with spec.http() as http_list:
            with http_list.add() as route:
                # Fluent style for route configuration
                route.route(lambda routes: routes
                    .add(lambda w: w
                        .destination(lambda d: d
                            .host("website-svc")
                            .port(lambda p: p.number(8080))
                        )
                    )
                )

final_vs = vs.build()

The builder system provides:

  • ✨ Full IDE support with detailed type information
  • 🔍 Rich autocomplete for all fields and nested objects
  • ⚡ Compile-time validation of your configuration
  • 🎯 Clear and chainable API that guides you through resource creation
  • 🔀 Flexibility to mix different builder styles

📚 Documentation

For complete documentation, visit cloudcoil.github.io/cloudcoil

📜 License

Apache License, Version 2.0 - see LICENSE

Metadata

Release files for cloudcoil.models.istio 1.31.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cloudcoil.models.istio 1.31.0.1
File Size Uploaded
cloudcoil_models_istio-1.31.0.1.tar.gz 330.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cloudcoil.models.istio 1.31.0.1
File Interpreter ABI Platform
cloudcoil_models_istio-1.31.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 604.6 kB

Release files / cloudcoil_models_istio-1.31.0.1.tar.gz

Download URL cloudcoil_models_istio-1.31.0.1.tar.gz
Size 330.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a41a03a4926604ef8b652d32c1859f7366ec01ed735c02af09a0697c6ff4659b
BLAKE2b-256 checksum
How to use checksums
0b2a3680753ba4a01a7996f754321a664779ed09fbe003af4a92a070291b48e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.

Transparency log

Release files / cloudcoil_models_istio-1.31.0.1-py3-none-any.whl

Download URL cloudcoil_models_istio-1.31.0.1-py3-none-any.whl
Size 274.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c5b6c11a25d8848ad5bbb18a010b45a7569d3cde8b047074ad4d4b87a5d5645a
BLAKE2b-256 checksum
How to use checksums
27f104c55a7fcdbd426d36c1f9446cd98695b33386dae46bd45af407f498d557
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.31.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page