func (j *TestJig) UpdateService(update func(*v1.Service)) (*v1.Service, error) {
	for i := 0; i < 3; i++ {
		service, err := j.Client.CoreV1().Services(j.Namespace).Get(context.TODO(), j.Name, metav1.GetOptions{})
		if err != nil {
			return nil, fmt.Errorf("failed to get Service %q: %v", j.Name, err)
		}
		update(service)
		result, err := j.Client.CoreV1().Services(j.Namespace).Update(context.TODO(), service, metav1.UpdateOptions{})
		if err == nil {
			return j.sanityCheckService(result, service.Spec.Type)
		}
		if !apierrors.IsConflict(err) && !apierrors.IsServerTimeout(err) {
			return nil, fmt.Errorf("failed to update Service %q: %v", j.Name, err)
		}
	}
	return nil, fmt.Errorf("too many retries updating Service %q", j.Name)
}
// UpdateService fetches a service, calls the update function on it, and
// then attempts to send the updated service. It tries up to 3 times in the
// face of timeouts and conflicts.
UpdateService fetches a service, calls the update function on it, and
then attempts to send the updated service. It tries up to 3 times in the
face of timeouts and conflicts.
// UpdateService fetches a service calls the update function on it and // then attempts to send the updated service . It tries up to 3 times in the // face of timeouts and conflicts .
func (j *TestJig) UpdateService(update func(*v1.Service)) (*v1.Service, error) {
	for i := 0; i < 3; i++ {
		service, err := j.Client.CoreV1().Services(j.Namespace).Get(context.TODO(), j.Name, metav1.GetOptions{})
		if err != nil {
			return nil, fmt.Errorf("failed to get Service %q: %v", j.Name, err)
		}
		update(service)
		result, err := j.Client.CoreV1().Services(j.Namespace).Update(context.TODO(), service, metav1.UpdateOptions{})
		if err == nil {
			return j.sanityCheckService(result, service.Spec.Type)
		}
		if !apierrors.IsConflict(err) && !apierrors.IsServerTimeout(err) {
			return nil, fmt.Errorf("failed to update Service %q: %v", j.Name, err)
		}
	}
	return nil, fmt.Errorf("too many retries updating Service %q", j.Name)
}
func ( j * TestJig ) UpdateService ( update func ( * v1 . Service ) ) ( * v1 . Service , error ) { for i := 0 ; i < 3 ; i ++ { service , err := j . Client . CoreV1 ( ) . Services ( j . Namespace ) . Get ( context . TODO ( ) , j . Name , metav1 . GetOptions { } ) if err != nil { return nil , fmt . Errorf ( " " , j . Name , err ) } update ( service ) result , err := j . Client . CoreV1 ( ) . Services ( j . Namespace ) . Update ( context . TODO ( ) , service , metav1 . UpdateOptions { } ) if err == nil { return j . sanityCheckService ( result , service . Spec . Type ) } if ! apierrors . IsConflict ( err ) && ! apierrors . IsServerTimeout ( err ) { return nil , fmt . Errorf ( " " , j . Name , err ) } } return nil , fmt . Errorf ( " " , j . Name ) }
UpdateService fetches a service, calls the update function on it, and
then attempts to send the updated service.
UpdateService fetches a service calls the update function on it and then attempts to send the updated service .