Skip to content

Commit 05459ea

Browse files
M00nF1shFawad Khaliq
andauthored
partially fix the crash in issue 305 (#310)
Co-authored-by: Fawad Khaliq <[email protected]>
1 parent 73614f8 commit 05459ea

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

controllers/appmesh/cloudmap_controller.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,12 @@ func (r *cloudMapReconciler) reconcileVirtualNodeWithCloudMap(ctx context.Contex
9797

9898
func (r *cloudMapReconciler) cleanupCloudMapResources(ctx context.Context, vNode *appmesh.VirtualNode) error {
9999
if k8s.HasFinalizer(vNode, k8s.FinalizerAWSCloudMapResources) {
100-
if err := r.cloudMapResourceManager.Cleanup(ctx, vNode); err != nil {
101-
return err
100+
// TODO: choose one of the approach in https://github.com/aws/aws-app-mesh-controller-for-k8s/issues/305#issuecomment-654374069
101+
// to completely fix the issue
102+
if vNode.Spec.ServiceDiscovery != nil && vNode.Spec.ServiceDiscovery.AWSCloudMap != nil {
103+
if err := r.cloudMapResourceManager.Cleanup(ctx, vNode); err != nil {
104+
return err
105+
}
102106
}
103107
if err := r.finalizerManager.RemoveFinalizers(ctx, vNode, k8s.FinalizerAWSCloudMapResources); err != nil {
104108
return err

0 commit comments

Comments
 (0)