Skip to content

Commit

Permalink
Fix nilpointer if CALICO_NETWORKING_BACKEND=none
Browse files Browse the repository at this point in the history
There is a nil pointer in the configureASNumber function if the networking backend is none (i.e. policy-only mode)

Signed-off-by: Tobias Giese <tobias.giese@mercedes-benz.com>
  • Loading branch information
tobiasgiese committed Jun 28, 2023
1 parent 8234b36 commit 3740b39
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions node/pkg/lifecycle/startup/startup.go
Expand Up @@ -691,6 +691,11 @@ func evaluateENVBool(envVar string, defaultValue bool) bool {
// in the environment, or is a no-op if not specified.
// Returns true if the node object needs to be updated.
func configureASNumber(node *libapi.Node) bool {
// If Calico is running in policy only mode we don't need to write BGP related
// details to the Node.
if os.Getenv("CALICO_NETWORKING_BACKEND") == "none" {
return false
}
// Extract the AS number from the environment
asStr := os.Getenv("AS")
if asStr != "" {
Expand Down

0 comments on commit 3740b39

Please sign in to comment.