@@ -218,7 +218,9 @@ func (r *Reconciler) reconcileVirtualService(obj *unstructured.Unstructured, vsv
218
218
if err != nil {
219
219
return newObj , len (patches ) > 0 , err
220
220
}
221
- err = unstructured .SetNestedSlice (newObj .Object , tlsRoutesI , "spec" , Tls )
221
+ if tlsRoutesI != nil {
222
+ err = unstructured .SetNestedSlice (newObj .Object , tlsRoutesI , "spec" , Tls )
223
+ }
222
224
return newObj , len (patches ) > 0 , err
223
225
}
224
226
@@ -525,7 +527,6 @@ func (r *Reconciler) Type() string {
525
527
func (r * Reconciler ) SetWeight (desiredWeight int32 , additionalDestinations ... v1alpha1.WeightDestination ) error {
526
528
ctx := context .TODO ()
527
529
var vsvc * unstructured.Unstructured
528
- var err error
529
530
var virtualServices []v1alpha1.IstioVirtualService
530
531
531
532
if istioutil .MultipleVirtualServiceConfigured (r .rollout ) {
@@ -541,6 +542,7 @@ func (r *Reconciler) SetWeight(desiredWeight int32, additionalDestinations ...v1
541
542
namespace = r .rollout .Namespace
542
543
}
543
544
545
+ var err error
544
546
client := r .client .Resource (istioutil .GetIstioVirtualServiceGVR ()).Namespace (namespace )
545
547
if r .virtualServiceLister != nil {
546
548
vsvc , err = r .virtualServiceLister .Namespace (namespace ).Get (vsvcName )
@@ -564,9 +566,11 @@ func (r *Reconciler) SetWeight(desiredWeight int32, additionalDestinations ...v1
564
566
if err == nil {
565
567
r .log .Debugf ("Updated VirtualService: %s" , modifiedVirtualService )
566
568
r .recorder .Eventf (r .rollout , record.EventOptions {EventReason : "Updated VirtualService" }, "VirtualService `%s` set to desiredWeight '%d'" , vsvcName , desiredWeight )
569
+ } else {
570
+ return err
567
571
}
568
572
}
569
- return err
573
+ return nil
570
574
}
571
575
572
576
func (r * Reconciler ) VerifyWeight (desiredWeight int32 , additionalDestinations ... v1alpha1.WeightDestination ) (* bool , error ) {
0 commit comments