Skip to content

Commit

Permalink
Add Kubernetes affinity and tolerations to streams-bootstrap v2 values (
Browse files Browse the repository at this point in the history
  • Loading branch information
disrupted authored Dec 17, 2024
1 parent bf29c88 commit db221de
Show file tree
Hide file tree
Showing 3 changed files with 153 additions and 0 deletions.
84 changes: 84 additions & 0 deletions docs/docs/schema/defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -1537,6 +1537,18 @@
"additionalProperties": true,
"description": "Settings specific to producers.",
"properties": {
"affinity": {
"anyOf": [
{
"$ref": "#/$defs/Affinity"
},
{
"type": "null"
}
],
"default": null,
"description": "Map to configure pod affinities https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity."
},
"imageTag": {
"default": "latest",
"description": "Docker image tag of the streams-bootstrap-v2 app.",
Expand Down Expand Up @@ -1565,6 +1577,22 @@
}
],
"description": "Kafka Streams settings"
},
"tolerations": {
"anyOf": [
{
"items": {
"$ref": "#/$defs/Toleration"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Array containing taint references. When defined, pods can run on nodes, which would otherwise deny scheduling.",
"title": "Tolerations"
}
},
"required": [
Expand Down Expand Up @@ -2609,6 +2637,18 @@
"additionalProperties": true,
"description": "streams-bootstrap-v2 app configurations.\nThe attributes correspond to keys and values that are used as values for the streams bootstrap helm chart.",
"properties": {
"affinity": {
"anyOf": [
{
"$ref": "#/$defs/Affinity"
},
{
"type": "null"
}
],
"default": null,
"description": "Map to configure pod affinities https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity."
},
"autoscaling": {
"anyOf": [
{
Expand Down Expand Up @@ -2668,6 +2708,22 @@
}
],
"description": "streams-bootstrap-v2 streams section"
},
"tolerations": {
"anyOf": [
{
"items": {
"$ref": "#/$defs/Toleration"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Array containing taint references. When defined, pods can run on nodes, which would otherwise deny scheduling.",
"title": "Tolerations"
}
},
"required": [
Expand Down Expand Up @@ -3264,6 +3320,18 @@
"additionalProperties": true,
"description": "Base value class for all streams bootstrap v2 related components.",
"properties": {
"affinity": {
"anyOf": [
{
"$ref": "#/$defs/Affinity"
},
{
"type": "null"
}
],
"default": null,
"description": "Map to configure pod affinities https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity."
},
"imageTag": {
"default": "latest",
"description": "Docker image tag of the streams-bootstrap-v2 app.",
Expand Down Expand Up @@ -3292,6 +3360,22 @@
}
],
"description": ""
},
"tolerations": {
"anyOf": [
{
"items": {
"$ref": "#/$defs/Toleration"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Array containing taint references. When defined, pods can run on nodes, which would otherwise deny scheduling.",
"title": "Tolerations"
}
},
"required": [
Expand Down
56 changes: 56 additions & 0 deletions docs/docs/schema/pipeline.json
Original file line number Diff line number Diff line change
Expand Up @@ -1197,6 +1197,18 @@
"additionalProperties": true,
"description": "Settings specific to producers.",
"properties": {
"affinity": {
"anyOf": [
{
"$ref": "#/$defs/Affinity"
},
{
"type": "null"
}
],
"default": null,
"description": "Map to configure pod affinities https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity."
},
"imageTag": {
"default": "latest",
"description": "Docker image tag of the streams-bootstrap-v2 app.",
Expand Down Expand Up @@ -1225,6 +1237,22 @@
}
],
"description": "Kafka Streams settings"
},
"tolerations": {
"anyOf": [
{
"items": {
"$ref": "#/$defs/Toleration"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Array containing taint references. When defined, pods can run on nodes, which would otherwise deny scheduling.",
"title": "Tolerations"
}
},
"required": [
Expand Down Expand Up @@ -2269,6 +2297,18 @@
"additionalProperties": true,
"description": "streams-bootstrap-v2 app configurations.\nThe attributes correspond to keys and values that are used as values for the streams bootstrap helm chart.",
"properties": {
"affinity": {
"anyOf": [
{
"$ref": "#/$defs/Affinity"
},
{
"type": "null"
}
],
"default": null,
"description": "Map to configure pod affinities https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity."
},
"autoscaling": {
"anyOf": [
{
Expand Down Expand Up @@ -2328,6 +2368,22 @@
}
],
"description": "streams-bootstrap-v2 streams section"
},
"tolerations": {
"anyOf": [
{
"items": {
"$ref": "#/$defs/Toleration"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Array containing taint references. When defined, pods can run on nodes, which would otherwise deny scheduling.",
"title": "Tolerations"
}
},
"required": [
Expand Down
13 changes: 13 additions & 0 deletions kpops/components/streams_bootstrap_v2/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from kpops.component_handlers.helm_wrapper.model import HelmRepoConfig
from kpops.components.base_components import KafkaApp
from kpops.components.base_components.helm_app import HelmApp, HelmAppValues
from kpops.components.common.kubernetes_model import Affinity, Toleration
from kpops.components.common.topic import KafkaTopic, KafkaTopicStr
from kpops.utils.docstring import describe_attr
from kpops.utils.pydantic import (
Expand Down Expand Up @@ -100,6 +101,8 @@ class StreamsBootstrapV2Values(HelmAppValues):
"""Base value class for all streams bootstrap v2 related components.
:param image_tag: Docker image tag of the streams-bootstrap-v2 app.
:param affinity: Map to configure pod affinities https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity.
:param tolerations: Array containing taint references. When defined, pods can run on nodes, which would otherwise deny scheduling.
"""

image_tag: str = Field(
Expand All @@ -112,6 +115,16 @@ class StreamsBootstrapV2Values(HelmAppValues):
description=describe_attr("streams", __doc__),
)

affinity: Affinity | None = Field(
default=None,
description=describe_attr("affinity", __doc__),
)

tolerations: list[Toleration] | None = Field(
default=None,
description=describe_attr("tolerations", __doc__),
)


@deprecated("StreamsBootstrapV2 component is deprecated, use StreamsBootstrap instead.")
class StreamsBootstrapV2(KafkaApp, HelmApp, ABC):
Expand Down

0 comments on commit db221de

Please sign in to comment.