Skip to content

Instantly share code, notes, and snippets.

@lgfa29
Created June 18, 2022 07:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lgfa29/44a3420fa588248fe39c942ee87131c0 to your computer and use it in GitHub Desktop.
Save lgfa29/44a3420fa588248fe39c942ee87131c0 to your computer and use it in GitHub Desktop.
diff --git a/nomad/structs/network.go b/nomad/structs/network.go
index 30e769323..3f7f1c8be 100644
--- a/nomad/structs/network.go
+++ b/nomad/structs/network.go
@@ -4,6 +4,8 @@ import (
"fmt"
"math/rand"
"net"
+ "os"
+ "strings"
"sync"
"github.com/hashicorp/nomad/helper"
@@ -174,6 +176,9 @@ func (idx *NetworkIndex) Overcommitted() bool {
// SetNode is used to setup the available network resources. Returns
// true if there is a collision
func (idx *NetworkIndex) SetNode(node *Node) (collide bool, reason string) {
+ if os.Getenv("CRASH") != "" && strings.HasPrefix(node.Name, "crash") {
+ return true, "crash"
+ }
// COMPAT(0.11): Remove in 0.11
// Grab the network resources, handling both new and old
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment