Panic when creating InstanceGroup with custom-networking annotations
preflightsiren opened this issue · 0 comments
preflightsiren commented
Is this a BUG REPORT or FEATURE REQUEST?: Bug report
What happened: instance-manager panics with nil point dereference
What you expected to happen: IM not to crash :P
How to reproduce it (as minimally and precisely as possible):
Create a new instanceGroup with annotations:
metadata:
annotations:
instancemgr.keikoproj.io/custom-networking-enabled: "true"
instancemgr.keikoproj.io/custom-networking-host-pods: "6"
Anything else we need to know?: It only occurs when creating a new instanceGroup. Annotating a new instanceGroup is unaffected.
Environment: AWS EKS.
- Kubernetes version: 1.17
kubectl version -o yaml
Other debugging information (if applicable):
I've run instance-manager locally with patch:
diff --git a/controllers/provisioners/eks/helpers.go b/controllers/provisioners/eks/helpers.go
index f764441..68398e2 100644
--- a/controllers/provisioners/eks/helpers.go
+++ b/controllers/provisioners/eks/helpers.go
@@ -471,6 +471,10 @@ func (ctx *EksInstanceGroupContext) GetComputedBootstrapOptions() *v1alpha1.Boot
}
instanceTypeNetworkInfo := awsprovider.GetInstanceTypeNetworkInfo(state.GetInstanceTypeInfo(), configuration.InstanceType)
+ if instanceTypeNetworkInfo == nil {
+ ctx.Log.Error(nil, "state.GetInstanceTypeInfo()", "state.GetInstanceTypeInfo()", state.GetInstanceTypeInfo())
+ ctx.Log.Error(nil, "configuration.InstanceType", "configuration.InstanceType", configuration.InstanceType)
+ }
maxPods := (*instanceTypeNetworkInfo.MaximumNetworkInterfaces-1)*
(*instanceTypeNetworkInfo.Ipv4AddressesPerInterface-1) + hostNetworkPods
if configuration.BootstrapOptions == nil {
which gives output:
2021-06-04T15:53:48.688+1000 ERROR controllers.instancegroup.eks state.GetInstanceTypeInfo() {"state.GetInstanceTypeInfo()": []}
2021-06-04T15:53:48.688+1000 ERROR controllers.instancegroup.eks configuration.InstanceType {"configuration.InstanceType": "m5.xlarge"}
and confirms that instanceTypeNetworkInfo
is nil (likely because state.GetInstanceTypeInfo()
returns []
)