From 3740b395ee840367462fb5f29a634b56299d7d47 Mon Sep 17 00:00:00 2001 From: Tobias Giese Date: Wed, 28 Jun 2023 22:39:26 +0200 Subject: [PATCH] Fix nilpointer if CALICO_NETWORKING_BACKEND=none 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 --- node/pkg/lifecycle/startup/startup.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/node/pkg/lifecycle/startup/startup.go b/node/pkg/lifecycle/startup/startup.go index 45b4cb79acb..b2e9e11ed87 100644 --- a/node/pkg/lifecycle/startup/startup.go +++ b/node/pkg/lifecycle/startup/startup.go @@ -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 != "" {