feat: add cameleer.tenant label to deployed app containers
All checks were successful
CI / cleanup-branch (push) Has been skipped
CI / build (push) Successful in 1m48s
CI / docker (push) Successful in 1m32s
CI / deploy-feature (push) Has been skipped
CI / deploy (push) Successful in 43s

Allows the SaaS platform to identify and clean up all containers
belonging to a tenant on delete (cameleer/cameleer-saas#55).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-11 09:10:59 +02:00
parent 1a45235e30
commit cfc42eaf46
2 changed files with 3 additions and 2 deletions

View File

@@ -129,7 +129,7 @@ public class DeploymentExecutor {
updateStage(deployment.id(), DeployStage.START_REPLICAS); updateStage(deployment.id(), DeployStage.START_REPLICAS);
Map<String, String> baseEnvVars = buildEnvVars(app, env, config); Map<String, String> baseEnvVars = buildEnvVars(app, env, config);
Map<String, String> labels = TraefikLabelBuilder.build(app.slug(), env.slug(), config); Map<String, String> labels = TraefikLabelBuilder.build(app.slug(), env.slug(), tenantId, config);
List<Map<String, Object>> replicaStates = new ArrayList<>(); List<Map<String, Object>> replicaStates = new ArrayList<>();
List<String> newContainerIds = new ArrayList<>(); List<String> newContainerIds = new ArrayList<>();

View File

@@ -9,12 +9,13 @@ public final class TraefikLabelBuilder {
private TraefikLabelBuilder() {} private TraefikLabelBuilder() {}
public static Map<String, String> build(String appSlug, String envSlug, ResolvedContainerConfig config) { public static Map<String, String> build(String appSlug, String envSlug, String tenantId, ResolvedContainerConfig config) {
String svc = envSlug + "-" + appSlug; String svc = envSlug + "-" + appSlug;
Map<String, String> labels = new LinkedHashMap<>(); Map<String, String> labels = new LinkedHashMap<>();
labels.put("traefik.enable", "true"); labels.put("traefik.enable", "true");
labels.put("managed-by", "cameleer3-server"); labels.put("managed-by", "cameleer3-server");
labels.put("cameleer.tenant", tenantId);
labels.put("cameleer.app", appSlug); labels.put("cameleer.app", appSlug);
labels.put("cameleer.environment", envSlug); labels.put("cameleer.environment", envSlug);