fix: tenzir disable + networkID focused

This commit is contained in:
Aditya
2025-11-11 22:43:57 +05:30
parent e470dbef7f
commit 52fed7105e
+33 -8
View File
@@ -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",
@@ -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")
}
@@ -3909,9 +3931,12 @@ func sendPipelineHealthStatus() (shuffle.LakeConfig, error) {
} else {
//tenzirDisabled = true
if debug {
log.Printf("[WARNING] Disabling pipelines: %s. You will need to restart the Orborus to fix this.", err)
}
}
return pipelinePayload, err
}