From 2cda28011fb6fd77a4f59bc0ded202168de61dcb Mon Sep 17 00:00:00 2001 From: Harshdeep Singh <38904804+super-harsh@users.noreply.github.com> Date: Tue, 18 Jun 2024 11:52:27 +1200 Subject: [PATCH] Add nil check --- .../network/customizations/private_endpoints_extensions.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/v2/api/network/customizations/private_endpoints_extensions.go b/v2/api/network/customizations/private_endpoints_extensions.go index b66805eeb5b..7b9453fc1d5 100644 --- a/v2/api/network/customizations/private_endpoints_extensions.go +++ b/v2/api/network/customizations/private_endpoints_extensions.go @@ -140,7 +140,7 @@ func configMapToWrite(obj *network.PrivateEndpoint, configs map[string]string) ( } collector := configmaps.NewCollector(obj.Namespace) - + primaryNicPrivateIPAddress, ok := configs["PrimaryNicPrivateIPAddress"] if ok { collector.AddValue(operatorSpecConfigs.PrimaryNicPrivateIPAddress, primaryNicPrivateIPAddress) @@ -150,6 +150,10 @@ func configMapToWrite(obj *network.PrivateEndpoint, configs map[string]string) ( } func configMapSpecified(endpoint *network.PrivateEndpoint) bool { + if endpoint.Spec.OperatorSpec == nil || endpoint.Spec.OperatorSpec.ConfigMaps == nil { + return false + } + hasIpConfiguration := false configMaps := endpoint.Spec.OperatorSpec.ConfigMaps