Skip to main content

cloudcoil-models-kyverno

Versioned kyverno models for cloudcoil.

PyPI Downloads License: Apache-2.0 CI

[!WARNING]
This repository is auto-generated from the cloudcoil repository. Please do not submit pull requests here. Instead, submit them to the main repository at https://github.com/cloudcoil/cloudcoil.

🔧 Installation

[!NOTE] For versioning information and compatibility, see the Versioning Guide.

Using uv (recommended):

# Install with Kyverno support
uv add cloudcoil.models.kyverno

Using pip:

pip install cloudcoil.models.kyverno

💡 Examples

Using Kyverno Models

from cloudcoil import apimachinery
import cloudcoil.models.kyverno.v1 as kyverno

# Create a ClusterPolicy
policy = kyverno.ClusterPolicy(
    metadata=apimachinery.ObjectMeta(name="require-labels"),
    spec=kyverno.ClusterPolicySpec(
        rules=[
            kyverno.Rule(
                name="require-team-label",
                match=kyverno.Match(
                    resources=kyverno.Resources(
                        kinds=["Deployment", "StatefulSet"]
                    )
                ),
                validate=kyverno.Validate(
                    message="The label 'team' is required",
                    pattern={
                        "metadata": {
                            "labels": {
                                "team": "*"
                            }
                        }
                    }
                )
            )
        ]
    )
).create()

# List Policies
for pol in kyverno.ClusterPolicy.list():
    print(f"Found policy: {pol.metadata.name}")

# Update a Policy
policy.spec.rules[0].validate.message = "The 'team' label is mandatory"
policy.save()

# Delete a Policy
kyverno.ClusterPolicy.delete("require-labels")

Using the Fluent Builder API

Cloudcoil provides a powerful fluent builder API for Kyverno resources with full IDE support and rich autocomplete capabilities:

from cloudcoil.models.kyverno.v1 import ClusterPolicy

# Create a ClusterPolicy using the builder
policy = (
    ClusterPolicy.builder()
    .metadata(lambda m: m
        .name("require-labels")
    )
    .spec(lambda s: s
        .rules([
            lambda r: r
            .name("require-team-label")
            .match(lambda m: m
                .resources(lambda res: res
                    .kinds(["Deployment", "StatefulSet"])
                )
            )
            .validate(lambda v: v
                .message("The label 'team' is required")
                .pattern({
                    "metadata": {
                        "labels": {
                            "team": "*"
                        }
                    }
                })
            )
        ])
    )
    .build()
)

The fluent builder 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

Using the Context Manager Builder API

For complex nested resources, Cloudcoil also provides a context manager-based builder pattern that can make the structure more clear:

from cloudcoil.models.kyverno.v1 import ClusterPolicy

# Create a policy using context managers
with ClusterPolicy.new() as policy:
    with policy.metadata() as metadata:
        metadata.name("require-labels")
        metadata.labels({"app": "kyverno"})
    
    with policy.spec() as spec:
        with spec.rules() as rules:
            with rules.add() as rule:
                rule.name("require-team-label")
                
                with rule.match() as match:
                    with match.resources() as resources:
                        resources.kinds(["Deployment", "StatefulSet"])
                
                with rule.validate() as validate:
                    validate.message("The label 'team' is required")
                    validate.pattern({
                        "metadata": {
                            "labels": {
                                "team": "*"
                            }
                        }
                    })

final_policy = policy.build()

The context manager builder provides:

  • 🎭 Clear visual nesting of resource structure
  • 🔒 Automatic resource cleanup
  • 🎯 Familiar Python context manager pattern
  • ✨ Same great IDE support as the fluent builder

Mixing Builder Styles

CloudCoil's intelligent builder system automatically detects which style you're using and provides appropriate IDE support:

from cloudcoil.models.kyverno.v1 import ClusterPolicy
from cloudcoil import apimachinery

# Mixing styles lets you choose the best approach for each part
with ClusterPolicy.new() as policy:
    # Direct object initialization with full type checking
    policy.metadata(apimachinery.ObjectMeta(
        name="require-labels",
        labels={"app": "kyverno"}
    ))
    
    with policy.spec() as spec:
        # Fluent style for rules
        spec.rules([
            lambda r: r
            .name("require-team-label")
            .match(lambda m: m
                .resources(lambda res: res
                    .kinds(["Deployment", "StatefulSet"])
                )
            )
            # Context manager style for validate
            .validate(lambda v: v
                .message("The label 'team' is required")
                .pattern({
                    "metadata": {
                        "labels": {
                            "team": "*"
                        }
                    }
                })
            )
        ])

final_policy = policy.build()

This flexibility allows you to:

  • 🔀 Choose the most appropriate style for each part of your configuration
  • 📖 Maximize readability for both simple and complex structures
  • 🎨 Format your code according to your team's preferences
  • 🧠 Get full IDE support with automatic style detection
  • ✨ Enjoy rich autocomplete in all styles
  • ⚡ Benefit from type checking across mixed styles
  • 🎯 Receive immediate feedback on type errors
  • 🔍 See documentation for all fields regardless of style

📚 Documentation

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

📜 License

Apache License, Version 2.0 - see LICENSE

Release files for cloudcoil.models.kyverno 1.19.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.kyverno 1.19.0.1
File Size Uploaded
cloudcoil_models_kyverno-1.19.0.1.tar.gz 1.2 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for cloudcoil.models.kyverno 1.19.0.1
File Interpreter ABI Platform
cloudcoil_models_kyverno-1.19.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 2.3 MB

Release files / cloudcoil_models_kyverno-1.19.0.1.tar.gz

Download URL cloudcoil_models_kyverno-1.19.0.1.tar.gz
Size 1.2 MB
Tags Source
SHA-256 checksum
How to use checksums
f929f1c03ec1d2690d65a22a06fd2dc0a72f5d61ebd15c8f14ea0a17da6476c8
BLAKE2b-256 checksum
How to use checksums
fa3882e4493154bd3ba7f473e98deaff492fa0351d2d6ed331a98106e78a8fca
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_kyverno-1.19.0.1-py3-none-any.whl

Download URL cloudcoil_models_kyverno-1.19.0.1-py3-none-any.whl
Size 1.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
2864bffe10359de734e3200844d7973431d5253706e366f4a142beb09b2261a0
BLAKE2b-256 checksum
How to use checksums
a3205cfb49631e6ec1e9580c8620381b6cb04d3736d57cfa08a002d71659c4fb
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.19.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