Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: configured CORS logs in the enclave manager server inside the Kurtosis engine #1797

Merged
merged 2 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ func (backend *DockerKurtosisBackend) CreateAPIContainer(
ownIpAddressEnvVar string,
customEnvVars map[string]string,
) (*api_container.APIContainer, error) {
logrus.Debugf("Creating the APIC for enclave '%v'", enclaveUuid)

// Verify no API container already exists in the enclave
apiContainersInEnclaveFilters := &api_container.APIContainerFilters{
EnclaveIDs: map[enclave.EnclaveUUID]bool{
Expand Down Expand Up @@ -203,6 +205,7 @@ func (backend *DockerKurtosisBackend) CreateAPIContainer(
return nil, stacktrace.Propagate(err, "An error occurred waiting for the API container's grpc port to become available")
}

logrus.Debugf("Checking for the APIC availability in enclave '%v'...", enclaveUuid)
if err := shared_helpers.WaitForPortAvailabilityUsingNetstat(
ctx,
backend.dockerManager,
Expand All @@ -213,6 +216,7 @@ func (backend *DockerKurtosisBackend) CreateAPIContainer(
); err != nil {
return nil, stacktrace.Propagate(err, "An error occurred waiting for the API container's grpc port to become available")
}
logrus.Debugf("...APIC is available in enclave '%v'", enclaveUuid)

bridgeNetworkIpAddress, err := backend.dockerManager.GetContainerIP(ctx, consts.NameOfNetworkToStartEngineAndLogServiceContainersIn, containerId)
if err != nil {
Expand All @@ -224,6 +228,8 @@ func (backend *DockerKurtosisBackend) CreateAPIContainer(
return nil, stacktrace.Propagate(err, "An error occurred creating an API container object from container with ID '%v'", containerId)
}

logrus.Debugf("APIC for enclave '%v' successfully created", enclaveUuid)

shouldKillContainer = false
return result, nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func CreateLogsCollectorForEnclave(
*logs_collector.LogsCollector,
error,
) {

logrus.Debugf("Creating logs collector for enclave '%v'", enclaveUuid)
preExistingLogsCollectorContainers, err := getLogsCollectorForTheGivenEnclave(ctx, enclaveUuid, dockerManager)
if err != nil {
return nil, stacktrace.Propagate(err, "An error occurred getting logs collector containers for given enclave '%v'", enclaveUuid)
Expand Down Expand Up @@ -118,9 +118,12 @@ func CreateLogsCollectorForEnclave(

logsCollectorAvailabilityChecker := fluentbit.NewFluentbitAvailabilityChecker(logsCollectorObj.GetBridgeNetworkIpAddress(), logsCollectorObj.GetPrivateHttpPort().GetNumber())

logrus.Debugf("Checking for logs collector availability in enclave '%v'...", enclaveUuid)
if err = logsCollectorAvailabilityChecker.WaitForAvailability(); err != nil {
return nil, stacktrace.Propagate(err, "An error occurred while waiting for the log container to become available")
}
logrus.Debugf("...logs collector is available in enclave '%v'", enclaveUuid)
logrus.Debugf("Logs collector successfully created with container ID '%v' for enclave '%v'", containerId, enclaveUuid)

shouldDisconnectLogsCollectorFromEnclaveNetwork = false
shouldRemoveLogsCollectorContainerFunc = false
Expand Down
6 changes: 5 additions & 1 deletion enclave-manager/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,11 @@ func RunEnclaveManagerApiServer(enforceAuth bool) error {
handler,
apiPath,
)
if err := apiServer.RunServerUntilInterruptedWithCors(cors.AllowAll()); err != nil {

emCors := cors.AllowAll()
emCors.Log = logrus.StandardLogger()

if err := apiServer.RunServerUntilInterruptedWithCors(emCors); err != nil {
logrus.Error("An error occurred running the server", err)
}
return nil
Expand Down