From 52fed7105e42e1d6ae8f15b51210beaef574b668 Mon Sep 17 00:00:00 2001 From: Aditya <60684641+0x0elliot@users.noreply.github.com> Date: Tue, 11 Nov 2025 22:43:57 +0530 Subject: [PATCH] fix: tenzir disable + networkID focused --- functions/onprem/orborus/orborus.go | 57 +++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 16 deletions(-) diff --git a/functions/onprem/orborus/orborus.go b/functions/onprem/orborus/orborus.go index 1d9d8fed..a0f78845 100755 --- a/functions/onprem/orborus/orborus.go +++ b/functions/onprem/orborus/orborus.go @@ -441,12 +441,32 @@ func deployServiceWorkers(image string) { if err != nil { if strings.Contains(fmt.Sprintf("%s", err), "already exists") { // Try patching for attachable - + if debug { + log.Printf("[DEBUG] Network %s already exists", networkName) + } } else { log.Printf("[DEBUG] Failed to create network %s for workers: %s. This is not critical, and containers will still be added", networkName, err) } } + networkID := "" + + // find network ID + networks, err := dockercli.NetworkList(ctx, network.ListOptions{}) + if err == nil { + for _, net := range networks { + if net.Name == networkName { + if net.Scope == "swarm" { + log.Printf("[DEBUG] Found swarm-scoped network: %s (%s)", networkName, net.ID) + networkID = net.ID + } else { + log.Printf("[WARNING] Network %s exists but is not swarm scoped (scope=%s)", networkName, net.Scope) + } + break + } + } + } + /* isMemcachedRunning, err := checkMemcached(ctx, dockercli) if err != nil { @@ -463,12 +483,17 @@ func deployServiceWorkers(image string) { } */ + if networkID == "" { + log.Printf("[ERROR] Network %s does not exist", networkName) + networkID = networkName + } + defaultNetworkAttach := false if containerId != "" { log.Printf("[DEBUG] Should connect orborus container to worker network as it's running in Docker with name %#v!", containerId) // https://pkg.go.dev/github.com/docker/docker@v20.10.12+incompatible/api/types/network#EndpointSettings networkConfig := &network.EndpointSettings{} - err := dockercli.NetworkConnect(ctx, networkName, containerId, networkConfig) + err := dockercli.NetworkConnect(ctx, networkID, containerId, networkConfig) if err != nil { log.Printf("[ERROR] Failed connecting Orborus to docker network %s: %s", networkName, err) } @@ -491,7 +516,7 @@ func deployServiceWorkers(image string) { for _, container := range containers { if strings.Contains(strings.ToLower(container.Image), "docker-socket-proxy") { networkConfig := &network.EndpointSettings{} - err := dockercli.NetworkConnect(ctx, networkName, container.ID, networkConfig) + err := dockercli.NetworkConnect(ctx, networkID, container.ID, networkConfig) if err != nil { log.Printf("[ERROR] Failed connecting Docker socket proxy to docker network %s: %s", networkName, err) } else { @@ -571,7 +596,7 @@ func deployServiceWorkers(image string) { }, Networks: []swarm.NetworkAttachmentConfig{ swarm.NetworkAttachmentConfig{ - Target: networkName, + Target: networkID, }, swarm.NetworkAttachmentConfig{ Target: "ingress", @@ -2109,12 +2134,12 @@ func cleanup() { func StartAgent() { log.Printf("[INFO] Starting Orborus agent mode") - + auditLogEnabled := os.Getenv("SHUFFLE_AUDIT_LOG_ENABLED") == "true" - + if auditLogEnabled { log.Printf("[INFO] Audit log monitoring is enabled") - + // Initialize telemetry configuration telemetryConfig := shuffle.TelemetryConfig{ Enabled: true, @@ -2130,7 +2155,7 @@ func StartAgent() { Exclude: patterns, }) } - + if includePatterns := os.Getenv("SHUFFLE_AUDIT_LOG_INCLUDE"); includePatterns != "" { patterns := strings.Split(includePatterns, ",") telemetryConfig.Filters = append(telemetryConfig.Filters, shuffle.TelemetryFilter{ @@ -2151,7 +2176,7 @@ func StartAgent() { sigChan := make(chan os.Signal, 1) signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM) - + go func() { <-sigChan log.Printf("[INFO] Received shutdown signal, stopping audit log collector...") @@ -2184,7 +2209,7 @@ func main() { if os.Getenv("SHUFFLE_PIPELINE_STANDALONE") == "true" { log.Printf("[INFO] Allowing use of standalone pipeline (tenzir). URL: %s", pipelineUrl) - + //if os.Getenv("SHUFFLE_SKIP_PIPELINES") == "false" { // os.Setenv("SHUFFLE_SKIP_PIPELINES", "true") //} @@ -3016,10 +3041,7 @@ func handlePipeline(incRequest shuffle.ExecutionRequest) error { func deployTenzirNode() error { // Disabled all pipeline features - if os.Getenv("SHUFFLE_SKIP_PIPELINES") == "false" || os.Getenv("SHUFFLE_PIPELINE_ENABLED") == "true" { - // return errors.New("Pipelines are disabled by user with SHUFFLE_SKIP_PIPELINES") - //log.Printf("[INFO] Pipelines are enabled by user") - } else { + if os.Getenv("SHUFFLE_SKIP_PIPELINES") != "true" { return errors.New("Pipelines are disabled by user with SHUFFLE_SKIP_PIPELINES") } @@ -3249,7 +3271,7 @@ func createAndStartTenzirNode(ctx context.Context, containerName, imageName stri EndpointsConfig: map[string]*network.EndpointSettings{ "tenzir-network": { IPAMConfig: nil, - Aliases: []string{"tenzir-node"}, + Aliases: []string{"tenzir-node"}, }, }, } @@ -3909,7 +3931,10 @@ func sendPipelineHealthStatus() (shuffle.LakeConfig, error) { } else { //tenzirDisabled = true - log.Printf("[WARNING] Disabling pipelines: %s. You will need to restart the Orborus to fix this.", err) + if debug { + log.Printf("[WARNING] Disabling pipelines: %s. You will need to restart the Orborus to fix this.", err) + } + } return pipelinePayload, err