fix(core): Improve label generation and merging for applications and services

This commit is contained in:
Andras Bacsai
2025-02-28 12:44:20 +01:00
parent fb3f5e0a3e
commit 1c21652d5d
3 changed files with 8 additions and 0 deletions

View File

@@ -604,6 +604,7 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview
is_stripprefix_enabled: $application->isStripprefixEnabled(),
redirect_direction: $application->redirect
);
$labels = $labels->merge(convertToKeyValueCollection($proxyLabels));
$proxyLabels = fqdnLabelsForCaddy(
network: $application->destination->network,
uuid: $appUuid,
@@ -659,6 +660,7 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview
is_gzip_enabled: $application->isGzipEnabled(),
is_stripprefix_enabled: $application->isStripprefixEnabled()
);
$labels = $labels->merge(convertToKeyValueCollection($proxyLabels));
$proxyLabels = fqdnLabelsForCaddy(
network: $application->destination->network,
uuid: $appUuid,
@@ -671,6 +673,9 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview
$labels = $labels->merge(convertToKeyValueCollection($proxyLabels));
}
}
$labels = $labels->map(function ($value, $key) {
return "$key=$value";
})->values();
return $labels->all();
}

View File

@@ -2045,6 +2045,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
service_name: $serviceName,
image: data_get($service, 'image')
);
$serviceLabels = $serviceLabels->merge(convertToKeyValueCollection($proxyLabels));
$proxyLabels = fqdnLabelsForCaddy(
network: $resource->destination->network,
uuid: $resource->uuid,
@@ -2818,6 +2819,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
is_gzip_enabled: $resource->isGzipEnabled(),
is_stripprefix_enabled: $resource->isStripprefixEnabled(),
);
$serviceLabels = $serviceLabels->merge(convertToKeyValueCollection($proxyLabels));
$proxyLabels =
fqdnLabelsForCaddy(
network: $resource->destination->network,