Skip to content

Commit

Permalink
Fix allow optional resources requests and limits (#570)
Browse files Browse the repository at this point in the history
  • Loading branch information
disrupted committed Dec 17, 2024
1 parent 92c9698 commit 3020168
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 14 deletions.
16 changes: 10 additions & 6 deletions docs/docs/schema/defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -2383,26 +2383,30 @@
"description": "Model representing the resource specifications for a Kubernetes container.",
"properties": {
"limits": {
"allOf": [
"anyOf": [
{
"$ref": "#/$defs/ResourceDefinition"
},
{
"type": "null"
}
],
"default": null,
"description": "The maximum resource limits for the container."
},
"requests": {
"allOf": [
"anyOf": [
{
"$ref": "#/$defs/ResourceDefinition"
},
{
"type": "null"
}
],
"default": null,
"description": "The minimum resource requirements for the container."
}
},
"required": [
"requests",
"limits"
],
"title": "Resources",
"type": "object"
},
Expand Down
16 changes: 10 additions & 6 deletions docs/docs/schema/pipeline.json
Original file line number Diff line number Diff line change
Expand Up @@ -2043,26 +2043,30 @@
"description": "Model representing the resource specifications for a Kubernetes container.",
"properties": {
"limits": {
"allOf": [
"anyOf": [
{
"$ref": "#/$defs/ResourceDefinition"
},
{
"type": "null"
}
],
"default": null,
"description": "The maximum resource limits for the container."
},
"requests": {
"allOf": [
"anyOf": [
{
"$ref": "#/$defs/ResourceDefinition"
},
{
"type": "null"
}
],
"default": null,
"description": "The minimum resource requirements for the container."
}
},
"required": [
"requests",
"limits"
],
"title": "Resources",
"type": "object"
},
Expand Down
10 changes: 8 additions & 2 deletions kpops/components/common/kubernetes_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,5 +389,11 @@ class Resources(DescConfigModel):
:param limits: The maximum resource limits for the container.
"""

requests: ResourceDefinition = Field(description=describe_attr("requests", __doc__))
limits: ResourceDefinition = Field(description=describe_attr("limits", __doc__))
requests: ResourceDefinition | None = Field(
default=None,
description=describe_attr("requests", __doc__),
)
limits: ResourceDefinition | None = Field(
default=None,
description=describe_attr("limits", __doc__),
)

0 comments on commit 3020168

Please sign in to comment.