Versioned kyverno models for cloudcoil
Project description
cloudcoil-models-kyverno
Versioned kyverno models for cloudcoil.
[!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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cloudcoil_models_kyverno-1.13.4.0.tar.gz.
File metadata
- Download URL: cloudcoil_models_kyverno-1.13.4.0.tar.gz
- Upload date:
- Size: 308.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4e0d7a500cd4db46978ef24674c1bf4a82787a2f8e9b0cf498d8e46647a8926
|
|
| MD5 |
f501ce7c3b666e58a545c07b667d6850
|
|
| BLAKE2b-256 |
9caaee61d8df5f483fd518f05e57cf5f9b5a171d0679cd38137579ed40dd86bb
|
Provenance
The following attestation bundles were made for cloudcoil_models_kyverno-1.13.4.0.tar.gz:
Publisher:
pypi_publish.yml on cloudcoil/models-kyverno
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cloudcoil_models_kyverno-1.13.4.0.tar.gz -
Subject digest:
b4e0d7a500cd4db46978ef24674c1bf4a82787a2f8e9b0cf498d8e46647a8926 - Sigstore transparency entry: 174472010
- Sigstore integration time:
-
Permalink:
cloudcoil/models-kyverno@4c5191c0483c9ac1ab3f2c929e42bab306a9e58f -
Branch / Tag:
refs/tags/1.13.4.0 - Owner: https://github.com/cloudcoil
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi_publish.yml@4c5191c0483c9ac1ab3f2c929e42bab306a9e58f -
Trigger Event:
release
-
Statement type:
File details
Details for the file cloudcoil_models_kyverno-1.13.4.0-py3-none-any.whl.
File metadata
- Download URL: cloudcoil_models_kyverno-1.13.4.0-py3-none-any.whl
- Upload date:
- Size: 259.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
35f2f7c714e5e15f0add9a71ff83a69e14a673de42d3ff57a6d1ac7a3975fb5b
|
|
| MD5 |
935412c4c946792c9c8b8e42d4c14077
|
|
| BLAKE2b-256 |
8b706fa6759e1a8bacbb965b9ee69380fd044db4c5e172e3305fc229bebd1485
|
Provenance
The following attestation bundles were made for cloudcoil_models_kyverno-1.13.4.0-py3-none-any.whl:
Publisher:
pypi_publish.yml on cloudcoil/models-kyverno
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cloudcoil_models_kyverno-1.13.4.0-py3-none-any.whl -
Subject digest:
35f2f7c714e5e15f0add9a71ff83a69e14a673de42d3ff57a6d1ac7a3975fb5b - Sigstore transparency entry: 174472017
- Sigstore integration time:
-
Permalink:
cloudcoil/models-kyverno@4c5191c0483c9ac1ab3f2c929e42bab306a9e58f -
Branch / Tag:
refs/tags/1.13.4.0 - Owner: https://github.com/cloudcoil
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi_publish.yml@4c5191c0483c9ac1ab3f2c929e42bab306a9e58f -
Trigger Event:
release
-
Statement type: