Skip to content

Commit

Permalink
Add computed field for Helm release name and name override (#490)
Browse files Browse the repository at this point in the history
  • Loading branch information
disrupted authored May 22, 2024
1 parent 8fcf266 commit 6173036
Show file tree
Hide file tree
Showing 19 changed files with 201 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/docs/resources/variables/variable_substitution.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
app_type: "${component.type}"
app_name: "${component.name}"
app_schedule: "${component.app.schedule}"
helm_release_name: ${component.helm_release_name}
helm_name_override: ${component.helm_name_override}
commandLine:
FAKE_ARG: "fake-arg-value"
schedule: "30 3/8 * * *"
Expand Down
4 changes: 3 additions & 1 deletion kpops/components/base_components/helm_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from typing import Annotated, Any

import pydantic
from pydantic import Field, SerializationInfo, model_serializer
from pydantic import Field, SerializationInfo, computed_field, model_serializer
from typing_extensions import override

from kpops.component_handlers.helm_wrapper.dry_run_handler import DryRunHandler
Expand Down Expand Up @@ -103,11 +103,13 @@ def dry_run_handler(self) -> DryRunHandler:
helm_diff = HelmDiff(self.config.helm_diff_config)
return DryRunHandler(self.helm, helm_diff, self.namespace)

@computed_field
@property
def helm_release_name(self) -> str:
"""The name for the Helm release."""
return create_helm_release_name(self.full_name)

@computed_field
@property
def helm_name_override(self) -> str:
"""Helm chart name override."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
app_type: "${component.type}"
app_name: "${component.name}"
app_schedule: "${component.app.schedule}"
helm_release_name: ${component.helm_release_name}
helm_name_override: ${component.helm_name_override}
commandLine:
FAKE_ARG: "fake-arg-value"
schedule: "30 3/8 * * *"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
schemaRegistryUrl: http://k8kafka-cp-schema-registry.kpops.svc.cluster.local:8081/
suspend: true
debug: true
helm_name_override: atm-fraud-account-producer-clean
helm_release_name: atm-fraud-account-producer-clean
name: account-producer
namespace: ${NAMESPACE}
prefix: atm-fraud-
Expand Down Expand Up @@ -44,6 +46,8 @@
schemaRegistryUrl: http://k8kafka-cp-schema-registry.kpops.svc.cluster.local:8081/
suspend: true
debug: true
helm_name_override: atm-fraud-account-producer
helm_release_name: atm-fraud-account-producer
name: account-producer
namespace: ${NAMESPACE}
prefix: atm-fraud-
Expand Down Expand Up @@ -81,6 +85,8 @@
schemaRegistryUrl: http://k8kafka-cp-schema-registry.kpops.svc.cluster.local:8081/
suspend: true
debug: true
helm_name_override: atm-fraud-transaction-avro-producer-clean
helm_release_name: atm-fraud-transaction-avro-producer-clean
name: transaction-avro-producer
namespace: ${NAMESPACE}
prefix: atm-fraud-
Expand Down Expand Up @@ -112,6 +118,8 @@
schemaRegistryUrl: http://k8kafka-cp-schema-registry.kpops.svc.cluster.local:8081/
suspend: true
debug: true
helm_name_override: atm-fraud-transaction-avro-producer
helm_release_name: atm-fraud-transaction-avro-producer
name: transaction-avro-producer
namespace: ${NAMESPACE}
prefix: atm-fraud-
Expand Down Expand Up @@ -154,6 +162,8 @@
outputTopic: atm-fraud-transaction-joiner-topic
schemaRegistryUrl: http://k8kafka-cp-schema-registry.kpops.svc.cluster.local:8081/
debug: true
helm_name_override: atm-fraud-transaction-joiner-clean
helm_release_name: atm-fraud-transaction-joiner-clean
name: transaction-joiner
namespace: ${NAMESPACE}
prefix: atm-fraud-
Expand Down Expand Up @@ -190,6 +200,8 @@
outputTopic: atm-fraud-transaction-joiner-topic
schemaRegistryUrl: http://k8kafka-cp-schema-registry.kpops.svc.cluster.local:8081/
debug: true
helm_name_override: atm-fraud-transaction-joiner
helm_release_name: atm-fraud-transaction-joiner
name: transaction-joiner
namespace: ${NAMESPACE}
prefix: atm-fraud-
Expand Down Expand Up @@ -236,6 +248,8 @@
outputTopic: atm-fraud-fraud-detector-topic
schemaRegistryUrl: http://k8kafka-cp-schema-registry.kpops.svc.cluster.local:8081/
debug: true
helm_name_override: atm-fraud-fraud-detector-clean
helm_release_name: atm-fraud-fraud-detector-clean
name: fraud-detector
namespace: ${NAMESPACE}
prefix: atm-fraud-
Expand Down Expand Up @@ -272,6 +286,8 @@
outputTopic: atm-fraud-fraud-detector-topic
schemaRegistryUrl: http://k8kafka-cp-schema-registry.kpops.svc.cluster.local:8081/
debug: true
helm_name_override: atm-fraud-fraud-detector
helm_release_name: atm-fraud-fraud-detector
name: fraud-detector
namespace: ${NAMESPACE}
prefix: atm-fraud-
Expand Down Expand Up @@ -321,6 +337,8 @@
outputTopic: atm-fraud-account-linker-topic
schemaRegistryUrl: http://k8kafka-cp-schema-registry.kpops.svc.cluster.local:8081/
debug: true
helm_name_override: atm-fraud-account-linker-clean
helm_release_name: atm-fraud-account-linker-clean
name: account-linker
namespace: ${NAMESPACE}
prefix: atm-fraud-
Expand Down Expand Up @@ -367,6 +385,8 @@
fraud-detector:
type: input
topics: {}
helm_name_override: atm-fraud-account-linker
helm_release_name: atm-fraud-account-linker
name: account-linker
namespace: ${NAMESPACE}
prefix: atm-fraud-
Expand All @@ -393,6 +413,8 @@
brokers: http://k8kafka-cp-kafka-headless.kpops.svc.cluster.local:9092
connector: atm-fraud-postgresql-connector
connectorType: sink
helm_name_override: atm-fraud-postgresql-connector-clean
helm_release_name: atm-fraud-postgresql-connector-clean
name: postgresql-connector
namespace: ${NAMESPACE}
prefix: atm-fraud-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
outputTopic: word-count-data-producer-topic
schemaRegistryUrl: http://k8kafka-cp-schema-registry.kpops.svc.cluster.local:8081/
debug: true
helm_name_override: word-count-data-producer-clean
helm_release_name: word-count-data-producer-clean
name: data-producer
namespace: ${NAMESPACE}
prefix: word-count-
Expand All @@ -40,6 +42,8 @@
outputTopic: word-count-data-producer-topic
schemaRegistryUrl: http://k8kafka-cp-schema-registry.kpops.svc.cluster.local:8081/
debug: true
helm_name_override: word-count-data-producer
helm_release_name: word-count-data-producer
name: data-producer
namespace: ${NAMESPACE}
prefix: word-count-
Expand Down Expand Up @@ -80,6 +84,8 @@
outputTopic: word-count-word-counter-topic
schemaRegistryUrl: http://k8kafka-cp-schema-registry.kpops.svc.cluster.local:8081/
debug: true
helm_name_override: word-count-word-counter-clean
helm_release_name: word-count-word-counter-clean
name: word-counter
namespace: ${NAMESPACE}
prefix: word-count-
Expand Down Expand Up @@ -114,6 +120,8 @@
outputTopic: word-count-word-counter-topic
schemaRegistryUrl: http://k8kafka-cp-schema-registry.kpops.svc.cluster.local:8081/
debug: true
helm_name_override: word-count-word-counter
helm_release_name: word-count-word-counter
name: word-counter
namespace: ${NAMESPACE}
prefix: word-count-
Expand Down Expand Up @@ -142,6 +150,8 @@
brokers: http://k8kafka-cp-kafka-headless.kpops.svc.cluster.local:9092
connector: word-count-redis-sink-connector
connectorType: sink
helm_name_override: word-count-redis-sink-connector-clean
helm_release_name: word-count-redis-sink-connector-clean
name: redis-sink-connector
namespace: ${NAMESPACE}
prefix: word-count-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
brokers: http://k8kafka-cp-kafka-headless.kpops.svc.cluster.local:9092
outputTopic: resources-custom-config-app1
schemaRegistryUrl: http://localhost:8081/
helm_name_override: resources-custom-config-app1-clean
helm_release_name: resources-custom-config-app1-clean
name: app1
namespace: development-namespace
prefix: resources-custom-config-
Expand All @@ -30,6 +32,8 @@
brokers: http://k8kafka-cp-kafka-headless.kpops.svc.cluster.local:9092
outputTopic: resources-custom-config-app1
schemaRegistryUrl: http://localhost:8081/
helm_name_override: resources-custom-config-app1
helm_release_name: resources-custom-config-app1
name: app1
namespace: development-namespace
prefix: resources-custom-config-
Expand Down Expand Up @@ -64,6 +68,8 @@
- resources-custom-config-app1
outputTopic: resources-custom-config-app2
schemaRegistryUrl: http://localhost:8081/
helm_name_override: resources-custom-config-app2-clean
helm_release_name: resources-custom-config-app2-clean
name: app2
namespace: development-namespace
prefix: resources-custom-config-
Expand Down Expand Up @@ -91,6 +97,8 @@
- resources-custom-config-app1
outputTopic: resources-custom-config-app2
schemaRegistryUrl: http://localhost:8081/
helm_name_override: resources-custom-config-app2
helm_release_name: resources-custom-config-app2
name: app2
namespace: development-namespace
prefix: resources-custom-config-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
brokers: http://k8kafka-cp-kafka-headless.kpops.svc.cluster.local:9092
outputTopic: resources-pipeline-with-inflate-scheduled-producer
schemaRegistryUrl: http://localhost:8081/
helm_name_override: resources-pipeline-with-inflate-scheduled-producer-clean
helm_release_name: resources-pipeline-with-inflate-scheduled-18411-clean
name: scheduled-producer
namespace: example-namespace
prefix: resources-pipeline-with-inflate-
Expand All @@ -30,6 +32,8 @@
brokers: http://k8kafka-cp-kafka-headless.kpops.svc.cluster.local:9092
outputTopic: resources-pipeline-with-inflate-scheduled-producer
schemaRegistryUrl: http://localhost:8081/
helm_name_override: resources-pipeline-with-inflate-scheduled-producer
helm_release_name: resources-pipeline-with-inflate-scheduled-producer
name: scheduled-producer
namespace: example-namespace
prefix: resources-pipeline-with-inflate-
Expand Down Expand Up @@ -81,6 +85,8 @@
- resources-pipeline-with-inflate-scheduled-producer
outputTopic: resources-pipeline-with-inflate-converter
schemaRegistryUrl: http://localhost:8081/
helm_name_override: resources-pipeline-with-inflate-converter-clean
helm_release_name: resources-pipeline-with-inflate-converter-clean
name: converter
namespace: example-namespace
prefix: resources-pipeline-with-inflate-
Expand Down Expand Up @@ -122,6 +128,8 @@
- resources-pipeline-with-inflate-scheduled-producer
outputTopic: resources-pipeline-with-inflate-converter
schemaRegistryUrl: http://localhost:8081/
helm_name_override: resources-pipeline-with-inflate-converter
helm_release_name: resources-pipeline-with-inflate-converter
name: converter
namespace: example-namespace
prefix: resources-pipeline-with-inflate-
Expand Down Expand Up @@ -180,6 +188,8 @@
- resources-pipeline-with-inflate-converter
outputTopic: resources-pipeline-with-inflate-should-inflate
schemaRegistryUrl: http://localhost:8081/
helm_name_override: resources-pipeline-with-inflate-should-inflate-clean
helm_release_name: resources-pipeline-with-inflate-should-inflate-clean
name: should-inflate
namespace: example-namespace
prefix: resources-pipeline-with-inflate-
Expand Down Expand Up @@ -223,6 +233,8 @@
- resources-pipeline-with-inflate-converter
outputTopic: resources-pipeline-with-inflate-should-inflate
schemaRegistryUrl: http://localhost:8081/
helm_name_override: resources-pipeline-with-inflate-should-inflate
helm_release_name: resources-pipeline-with-inflate-should-inflate
name: should-inflate
namespace: example-namespace
prefix: resources-pipeline-with-inflate-
Expand Down Expand Up @@ -253,6 +265,8 @@
brokers: http://k8kafka-cp-kafka-headless.kpops.svc.cluster.local:9092
connector: resources-pipeline-with-inflate-should-inflate-inflated-sink-connector
connectorType: sink
helm_name_override: resources-pipeline-with-inflate-should-inflate-infl-cfdd0-clean
helm_release_name: resources-pipeline-with-inflate-should-in-cfdd0-clean
name: should-inflate-inflated-sink-connector
namespace: example-namespace
prefix: resources-pipeline-with-inflate-
Expand Down Expand Up @@ -305,6 +319,8 @@
- kafka-sink-connector
outputTopic: resources-pipeline-with-inflate-should-inflate-should-inflate-inflated-streams-app
schemaRegistryUrl: http://localhost:8081/
helm_name_override: resources-pipeline-with-inflate-should-inflate-infl-c7b41-clean
helm_release_name: resources-pipeline-with-inflate-should-in-c7b41-clean
name: should-inflate-inflated-streams-app
namespace: example-namespace
prefix: resources-pipeline-with-inflate-
Expand All @@ -329,6 +345,8 @@
- kafka-sink-connector
outputTopic: resources-pipeline-with-inflate-should-inflate-should-inflate-inflated-streams-app
schemaRegistryUrl: http://localhost:8081/
helm_name_override: resources-pipeline-with-inflate-should-inflate-inflated-s-2ea20
helm_release_name: resources-pipeline-with-inflate-should-inflate--2ea20
name: should-inflate-inflated-streams-app
namespace: example-namespace
prefix: resources-pipeline-with-inflate-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
- example-topic
outputTopic: example-output
schemaRegistryUrl: http://localhost:8081/
helm_name_override: resources-kafka-connect-sink-streams-app-clean
helm_release_name: resources-kafka-connect-sink-streams-app-clean
name: streams-app
namespace: example-namespace
prefix: resources-kafka-connect-sink-
Expand Down Expand Up @@ -43,6 +45,8 @@
topics:
example-topic:
type: input
helm_name_override: resources-kafka-connect-sink-streams-app
helm_release_name: resources-kafka-connect-sink-streams-app
name: streams-app
namespace: example-namespace
prefix: resources-kafka-connect-sink-
Expand Down Expand Up @@ -71,6 +75,8 @@
brokers: http://k8kafka-cp-kafka-headless.kpops.svc.cluster.local:9092
connector: resources-kafka-connect-sink-es-sink-connector
connectorType: sink
helm_name_override: resources-kafka-connect-sink-es-sink-connector-clean
helm_release_name: resources-kafka-connect-sink-es-sink-connector-clean
name: es-sink-connector
namespace: example-namespace
prefix: resources-kafka-connect-sink-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
brokers: http://k8kafka-cp-kafka-headless.kpops.svc.cluster.local:9092
outputTopic: resources-first-pipeline-scheduled-producer
schemaRegistryUrl: http://localhost:8081/
helm_name_override: resources-first-pipeline-scheduled-producer-clean
helm_release_name: resources-first-pipeline-scheduled-producer-clean
name: scheduled-producer
namespace: example-namespace
prefix: resources-first-pipeline-
Expand All @@ -30,6 +32,8 @@
brokers: http://k8kafka-cp-kafka-headless.kpops.svc.cluster.local:9092
outputTopic: resources-first-pipeline-scheduled-producer
schemaRegistryUrl: http://localhost:8081/
helm_name_override: resources-first-pipeline-scheduled-producer
helm_release_name: resources-first-pipeline-scheduled-producer
name: scheduled-producer
namespace: example-namespace
prefix: resources-first-pipeline-
Expand Down Expand Up @@ -81,6 +85,8 @@
- resources-first-pipeline-scheduled-producer
outputTopic: resources-first-pipeline-converter
schemaRegistryUrl: http://localhost:8081/
helm_name_override: resources-first-pipeline-converter-clean
helm_release_name: resources-first-pipeline-converter-clean
name: converter
namespace: example-namespace
prefix: resources-first-pipeline-
Expand Down Expand Up @@ -122,6 +128,8 @@
- resources-first-pipeline-scheduled-producer
outputTopic: resources-first-pipeline-converter
schemaRegistryUrl: http://localhost:8081/
helm_name_override: resources-first-pipeline-converter
helm_release_name: resources-first-pipeline-converter
name: converter
namespace: example-namespace
prefix: resources-first-pipeline-
Expand Down Expand Up @@ -180,6 +188,8 @@
- resources-first-pipeline-converter
outputTopic: resources-first-pipeline-a-long-name-a-long-name-a-long-name-a-long-name-a-long-name-a-long-name-a-long-name-a-long-name-a-long-name-a-long-name-a-long-name-a-long-name
schemaRegistryUrl: http://localhost:8081/
helm_name_override: resources-first-pipeline-a-long-name-a-long-name-a--48eb9-clean
helm_release_name: resources-first-pipeline-a-long-name-a-lo-48eb9-clean
name: a-long-name-a-long-name-a-long-name-a-long-name-a-long-name-a-long-name-a-long-name-a-long-name-a-long-name-a-long-name-a-long-name-a-long-name
namespace: example-namespace
prefix: resources-first-pipeline-
Expand Down Expand Up @@ -223,6 +233,8 @@
- resources-first-pipeline-converter
outputTopic: resources-first-pipeline-a-long-name-a-long-name-a-long-name-a-long-name-a-long-name-a-long-name-a-long-name-a-long-name-a-long-name-a-long-name-a-long-name-a-long-name
schemaRegistryUrl: http://localhost:8081/
helm_name_override: resources-first-pipeline-a-long-name-a-long-name-a-long-n-68327
helm_release_name: resources-first-pipeline-a-long-name-a-long-nam-68327
name: a-long-name-a-long-name-a-long-name-a-long-name-a-long-name-a-long-name-a-long-name-a-long-name-a-long-name-a-long-name-a-long-name-a-long-name
namespace: example-namespace
prefix: resources-first-pipeline-
Expand Down
Loading

0 comments on commit 6173036

Please sign in to comment.