Versioned knative-serving models for cloudcoil
Project description
cloudcoil-models-knative-serving
Versioned knative-serving 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 Knative Serving support
uv add cloudcoil.models.knative-serving
Using pip:
pip install cloudcoil.models.knative-serving
💡 Examples
Using Knative Serving Models
from cloudcoil import apimachinery
import cloudcoil.models.knative_serving.serving.v1 as serving
# Create a Service
service = serving.Service(
metadata=apimachinery.ObjectMeta(name="hello"),
spec=serving.ServiceSpec(
template=serving.Template(
spec=serving.Spec(
containers=[
serving.Container(
image="gcr.io/knative-samples/helloworld-go",
ports=[serving.Port(container_port=8080)],
env=[
serving.Env(name="TARGET", value="World")
]
)
]
)
)
)
).create()
# List Services
for svc in serving.Service.list():
print(f"Found Service: {svc.metadata.name}")
Using the Fluent Builder API
Cloudcoil provides a powerful fluent builder API for Knative Serving resources:
from cloudcoil.models.knative_serving.serving.v1 import Service
# Create a Service using the fluent builder
service = (
Service.builder()
# Metadata configuration
.metadata(lambda metadata: metadata
.name("hello")
.namespace("default")
.labels({"app": "hello"})
)
# Complex nested structures with proper collection handling
.spec(lambda spec: spec
.template(lambda template: template
.metadata(lambda t_metadata: t_metadata
.labels({"app": "hello"})
)
.spec(lambda revision_spec: revision_spec
# Container list with nested collection handling
.containers(lambda containers: containers.add(
lambda container: container
.name("hello")
.image("gcr.io/knative-samples/helloworld-go")
# Collections use add() helper for better type support
.ports(lambda ports: ports
.add(lambda p: p.container_port(8080))
)
.env(lambda env: env
.add(lambda e: e.name("TARGET").value("World"))
.add(lambda e: e.name("PORT").value("8080"))
)
# Resource requirements can be chained
.resources(lambda r: r
.requests({"cpu": "100m", "memory": "128Mi"})
.limits({"cpu": "200m", "memory": "256Mi"})
)
))
)
)
)
.build()
)
Using the Context Manager Builder API
For complex serving configurations, you can use the context manager-based builder:
from cloudcoil.models.knative_serving.serving.v1 import Service
# Create a Service using context managers
with Service.new() as service:
with service.metadata() as metadata:
metadata.name("hello")
metadata.namespace("default")
with service.spec() as spec:
with spec.template() as template:
with template.spec() as revision_spec:
with revision_spec.containers() as container_list:
with container_list.add() as container:
container.name("hello")
container.image("gcr.io/knative-samples/helloworld-go")
with container.ports() as port_list:
with port_list.add() as port:
port.container_port(8080)
with container.env() as env_list:
with env_list.add() as env:
env.name("TARGET")
env.value("World")
final_service = service.build()
Mixing Builder Styles
You can mix different builder styles based on your needs:
from cloudcoil.models.knative_serving.serving.v1 import Service
from cloudcoil import apimachinery
# Create a Service using mixed styles
with Service.new() as service:
# Direct object initialization
service.metadata(apimachinery.ObjectMeta(
name="hello"
))
# Fluent style for spec
service.spec(lambda s: s
.template(lambda t: t
.spec(lambda rs: rs
.containers(lambda containers: containers.add(
lambda container: container
.name("hello")
.image("gcr.io/knative-samples/helloworld-go")
# Collections use add() helper for better type support
.ports(lambda ports: ports
.add(lambda p: p.container_port(8080))
)
))
)
)
)
final_service = service.build()
📚 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_knative_serving-1.17.0.0.tar.gz.
File metadata
- Download URL: cloudcoil_models_knative_serving-1.17.0.0.tar.gz
- Upload date:
- Size: 118.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29d639fe76e2019960c64f5b3a6a384278e12ac37bbecb3187a512a0e087d795
|
|
| MD5 |
472de6466a9b369f56dc5a01652e40dd
|
|
| BLAKE2b-256 |
d0bb4195caa371da4e5ad4258b2afa952141fca9bd96c1cdc00ad462ac33896e
|
Provenance
The following attestation bundles were made for cloudcoil_models_knative_serving-1.17.0.0.tar.gz:
Publisher:
pypi_publish.yml on cloudcoil/models-knative-serving
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cloudcoil_models_knative_serving-1.17.0.0.tar.gz -
Subject digest:
29d639fe76e2019960c64f5b3a6a384278e12ac37bbecb3187a512a0e087d795 - Sigstore transparency entry: 166831515
- Sigstore integration time:
-
Permalink:
cloudcoil/models-knative-serving@9c34c93025cc7c87b9e1ac4946e88ad828d2e1d8 -
Branch / Tag:
refs/tags/1.17.0.0 - Owner: https://github.com/cloudcoil
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi_publish.yml@9c34c93025cc7c87b9e1ac4946e88ad828d2e1d8 -
Trigger Event:
release
-
Statement type:
File details
Details for the file cloudcoil_models_knative_serving-1.17.0.0-py3-none-any.whl.
File metadata
- Download URL: cloudcoil_models_knative_serving-1.17.0.0-py3-none-any.whl
- Upload date:
- Size: 63.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af48ebcac209969e3ba38a8e91e20546629b912df8aeb54b44c903b79b6da8e7
|
|
| MD5 |
d33a298aac73875548b0922946031aa2
|
|
| BLAKE2b-256 |
0e2b8443bce2b198732216df1306e2a9979e9c941f89cfe269aba1b46ab1141e
|
Provenance
The following attestation bundles were made for cloudcoil_models_knative_serving-1.17.0.0-py3-none-any.whl:
Publisher:
pypi_publish.yml on cloudcoil/models-knative-serving
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cloudcoil_models_knative_serving-1.17.0.0-py3-none-any.whl -
Subject digest:
af48ebcac209969e3ba38a8e91e20546629b912df8aeb54b44c903b79b6da8e7 - Sigstore transparency entry: 166831517
- Sigstore integration time:
-
Permalink:
cloudcoil/models-knative-serving@9c34c93025cc7c87b9e1ac4946e88ad828d2e1d8 -
Branch / Tag:
refs/tags/1.17.0.0 - Owner: https://github.com/cloudcoil
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi_publish.yml@9c34c93025cc7c87b9e1ac4946e88ad828d2e1d8 -
Trigger Event:
release
-
Statement type: