Closed naitikdani closed 5 years ago
In fact, I get this error when I call edit() on already created virtualservice.
kubectl get virtualservice/reviews-route -o yaml apiVersion: networking.istio.io/v1alpha3 kind: VirtualService metadata: creationTimestamp: "2019-05-09T20:35:37Z" generation: 1 name: reviews-route namespace: default resourceVersion: "2243865" selfLink: /apis/networking.istio.io/v1alpha3/namespaces/default/virtualservices/reviews-route
I am seeing this error when I call edit():
io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: GET at: https://xxxxxxxxx/apis/$apiGroupName/$apiGroupVersion/namespaces/default/virtualservices/reviews-route. Message: 404 page not found
Any help will be appreciated
@iocanel probably another one for you :)
@naitikdani: Unfortunately, we don't have a workaround for this one (its currently broken). @metacosm is working on it and hopefully, we will have a fix.
@metacosm: feel free to throw it back at me, if you are swarmed, I just assigned it to you as I know you were already working on it.
@naitikdani hi, this issue has been fixed with 1.1.0-Beta3. Please give it a try and let us know how it goes!
@metacosm the new version worked like a charm. Thank you so much for fixing this. One more question, does edit() API also support deleting a match rule? If yes, can you share what api should I call to make it work.
Thanks for all your help.
@naitikdani I'd assume that something like: istioClient.virtualService().withName("reviews-route").edit().editSpec().editMatchingHttp(<predicate identifying the http route you want to modify>).removeFromMatch(<match you want to remove>).endHttp().endSpec().done()
should work…
I have a requirement where if i had a new microservice i need to update virtualservice with match rule. I tried to append the new match rule with edit() api but it didn't work.
kubectl get virtualservice/reviews-route -o yaml apiVersion: networking.istio.io/v1alpha3 kind: VirtualService metadata: name: reviews-route namespace: default spec: gateways:
I want to append the text in bold with edit() api.
Pasting a code snippet: ` istioClient.virtualService().createOrReplaceWithNew() .withNewMetadata().withName("reviews-route").endMetadata() .withNewSpec() .addToHosts("reviews.prod.svc.cluster.local") .addToGateways("logforwarding-gateway") .addNewHttp() .addNewMatch().withNewUri().withNewExactMatchType("/onboard").endUri().endMatch() .addNewMatch().withNewUri().withNewExactMatchType("/offboard").endUri().endMatch() .addNewRoute() .withNewDestination().withHost(reviewsHost).withNewPort().withNewNumberPort(9080).endPort() .endDestination() .endRoute() .endHttp() .addNewHttp() .addNewMatch().withHeaders(matchMap).endMatch() .addNewRoute() .withNewDestination().withHost("service-hello-901").withNewPort().withNewNumberPort(8080).endPort() .endDestination() .endRoute() .endHttp() .endSpec() .done();