fix: log drain only for Applications

This commit is contained in:
Andras Bacsai
2024-09-02 10:57:03 +02:00
parent a2ab23529f
commit dfd5cc9cef

View File

@@ -2819,9 +2819,11 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
$defaultLabels = defaultLabels($resource->id, $containerName, $pull_request_id, type: 'application'); $defaultLabels = defaultLabels($resource->id, $containerName, $pull_request_id, type: 'application');
$serviceLabels = $serviceLabels->merge($defaultLabels); $serviceLabels = $serviceLabels->merge($defaultLabels);
if ($server->isLogDrainEnabled() && $resource->isLogDrainEnabled()) { if ($server->isLogDrainEnabled()) {
if ($resource instanceof Application && $resource->isLogDrainEnabled()) {
data_set($service, 'logging', generate_fluentd_configuration()); data_set($service, 'logging', generate_fluentd_configuration());
} }
}
if ($serviceLabels->count() > 0) { if ($serviceLabels->count() > 0) {
if ($resource->settings->is_container_label_escape_enabled) { if ($resource->settings->is_container_label_escape_enabled) {
$serviceLabels = $serviceLabels->map(function ($value, $key) { $serviceLabels = $serviceLabels->map(function ($value, $key) {
@@ -2923,9 +2925,11 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
$restart = data_get_str($service, 'restart', RESTART_MODE); $restart = data_get_str($service, 'restart', RESTART_MODE);
$logging = data_get($service, 'logging'); $logging = data_get($service, 'logging');
if ($server->isLogDrainEnabled() && $resource->isLogDrainEnabled()) { if ($server->isLogDrainEnabled()) {
if ($resource instanceof Application && $resource->isLogDrainEnabled()) {
$logging = generate_fluentd_configuration(); $logging = generate_fluentd_configuration();
} }
}
$volumes = collect(data_get($service, 'volumes', [])); $volumes = collect(data_get($service, 'volumes', []));
$networks = collect(data_get($service, 'networks', [])); $networks = collect(data_get($service, 'networks', []));
$depends_on = collect(data_get($service, 'depends_on', [])); $depends_on = collect(data_get($service, 'depends_on', []));