Unverified Commit c264018a authored by mohammedabdulwahhab's avatar mohammedabdulwahhab Committed by GitHub
Browse files

fix: nil pointer deref in dynamo controller (#2333)

parent 6a1a801c
...@@ -166,12 +166,16 @@ func GenerateDynamoComponentsDeployments(ctx context.Context, parentDynamoGraphD ...@@ -166,12 +166,16 @@ func GenerateDynamoComponentsDeployments(ctx context.Context, parentDynamoGraphD
labels[commonconsts.KubeLabelDynamoComponent] = componentName labels[commonconsts.KubeLabelDynamoComponent] = componentName
labels[commonconsts.KubeLabelDynamoNamespace] = dynamoNamespace labels[commonconsts.KubeLabelDynamoNamespace] = dynamoNamespace
if component.ComponentType == commonconsts.ComponentTypePlanner { if component.ComponentType == commonconsts.ComponentTypePlanner {
// ensure that the extraPodSpec is not nil
if deployment.Spec.ExtraPodSpec == nil { if deployment.Spec.ExtraPodSpec == nil {
deployment.Spec.ExtraPodSpec = &common.ExtraPodSpec{ deployment.Spec.ExtraPodSpec = &common.ExtraPodSpec{}
PodSpec: &corev1.PodSpec{}, }
} // ensure that the embedded PodSpec struct is not nil
if deployment.Spec.ExtraPodSpec.PodSpec == nil {
deployment.Spec.ExtraPodSpec.PodSpec = &corev1.PodSpec{}
} }
deployment.Spec.ExtraPodSpec.ServiceAccountName = commonconsts.PlannerServiceAccountName // finally set the service account name
deployment.Spec.ExtraPodSpec.PodSpec.ServiceAccountName = commonconsts.PlannerServiceAccountName
} }
if deployment.IsMainComponent() && defaultIngressSpec != nil && deployment.Spec.Ingress == nil { if deployment.IsMainComponent() && defaultIngressSpec != nil && deployment.Spec.Ingress == nil {
deployment.Spec.Ingress = defaultIngressSpec deployment.Spec.Ingress = defaultIngressSpec
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment