diff --git a/ci/build-slice.py b/ci/build-slice.py index 809a377..67f7812 100644 --- a/ci/build-slice.py +++ b/ci/build-slice.py @@ -40,8 +40,9 @@ def module_versions(platform_dir: Path) -> dict[str, str]: return dict(re.findall(r'^\s*([a-z0-9-]+)\s*=\s*"([^"]+)"', block.group(1), re.M)) -def infrastructure_yaml(contour: str) -> str: - return f"current_environment: {contour}\nenvironments:\n {contour}: {{}}\n" +def infrastructure_yaml(contour: str, env_block: str = "") -> str: + body = "".join(f" {line}\n" if line else "\n" for line in env_block.splitlines()) if env_block.strip() else "" + return f"current_environment: {contour}\nenvironments:\n {contour}:" + ("\n" + body if body else " {}\n") def git_env(token: str | None) -> dict: @@ -72,7 +73,8 @@ def collect(repo: Path, contour: str, source_base: str, token: str | None) -> tu raise SliceError(f"missing {', '.join(missing)}") if not any(p.startswith(f"environments/{contour}/") for p in files): raise SliceError(f"no environments/{contour}") - files["infrastructure.yaml"] = infrastructure_yaml(contour).encode() + env_block = files.pop(f"environments/{contour}/infrastructure.yaml", b"").decode() + files["infrastructure.yaml"] = infrastructure_yaml(contour, env_block).encode() ref = code_ref(repo, contour) pins = {"terraform-platform": ref} with tempfile.TemporaryDirectory() as tmp: diff --git a/environments/stand/environment.yaml b/environments/stand/environment.yaml index c393a20..0dfd314 100644 --- a/environments/stand/environment.yaml +++ b/environments/stand/environment.yaml @@ -15,3 +15,6 @@ backends: kind: incluster rabbitmq: cluster: default + amqp_host: rabbitmq.rabbitmq.svc.cluster.local + amqp_port: 5672 + management_endpoint: http://rabbitmq.rabbitmq.svc.cluster.local:15672 diff --git a/environments/stand/infrastructure.yaml b/environments/stand/infrastructure.yaml new file mode 100644 index 0000000..7e25ccf --- /dev/null +++ b/environments/stand/infrastructure.yaml @@ -0,0 +1,16 @@ +kafka_cluster_refs: + stand: + bootstrap_servers: kafka-kafka-contour.kafka.svc.cluster.local:9092 + host: kafka-kafka-contour.kafka.svc.cluster.local + port: 9092 + sasl_mechanism: SCRAM-SHA-512 + security_protocol: SASL_SSL + tls_enabled: true + default_partitions: 3 + default_replication_factor: 1 + max_replication_factor: 1 +kafka_policy: + allow_create: true + allow_delete: false + allow_partition_increase: true + allow_partition_decrease: false diff --git a/environments/stand/namespaces.yaml b/environments/stand/namespaces.yaml index 73cb31b..4a25f70 100644 --- a/environments/stand/namespaces.yaml +++ b/environments/stand/namespaces.yaml @@ -6,3 +6,8 @@ namespaces: services: - camunda-identity - camunda-keycloak + stand-test: + owner: stand-test + secret_prefix: service + services: + - stand-test diff --git a/environments/stand/services/stand-test.yaml b/environments/stand/services/stand-test.yaml new file mode 100644 index 0000000..5d73e7d --- /dev/null +++ b/environments/stand/services/stand-test.yaml @@ -0,0 +1,27 @@ +service: stand-test +owner: stand-test + +needs: + postgresql: + database: stand_test_db + user: stand_test + s3: + buckets: + - name: stand-test + rabbitmq: + vhosts: + - stand-test + endpoints: + - kind: exchange + name: events + type: topic + - kind: queue + name: events + bindings: + - source: events + destination: events + routing_key: "#" + kafka: + topics: + - name: stand.test.event.v1 + partitions: 3 diff --git a/live-contract/stand/kafka-topics/terragrunt.hcl b/live-contract/stand/kafka-topics/terragrunt.hcl new file mode 100644 index 0000000..023bdda --- /dev/null +++ b/live-contract/stand/kafka-topics/terragrunt.hcl @@ -0,0 +1,7 @@ +include "root" { + path = "${get_env("PLATFORM_CODE_DIR", "")}/terragrunt/root.hcl" +} + +include "unit" { + path = "${get_env("PLATFORM_CODE_DIR", "")}/terragrunt/units/kafka-topics.hcl" +} diff --git a/live-contract/stand/rabbitmq/terragrunt.hcl b/live-contract/stand/rabbitmq/terragrunt.hcl new file mode 100644 index 0000000..38572f5 --- /dev/null +++ b/live-contract/stand/rabbitmq/terragrunt.hcl @@ -0,0 +1,7 @@ +include "root" { + path = "${get_env("PLATFORM_CODE_DIR", "")}/terragrunt/root.hcl" +} + +include "unit" { + path = "${get_env("PLATFORM_CODE_DIR", "")}/terragrunt/units/rabbitmq.hcl" +} diff --git a/live-contract/stand/s3/terragrunt.hcl b/live-contract/stand/s3/terragrunt.hcl new file mode 100644 index 0000000..d39ecb1 --- /dev/null +++ b/live-contract/stand/s3/terragrunt.hcl @@ -0,0 +1,7 @@ +include "root" { + path = "${get_env("PLATFORM_CODE_DIR", "")}/terragrunt/root.hcl" +} + +include "unit" { + path = "${get_env("PLATFORM_CODE_DIR", "")}/terragrunt/units/s3.hcl" +}