Skip to content

Commit

Permalink
fix: add suffix to fluentbit configurator (#2567)
Browse files Browse the repository at this point in the history
## Description

We run Kurtosis in our CI pipeline. Multiple processes create Kurtosis
enclaves concurrenctly. When the timing is just right, it can lead to a
race condition where the fluentbit configurator container sticks around
and no further enclaves can be created until we manually delete the
fluentbit container.

This PR adds a suffix to the configurator container so that it is
isolated from other concurrent runs.

## Is this change user facing?

No

Co-authored-by: Tedi Mitiku <[email protected]>
  • Loading branch information
mslipper and tedim52 authored Dec 4, 2024
1 parent 66987d9 commit f797516
Showing 1 changed file with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@ import (
"bytes"
"context"
"fmt"
"text/template"
"time"

"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_impls/docker/docker_manager"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/uuid_generator"
"github.com/kurtosis-tech/stacktrace"
"github.com/sirupsen/logrus"
"text/template"
"time"
)

const (
// We use this image and version because we already are using this in other projects so there is a high probability
// that the image is in the local machine's cache
configuratorContainerImage = "alpine:3.17"
configuratorContainerName = "kurtosis-fluentbit-configurator"
configuratorContainerImage = "alpine:3.17"
configuratorContainerNamePrefix = "kurtosis-fluentbit-configurator"

shBinaryFilepath = "/bin/sh"
shCmdFlag = "-c"
Expand Down Expand Up @@ -54,9 +56,16 @@ func (fluent *fluentbitConfigurationCreator) CreateConfiguration(
volumeName: configDirpathInContainer,
}

uuid, err := uuid_generator.GenerateUUIDString()
if err != nil {
return stacktrace.Propagate(err, "An error occurred generating a UUID for the configurator container name")
}

containerName := fmt.Sprintf("%s-%s", configuratorContainerNamePrefix, uuid)

createAndStartArgs := docker_manager.NewCreateAndStartContainerArgsBuilder(
configuratorContainerImage,
configuratorContainerName,
containerName,
targetNetworkId,
).WithEntrypointArgs(
entrypointArgs,
Expand Down

0 comments on commit f797516

Please sign in to comment.