fix: tenzir disable + networkID focused
This commit is contained in:
@@ -441,12 +441,32 @@ func deployServiceWorkers(image string) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
if strings.Contains(fmt.Sprintf("%s", err), "already exists") {
|
if strings.Contains(fmt.Sprintf("%s", err), "already exists") {
|
||||||
// Try patching for attachable
|
// Try patching for attachable
|
||||||
|
if debug {
|
||||||
|
log.Printf("[DEBUG] Network %s already exists", networkName)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
log.Printf("[DEBUG] Failed to create network %s for workers: %s. This is not critical, and containers will still be added", networkName, err)
|
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)
|
isMemcachedRunning, err := checkMemcached(ctx, dockercli)
|
||||||
if err != nil {
|
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
|
defaultNetworkAttach := false
|
||||||
if containerId != "" {
|
if containerId != "" {
|
||||||
log.Printf("[DEBUG] Should connect orborus container to worker network as it's running in Docker with name %#v!", 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
|
// https://pkg.go.dev/github.com/docker/docker@v20.10.12+incompatible/api/types/network#EndpointSettings
|
||||||
networkConfig := &network.EndpointSettings{}
|
networkConfig := &network.EndpointSettings{}
|
||||||
err := dockercli.NetworkConnect(ctx, networkName, containerId, networkConfig)
|
err := dockercli.NetworkConnect(ctx, networkID, containerId, networkConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("[ERROR] Failed connecting Orborus to docker network %s: %s", networkName, err)
|
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 {
|
for _, container := range containers {
|
||||||
if strings.Contains(strings.ToLower(container.Image), "docker-socket-proxy") {
|
if strings.Contains(strings.ToLower(container.Image), "docker-socket-proxy") {
|
||||||
networkConfig := &network.EndpointSettings{}
|
networkConfig := &network.EndpointSettings{}
|
||||||
err := dockercli.NetworkConnect(ctx, networkName, container.ID, networkConfig)
|
err := dockercli.NetworkConnect(ctx, networkID, container.ID, networkConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("[ERROR] Failed connecting Docker socket proxy to docker network %s: %s", networkName, err)
|
log.Printf("[ERROR] Failed connecting Docker socket proxy to docker network %s: %s", networkName, err)
|
||||||
} else {
|
} else {
|
||||||
@@ -571,7 +596,7 @@ func deployServiceWorkers(image string) {
|
|||||||
},
|
},
|
||||||
Networks: []swarm.NetworkAttachmentConfig{
|
Networks: []swarm.NetworkAttachmentConfig{
|
||||||
swarm.NetworkAttachmentConfig{
|
swarm.NetworkAttachmentConfig{
|
||||||
Target: networkName,
|
Target: networkID,
|
||||||
},
|
},
|
||||||
swarm.NetworkAttachmentConfig{
|
swarm.NetworkAttachmentConfig{
|
||||||
Target: "ingress",
|
Target: "ingress",
|
||||||
@@ -2109,12 +2134,12 @@ func cleanup() {
|
|||||||
|
|
||||||
func StartAgent() {
|
func StartAgent() {
|
||||||
log.Printf("[INFO] Starting Orborus agent mode")
|
log.Printf("[INFO] Starting Orborus agent mode")
|
||||||
|
|
||||||
auditLogEnabled := os.Getenv("SHUFFLE_AUDIT_LOG_ENABLED") == "true"
|
auditLogEnabled := os.Getenv("SHUFFLE_AUDIT_LOG_ENABLED") == "true"
|
||||||
|
|
||||||
if auditLogEnabled {
|
if auditLogEnabled {
|
||||||
log.Printf("[INFO] Audit log monitoring is enabled")
|
log.Printf("[INFO] Audit log monitoring is enabled")
|
||||||
|
|
||||||
// Initialize telemetry configuration
|
// Initialize telemetry configuration
|
||||||
telemetryConfig := shuffle.TelemetryConfig{
|
telemetryConfig := shuffle.TelemetryConfig{
|
||||||
Enabled: true,
|
Enabled: true,
|
||||||
@@ -2130,7 +2155,7 @@ func StartAgent() {
|
|||||||
Exclude: patterns,
|
Exclude: patterns,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if includePatterns := os.Getenv("SHUFFLE_AUDIT_LOG_INCLUDE"); includePatterns != "" {
|
if includePatterns := os.Getenv("SHUFFLE_AUDIT_LOG_INCLUDE"); includePatterns != "" {
|
||||||
patterns := strings.Split(includePatterns, ",")
|
patterns := strings.Split(includePatterns, ",")
|
||||||
telemetryConfig.Filters = append(telemetryConfig.Filters, shuffle.TelemetryFilter{
|
telemetryConfig.Filters = append(telemetryConfig.Filters, shuffle.TelemetryFilter{
|
||||||
@@ -2151,7 +2176,7 @@ func StartAgent() {
|
|||||||
|
|
||||||
sigChan := make(chan os.Signal, 1)
|
sigChan := make(chan os.Signal, 1)
|
||||||
signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM)
|
signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
<-sigChan
|
<-sigChan
|
||||||
log.Printf("[INFO] Received shutdown signal, stopping audit log collector...")
|
log.Printf("[INFO] Received shutdown signal, stopping audit log collector...")
|
||||||
@@ -2184,7 +2209,7 @@ func main() {
|
|||||||
|
|
||||||
if os.Getenv("SHUFFLE_PIPELINE_STANDALONE") == "true" {
|
if os.Getenv("SHUFFLE_PIPELINE_STANDALONE") == "true" {
|
||||||
log.Printf("[INFO] Allowing use of standalone pipeline (tenzir). URL: %s", pipelineUrl)
|
log.Printf("[INFO] Allowing use of standalone pipeline (tenzir). URL: %s", pipelineUrl)
|
||||||
|
|
||||||
//if os.Getenv("SHUFFLE_SKIP_PIPELINES") == "false" {
|
//if os.Getenv("SHUFFLE_SKIP_PIPELINES") == "false" {
|
||||||
// os.Setenv("SHUFFLE_SKIP_PIPELINES", "true")
|
// os.Setenv("SHUFFLE_SKIP_PIPELINES", "true")
|
||||||
//}
|
//}
|
||||||
@@ -3016,10 +3041,7 @@ func handlePipeline(incRequest shuffle.ExecutionRequest) error {
|
|||||||
|
|
||||||
func deployTenzirNode() error {
|
func deployTenzirNode() error {
|
||||||
// Disabled all pipeline features
|
// Disabled all pipeline features
|
||||||
if os.Getenv("SHUFFLE_SKIP_PIPELINES") == "false" || os.Getenv("SHUFFLE_PIPELINE_ENABLED") == "true" {
|
if os.Getenv("SHUFFLE_SKIP_PIPELINES") != "true" {
|
||||||
// return errors.New("Pipelines are disabled by user with SHUFFLE_SKIP_PIPELINES")
|
|
||||||
//log.Printf("[INFO] Pipelines are enabled by user")
|
|
||||||
} else {
|
|
||||||
return errors.New("Pipelines are disabled by user with SHUFFLE_SKIP_PIPELINES")
|
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{
|
EndpointsConfig: map[string]*network.EndpointSettings{
|
||||||
"tenzir-network": {
|
"tenzir-network": {
|
||||||
IPAMConfig: nil,
|
IPAMConfig: nil,
|
||||||
Aliases: []string{"tenzir-node"},
|
Aliases: []string{"tenzir-node"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -3909,7 +3931,10 @@ func sendPipelineHealthStatus() (shuffle.LakeConfig, error) {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
//tenzirDisabled = true
|
//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
|
return pipelinePayload, err
|
||||||
|
|||||||
Reference in New Issue
Block a user