Giter Site home page Giter Site logo

snowdrop / istio-java-api Goto Github PK

View Code? Open in Web Editor NEW
112.0 9.0 33.0 18.21 MB

A Java API to generate Istio descriptors, inspired by Fabric8's kubernetes-model.

License: Apache License 2.0

Makefile 0.34% Go 15.45% Java 82.58% ANTLR 0.92% Shell 0.71%
istio java api kubernetes golang code-generator

istio-java-api's Introduction

Note

This project is now deprecated. Please use the Istio client in the https://github.com/fabric8io/kubernetes-client project starting with version 5.11.0.

istio-java-api

A project to generate a Java API for Istio's domain allowing, in particular, the generation of Istio deployment descriptors.This project is inspired by Fabric8’s kubernetes-model and relies on the same approach: a Go program uses Go reflection to generate a JSON Schema which is then used by jsonschema2pojo to generate Java classes. jsonschema2pojo is configured to use a custom annotator, IstioTypeAnnotator (found in the istio-model-annotator module), to add (Jackson, Bean Validation - JSR 380 and sundrio annotations.Sundrio is used generate idiomatic builder and DSL Java classes. Jackson is used to output JSON or YAML representation of the Java objects when needed.

Usage

Please take a look at the tests in istio-model/src/test/java to see how the API can be used. You can also take a look at the https://github.com/metacosm/istio-test-dsl project which demonstrates an end-to-end scenario using the Fabric8 OpenShift adapter and this API to send Istio artifacts to a running OpenShift cluster configured on which Istio is set up.

Starting with the 1.7.7 of this API, the bundled version of the Fabric8 Kubernetes client has been upgraded to use the non-backwards compatible 5.x versions. While this might not be an issue for most users of this API, it’s still worth noting.

Building instructions

If you only want to build the current version of the API and don’t intend on modifying how the JSON Schema is generated, you can build simply using mvn clean install as the project contains a pre-generated version of the schema.If you need to re-generate the classes from a newer version of the API, since the build relies on Go introspection, you will need to set up a Go programming environment.

Building the Java API

You will need to install Go and make. Run make. This will build the generate command line tool from Go and then run it to generate a JSON Schema in istio-model/src/main/resources/schema/istio-schema.json. A Maven build is then issued using the jsonschema2pojo Maven plugin to generate Java classes in istio-model/target/generated-sources and generate a Jar file containing the compiled version of these classes along with the JSON schema, ready to be used.

You can clean everything using make clean, only generate the schema using make schema or only generate the Java classes from an already generated schema such as the provided one using mvn clean install.

Updating the Java API when Istio is updated

Note
The process is not completely reproducible at this time. :(
# update to the latest istio version, rebuild crd list and packages
make metadata
# build using strict mode
make strict
# fix any issue, iterate… :)

You can also re-generate the properties files that are used to determine which Kubernetes Custom Resource Definitions (CRDs) are specified by Istio. These files are located in istio-common/src/main/resources/, one for each kind of supported CRDs and can be generated using make metadata. You can also re-generate the CSV file that is used to map Istio Go packages to Java packages. The file is located at istio-common/src/main/resources/packages.csv and can be generated using make metadata.

istio-java-api's People

Contributors

ascat avatar bgokden avatar fwiesner avatar geoand avatar iocanel avatar kentchenjh avatar lordofthejars avatar metacosm avatar mraszplewicz avatar shalk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

istio-java-api's Issues

Unknown field 'consistentHash' (through reference chain: me.snowdrop.istio.api.networking.v1alpha3.DestinationRule["spec"]->me.snowdrop.istio.api.networking.v1alpha3.DestinationRuleSpec["trafficPolicy"]->me.snowdrop.istio.api.networking.v1alpha3.TrafficPolicy["loadBalancer"])

<dependency>
	<groupId>me.snowdrop</groupId>
	<artifactId>istio-client</artifactId>
	<version>1.1.0</version>
</dependency>

Caused by: com.fasterxml.jackson.databind.JsonMappingException: Unknown field 'consistentHash' (through reference chain: me.snowdrop.istio.api.networking.v1alpha3.DestinationRule["spec"]->me.snowdrop.istio.api.networking.v1alpha3.DestinationRuleSpec["trafficPolicy"]->me.snowdrop.istio.api.networking.v1alpha3.TrafficPolicy["loadBalancer"])

Error log:

## [2020-04-17 18:36:45,903][ERROR:http-nio-8080-exec-4][CustomControllerAdvice.java:292] An error has occurred.
io.fabric8.kubernetes.client.KubernetesClientException: An error has occurred.
	at io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:64)
	at io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:53)
	at io.fabric8.kubernetes.client.utils.Serialization.unmarshal(Serialization.java:243)
	at io.fabric8.kubernetes.client.utils.Serialization.unmarshal(Serialization.java:195)
	at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:409)
	at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:365)
	at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleGet(OperationSupport.java:330)
	at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleGet(OperationSupport.java:311)
	at io.fabric8.kubernetes.client.dsl.base.BaseOperation.handleGet(BaseOperation.java:810)
	at io.fabric8.kubernetes.client.dsl.base.BaseOperation.getMandatory(BaseOperation.java:218)
	at io.fabric8.kubernetes.client.dsl.base.BaseOperation.get(BaseOperation.java:162)
	at com.authine.lateinos.kube.api.service.impl.DestinationRuleCtrl.getDestinationRule(DestinationRuleCtrl.java:30)
	at com.authine.lateinos.kube.api.service.impl.DestinationRuleImpl.getDestinationRule(DestinationRuleImpl.java:25)
	at com.authine.lateinos.kube.api.controller.DestinationRuleController.get(DestinationRuleController.java:62)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:892)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797)
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1039)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005)
	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:897)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:200)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:836)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1747)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Unknown field 'consistentHash' (through reference chain: me.snowdrop.istio.api.networking.v1alpha3.DestinationRule["spec"]->me.snowdrop.istio.api.networking.v1alpha3.DestinationRuleSpec["trafficPolicy"]->me.snowdrop.istio.api.networking.v1alpha3.TrafficPolicy["loadBalancer"])
	at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:394)
	at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:353)
	at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.wrapAndThrow(BeanDeserializerBase.java:1711)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:290)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
	at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:127)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
	at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:127)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4013)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3077)
	at io.fabric8.kubernetes.client.utils.Serialization.unmarshal(Serialization.java:241)
	... 65 more
Caused by: java.lang.IllegalArgumentException: Unknown field 'consistentHash'
	at me.snowdrop.istio.api.internal.ClassWithInterfaceFieldsRegistry.getFieldInfo(ClassWithInterfaceFieldsRegistry.java:115)
	at me.snowdrop.istio.api.internal.ClassWithInterfaceFieldsDeserializer.deserialize(ClassWithInterfaceFieldsDeserializer.java:78)
	at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:127)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
	... 75 more

Error in Virtual Service Spec Deserialization

Error in deserializing VirtualService configuration for the below spec
istio-java-api version - 0.12

Spec

{
  "apiVersion": "networking.istio.io/v1alpha3",
  "kind": "VirtualService",
  "metadata": {
    "name": "ratings-route"
  },
  "spec": {
    "hosts": [
      "ratings.prod.svc.cluster.local"
    ],
    "http": [
      {
        "match": [
          {
            "headers": {
              "end-user": {
                "exact": "jason"
              }
            },
            "uri": {
              "prefix": "/ratings/v2/"
            }
          }
        ],
        "route": [
          {
            "destination": {
              "host": "ratings.prod.svc.cluster.local"
            }
          }
        ]
      }
    ]
  }
}

Error

Caused by: com.fasterxml.jackson.databind.JsonMappingException: Couldn't create an instance of java.util.Map (through reference chain: me.snowdrop.istio.api.model.v1.networking.VirtualService["http"]->java.util.ArrayList[0]->me.snowdrop.istio.api.model.v1.networking.HTTPRoute["match"]->java.util.ArrayList[0]->me.snowdrop.istio.api.model.v1.networking.HTTPMatchRequest["headers"]->java.util.LinkedHashMap["end-user"])
	at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:394)
	at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:353)
	at com.fasterxml.jackson.databind.deser.std.ContainerDeserializerBase.wrapAndThrow(ContainerDeserializerBase.java:181)
	at com.fasterxml.jackson.databind.deser.std.MapDeserializer._readAndBindStringKeyMap(MapDeserializer.java:539)
	at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:364)
	at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:29)
	at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
	at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:286)
	at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:245)
	at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:27)
	at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
	at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:286)
	at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:245)
	at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:27)
	at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
	at com.fasterxml.jackson.databind.ObjectMapper._readValue(ObjectMapper.java:3984)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2276)
	at com.fasterxml.jackson.databind.ObjectMapper.treeToValue(ObjectMapper.java:2758)
	at me.snowdrop.istio.api.internal.IstioDeserializer.getIstioSpec(IstioDeserializer.java:58)
	at me.snowdrop.istio.api.internal.IstioDeserializer.deserialize(IstioDeserializer.java:49)
	at me.snowdrop.istio.api.internal.IstioDeserializer.deserialize(IstioDeserializer.java:25)
	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4013)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3004)

Caused by: java.lang.RuntimeException: Couldn't create an instance of java.util.Map
	at me.snowdrop.istio.api.internal.ClassWithInterfaceFieldsDeserializer.deserialize(ClassWithInterfaceFieldsDeserializer.java:69)
	at com.fasterxml.jackson.databind.deser.std.MapDeserializer._readAndBindStringKeyMap(MapDeserializer.java:527)
	... 166 common frames omitted
Caused by: java.lang.InstantiationException: java.util.Map
	at java.lang.Class.newInstance(Class.java:427)
	at me.snowdrop.istio.api.internal.ClassWithInterfaceFieldsDeserializer.deserialize(ClassWithInterfaceFieldsDeserializer.java:67)
	... 167 common frames omitted
Caused by: java.lang.NoSuchMethodException: java.util.Map.<init>()
	at java.lang.Class.getConstructor0(Class.java:3082)
	at java.lang.Class.newInstance(Class.java:412)
	... 168 common frames omitted

Unable to deploy policy

Using the generic-deserializer branch I am unable to deploy:

apiVersion: authentication.istio.io/v1alpha1
kind: Policy
metadata:
  name: spring-boot-istio-routing-service
spec:
  targets:
    - name: spring-boot-istio-routing-service

using istioClient.registerCustomResources(resourceAsStream);

The stacktrace is:

java.lang.IllegalArgumentException: Cannot load class: me.snowdrop.istio.api.model.v1.routing.Policy

	at me.snowdrop.istio.api.internal.IstioSpecRegistry.loadClassIfExists(IstioSpecRegistry.java:195)
	at me.snowdrop.istio.api.internal.IstioSpecRegistry.resolveIstioSpecForKind(IstioSpecRegistry.java:141)
	at me.snowdrop.istio.api.internal.IstioDeserializer.deserialize(IstioDeserializer.java:38)
	at me.snowdrop.istio.api.internal.IstioDeserializer.deserialize(IstioDeserializer.java:25)
	at com.fasterxml.jackson.databind.ObjectMapper._convert(ObjectMapper.java:3525)
	at com.fasterxml.jackson.databind.ObjectMapper.convertValue(ObjectMapper.java:3449)
	at me.snowdrop.istio.util.YAML.loadIstioResources(YAML.java:67)
	at me.snowdrop.istio.client.IstioClient.registerCustomResources(IstioClient.java:26)
	at me.snowdrop.istio.client.IstioClient.registerCustomResources(IstioClient.java:39)
	at com.example.SimpleTest.run(SimpleTest.java:25)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: java.lang.ClassNotFoundException: me.snowdrop.istio.api.model.v1.routing.Policy
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at me.snowdrop.istio.api.internal.IstioSpecRegistry.loadClassIfExists(IstioSpecRegistry.java:188)
	... 31 more

Error happens when i get destinationRule

Exception in thread "main" io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: GET at: https://10.8.4.113:6443/apis/$apiGroupName/$apiGroupVersion/namespaces/default/destinationrules. Message: 404 page not found
.
at io.fabric8.kubernetes.client.dsl.base.OperationSupport.requestFailure(OperationSupport.java:503)
at io.fabric8.kubernetes.client.dsl.base.OperationSupport.assertResponseCode(OperationSupport.java:442)
at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:406)
at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:365)
at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:347)
at io.fabric8.kubernetes.client.dsl.base.BaseOperation.listRequestHelper(BaseOperation.java:144)
at io.fabric8.kubernetes.client.dsl.base.BaseOperation.list(BaseOperation.java:551)
at io.fabric8.kubernetes.client.dsl.base.BaseOperation.list(BaseOperation.java:65)
at cn.com.agree.asm.sync.util.manager.ServiceEntryManager.createOrReplaceServiceEntry(ServiceEntryManager.java:26)
at cn.com.agree.asm.sync.util.manager.ServiceEntryManager.main(ServiceEntryManager.java:40)

Why the url is :

https://10.8.4.113:6443/apis/$apiGroupName/$apiGroupVersion/namespaces/default/destinationrules

I think the $apiGroupName and the $apiGroupVersion can be replaced by some values,but how?

My Code is :
`

public class DestinationRuleDemo {
    public static void createOrReplaceServiceEntry() {
        Config config = new ConfigBuilder().build();
        config.setMasterUrl("https://10.8.4.113:6443");
        DefaultIstioClient client = new DefaultIstioClient(config);
        DestinationRuleList list = client.destinationRule().inNamespace("default").list();
        list.getItems().forEach((DestinationRule rule) -> {
            System.out.println(rule);
        });
    }
    public static void main(String[] args) {
        createOrReplaceServiceEntry();
    }
}

`

My k8s is 1.11.0,and my istio is 1.1.5!Thanks to help!

🐛 Unable to build

OS: Ubuntu 16.04

Steps followed:

  • Install Go 1.10
  • Set GOPATH to $HOME/gowork
  • mkdir $GOPATH/src
  • mkdir $GOPATH/bin
  • Install dep into $GOPATH/bin:
    curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
  • Check out project:
cd $GOPATH/src
git clone [email protected]:snowdrop/istio-java-api.git
cd istio-java-api
  • Install dependencies:
    $GOPATH/bin/dep ensure
  • Launch build script:
    make

Outcome:

[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /home/gandrian/gowork/src/istio-java-api/istio-model/target/generated-sources/me/snowdrop/istio/api/model/TimeStamp.java:[38,8] duplicate class: me.snowdrop.istio.api.model.TimeStamp

Contents of /home/gandrian/gowork/src/istio-java-api/istio-model/target/generated-sources/me/snowdrop/istio/api/model/TimeStamp.java:

package me.snowdrop.istio.api.model;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import javax.validation.Valid;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import io.fabric8.kubernetes.api.model.Doneable;
import io.sundr.builder.annotations.Buildable;
import io.sundr.builder.annotations.Inline;
import lombok.EqualsAndHashCode;
import lombok.ToString;


/**
 * 
 * 
 */
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonPropertyOrder({
    "apiVersion",
    "kind",
    "metadata",
    "value"
})
@JsonDeserialize(using = com.fasterxml.jackson.databind.JsonDeserializer.None.class)
@ToString
@EqualsAndHashCode
@Buildable(editableEnabled = false, validationEnabled = true, generateBuilderPackage = true, builderPackage = "io.fabric8.kubernetes.api.builder", inline = @Inline(type = Doneable.class, prefix = "Doneable", value = "done"))
public class TimeStamp implements Serializable
{

    /**
     * 
     * 
     */
    @JsonProperty("value")
    @JsonPropertyDescription("")
    @Valid
    private Timestamp value;
    @JsonIgnore
    @Valid
    private Map<String, Object> additionalProperties = new HashMap<String, Object>();
    private final static long serialVersionUID = 5557293445908817843L;

    /**
     * No args constructor for use in serialization
     * 
     */
    public TimeStamp() {
    }

    /**
     * 
     * @param value
     */
    public TimeStamp(Timestamp value) {
        super();
        this.value = value;
    }

    /**
     * 
     * 
     */
    @JsonProperty("value")
    public Timestamp getValue() {
        return value;
    }

    /**
     * 
     * 
     */
    @JsonProperty("value")
    public void setValue(Timestamp value) {
        this.value = value;
    }

    @JsonAnyGetter
    public Map<String, Object> getAdditionalProperties() {
        return this.additionalProperties;
    }

    @JsonAnySetter
    public void setAdditionalProperty(String name, Object value) {
        this.additionalProperties.put(name, value);
    }

}

VirtualService Uri parameter is not set correctly

Hi,

We are having some problem in setting VirtualService uri parameters as in example:

`apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: reviews-route
spec:
hosts:

We were using additional parameters to set "prefix: /url", but it is not working on this field.
We are using StringMatch class to create uri. We tried several variations but always failed.

Maybe it is fixed with 0.11 but it is not pushed to maven yet so we didn't tried.

UnrecognizedPropertyException: Unrecognized field "traffic_policy"

This problem come out when I get DestinationRuleList in namespace 'istio-system'
In the file DestinationRuleSpec.class of package package me.snowdrop.istio.api.networking.v1alpha3;
It is trafficPolicy instead of traffic_policy
my Istio version:

$ istioctl version
client version: 1.2.2
grafana version: 
citadel version: 1.1.8
galley version: 1.1.8
ingressgateway version: 1.1.8
pilot version: 1.1.8
policy version: 1.1.8
sidecar-injector version: 1.1.8
telemetry version: 1.1.8
kiali version: 
prometheus version: 

This is what I get DestinationRule from Kubernetes with kubectl:

$ kubectl get destinationrule istio-policy -o yaml -n istio-system
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
  creationTimestamp: "2019-06-14T08:09:08Z"
  generation: 1
  name: istio-policy
  namespace: istio-system
  ownerReferences:
  - apiVersion: istio.alibabacloud.com/v1beta1
    blockOwnerDeletion: true
    controller: true
    kind: Istio
    name: istio-config
    uid: a3a79285-8e7b-11e9-91b0-aeb2e5e2ff0c
  resourceVersion: "175473952"
  selfLink: /apis/networking.istio.io/v1alpha3/namespaces/istio-system/destinationrules/istio-policy
  uid: af95089f-8e7b-11e9-91b0-aeb2e5e2ff0c
spec:
  host: istio-policy.istio-system.svc.cluster.local
  traffic_policy:
    connection_pool:
      http:
        http2_max_requests: 10000
        max_requests_per_connection: 10000

Here is the error message:

[2019-08-01 18:13:26,464][TRACE:http-nio-8080-exec-3][InvocableHandlerMethod.java:136] Arguments: [istio-system]
[2019-08-01 18:13:26,483][TRACE:http-nio-8080-exec-3][AbstractBeanFactory.java:254] Returning cached instance of singleton bean 'customControllerAdvice'
[2019-08-01 18:13:26,483][DEBUG:http-nio-8080-exec-3][ExceptionHandlerExceptionResolver.java:403] Using @ExceptionHandler public com.authine.lateinos.svc.ResponseResult<java.lang.Object> com.authine.lateinos.container.handler.CustomControllerAdvice.handle(java.lang.Throwable)
[2019-08-01 18:13:26,483][TRACE:http-nio-8080-exec-3][InvocableHandlerMethod.java:136] Arguments: [io.fabric8.kubernetes.client.KubernetesClientException: An error has occurred.]
[2019-08-01 18:13:26,483][INFO :http-nio-8080-exec-3][CustomControllerAdvice.java:59] An error has occurred.
io.fabric8.kubernetes.client.KubernetesClientException: An error has occurred.
	at io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:64)
	at io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:53)
	at io.fabric8.kubernetes.client.utils.Serialization.unmarshal(Serialization.java:243)
	at io.fabric8.kubernetes.client.utils.Serialization.unmarshal(Serialization.java:195)
	at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:409)
	at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:365)
	at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:347)
	at io.fabric8.kubernetes.client.dsl.base.BaseOperation.listRequestHelper(BaseOperation.java:145)
	at io.fabric8.kubernetes.client.dsl.base.BaseOperation.list(BaseOperation.java:612)
	at io.fabric8.kubernetes.client.dsl.base.BaseOperation.list(BaseOperation.java:63)
	at com.authine.lateinos.kube.api.service.impl.DestinationRuleCtrl.listDestinationRule(DestinationRuleCtrl.java:27)
	at com.authine.lateinos.kube.api.service.impl.DestinationRuleImpl.listDestinationRule(DestinationRuleImpl.java:27)
	at com.authine.lateinos.kube.api.controller.DestinationRuleController.list(DestinationRuleController.java:67)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:892)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797)
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1039)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005)
	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:897)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:200)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:836)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1747)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:748)
Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "traffic_policy" (class me.snowdrop.istio.api.networking.v1alpha3.DestinationRuleSpec), not marked as ignorable (4 known properties: "host", "subsets", "exportTo", "trafficPolicy"])
 at [Source: (BufferedInputStream); line: 1, column: 695] (through reference chain: me.snowdrop.istio.api.networking.v1alpha3.DestinationRuleList["items"]->java.util.ArrayList[0]->me.snowdrop.istio.api.networking.v1alpha3.DestinationRule["spec"]->me.snowdrop.istio.api.networking.v1alpha3.DestinationRuleSpec["traffic_policy"])
	at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:61)
	at com.fasterxml.jackson.databind.DeserializationContext.handleUnknownProperty(DeserializationContext.java:823)
	at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:1153)
	at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1589)
	at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(BeanDeserializerBase.java:1567)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:294)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
	at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:127)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
	at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:286)
	at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:245)
	at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:27)
	at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:127)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4013)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3077)
	at io.fabric8.kubernetes.client.utils.Serialization.unmarshal(Serialization.java:241)
	... 64 more

Unrecognized field "name" (class me.snowdrop.istio.api.networking.v1alpha3.HTTPRoute)

Hi I'm trying to retrive a vritual service from Istio using your client.

What im using:
Kubernetes version 1.15.
Istio version 1.3.1.
istio-java-api 1.1.0.
kubernetes-client 4.2.2.

VirtualServiceList listVS = istioClient.virtualService().inNamespace("default").list();
		listVS.getItems().forEach((VirtualService vs) -> {
			System.out.println(vs);
		});

Error:
com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "name" (class me.snowdrop.istio.api.networking.v1alpha3.HTTPRoute), not marked as ignorable

Full error: log.txt.

Unable to deploy istio-spring-boot with me.snowdrop:istio-model:0.4-SNAPSHOT

After making sure that the fmp-istio-enricher uses me.snowdrop:istio-model:0.4-SNAPSHOT I tried to deploy our Spring Boot Quick Start Istio following the instructions (mvn clean package fabric8:deploy -Pistio-openshift).

Although the error reported in #2 was cleared, I now get the following stacktrace

Caused by: java.lang.ClassCastException: io.fabric8.kubernetes.api.model.ObjectMetaBuilder cannot be cast to io.fabric8.kubernetes.api.builder.Visitable
        at io.fabric8.kubernetes.api.builder.BaseFluent.acceptInternal(BaseFluent.java:90)
        at io.fabric8.kubernetes.api.builder.BaseFluent.accept(BaseFluent.java:85)
        at io.fabric8.kubernetes.api.builder.BaseFluent.accept(BaseFluent.java:11)
        at io.fabric8.kubernetes.api.builder.BaseFluent.acceptInternal(BaseFluent.java:91)
        at io.fabric8.kubernetes.api.builder.BaseFluent.accept(BaseFluent.java:85)
        at io.fabric8.maven.enricher.standard.NameEnricher.addMissingResources(NameEnricher.java:59)
        at io.fabric8.maven.plugin.enricher.EnricherManager$1.apply(EnricherManager.java:114)
        at io.fabric8.maven.plugin.enricher.EnricherManager$1.apply(EnricherManager.java:111)
        at io.fabric8.maven.plugin.enricher.EnricherManager.loop(EnricherManager.java:214)
        at io.fabric8.maven.plugin.enricher.EnricherManager.createDefaultResources(EnricherManager.java:111)
        at io.fabric8.maven.plugin.enricher.EnricherManager.createDefaultResources(EnricherManager.java:106)
        at io.fabric8.maven.plugin.mojo.build.ResourceMojo.generateAppResources(ResourceMojo.java:544)
        at io.fabric8.maven.plugin.mojo.build.ResourceMojo.generateResources(ResourceMojo.java:456)
        at io.fabric8.maven.plugin.mojo.build.ResourceMojo.executeInternal(ResourceMojo.java:264)
        at io.fabric8.maven.plugin.mojo.AbstractFabric8Mojo.execute(AbstractFabric8Mojo.java:74)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)

After inspecting the classpath from the IDE, I saw that there are 2 classes named io.fabric8.kubernetes.api.model.ObjectMetaBuilder.

One from the io.fabric8:kubernetes-model:2.0.4 dependency
and one from the me.snowdrop:istio-model:0.4-SNAPSHOT dependency.

The latter seems to be the one that's causing the problem since it does not implement io.fabric8.kubernetes.api.builder.Visitable

Bug in Abort deserialization

Hi,

First, thanks for this library. It is a great help for us.
I was trying to register a virtual service using istio-client 1.1.0-Beta3 on istio 1.1.4.

VirtualService virtualService = istioClient.virtualService()
                .createNew()
                .withNewMetadata().withName("foo")
                .endMetadata()
                .withNewSpec()
                .addNewHost("foo")
                .addNewHttp()
                .withNewFault()
                .withNewAbort()
                .withNewPercentage(100.).withNewHttpStatusErrorType(500)
                .endAbort()
                .endFault()
                .addNewRoute()
                .withNewDestination()
                .withNewHost("foo")
                .endDestination()
                .endRoute()
                .endHttp()
                .endSpec().done();

I got the following error :

Caused by: com.fasterxml.jackson.databind.JsonMappingException: Unknown field 'percentage' (through reference chain: me.snowdrop.istio.api.networking.v1alpha3.VirtualService["spec"]->me.snowdrop.istio.api.networking.v1alpha3.VirtualServiceSpec["http"]->java.util.ArrayList[0]->me.snowdrop.istio.api.networking.v1alpha3.HTTPRoute["fault"]->me.snowdrop.istio.api.networking.v1alpha3.HTTPFaultInjection["abort"])
	at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:394)
	at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:353)
	at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.wrapAndThrow(BeanDeserializerBase.java:1711)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:290)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
	at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:127)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
	at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:286)
	at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:245)
	at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:27)
	at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:127)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
	at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:127)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4013)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3077)
	at io.fabric8.kubernetes.client.utils.Serialization.unmarshal(Serialization.java:241)
	... 54 more
Caused by: java.lang.IllegalArgumentException: Unknown field 'percentage'
	at me.snowdrop.istio.api.internal.ClassWithInterfaceFieldsRegistry.getFieldInfo(ClassWithInterfaceFieldsRegistry.java:115)
	at me.snowdrop.istio.api.internal.ClassWithInterfaceFieldsDeserializer.deserialize(ClassWithInterfaceFieldsDeserializer.java:78)
	at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:127)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
	... 70 more

It seems there is a discrepency between https://github.com/snowdrop/istio-java-api/blob/master/istio-common/src/main/resources/classes-with-interface-fields.yml and the auto generated me.snowdrop.istio.api.networking.v1alpha3.Abort class :

package me.snowdrop.istio.api.networking.v1alpha3;

import java.io.Serializable;
import javax.validation.Valid;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonUnwrapped;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import io.fabric8.kubernetes.api.model.Doneable;
import io.fabric8.kubernetes.api.model.ObjectMeta;
import io.sundr.builder.annotations.Buildable;
import io.sundr.builder.annotations.BuildableReference;
import io.sundr.builder.annotations.Inline;
import lombok.EqualsAndHashCode;
import lombok.ToString;


/**
 * 
 * 
 */
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonDeserialize(using = me.snowdrop.istio.api.internal.ClassWithInterfaceFieldsDeserializer.class)
@JsonPropertyOrder({
    "apiVersion",
    "kind",
    "metadata",
    "errorType",
    "percent",
    "percentage"
})
@ToString
@EqualsAndHashCode
@Buildable(editableEnabled = false, validationEnabled = true, generateBuilderPackage = true, builderPackage = "io.fabric8.kubernetes.api.builder", inline = {
    @Inline(type = Doneable.class, prefix = "Doneable", value = "done")
}, refs = {
    @BuildableReference(ObjectMeta.class)
})
public class Abort implements Serializable
{

    @JsonProperty("errorType")
    @JsonUnwrapped
    private me.snowdrop.istio.api.networking.v1alpha3.Abort.ErrorType errorType;
    /**
     * 
     * 
     */
    @JsonProperty("percent")
    @JsonPropertyDescription("")
    private Integer percent;
    /**
     * 
     * 
     */
    @JsonProperty("percentage")
    @JsonPropertyDescription("")
    @Valid
    private Percent percentage;
    private final static long serialVersionUID = 7121060348015116201L;

    /**
     * No args constructor for use in serialization
     * 
     */
    public Abort() {
    }

    /**
     * 
     * @param errorType
     * @param percentage
     * @param percent
     */
    public Abort(me.snowdrop.istio.api.networking.v1alpha3.Abort.ErrorType errorType, Integer percent, Percent percentage) {
        super();
        this.errorType = errorType;
        this.percent = percent;
        this.percentage = percentage;
    }

    @JsonProperty("errorType")
    public me.snowdrop.istio.api.networking.v1alpha3.Abort.ErrorType getErrorType() {
        return errorType;
    }

    @JsonProperty("errorType")
    public void setErrorType(me.snowdrop.istio.api.networking.v1alpha3.Abort.ErrorType errorType) {
        this.errorType = errorType;
    }

    /**
     * 
     * 
     */
    @JsonProperty("percent")
    public Integer getPercent() {
        return percent;
    }

    /**
     * 
     * 
     */
    @JsonProperty("percent")
    public void setPercent(Integer percent) {
        this.percent = percent;
    }

    /**
     * 
     * 
     */
    @JsonProperty("percentage")
    public Percent getPercentage() {
        return percentage;
    }

    /**
     * 
     * 
     */
    @JsonProperty("percentage")
    public void setPercentage(Percent percentage) {
        this.percentage = percentage;
    }

    public interface ErrorType extends Serializable
    {


    }

}

Thanks !

Istio 0.8 compatibility

The Istio 0.8 LTS is released this month.
v1alpha3 router rules configuration are recommended.
Is there a plan to make compatible with new version?

istioClient.gateway().createOrReplace(gateway) come out `Namespace parameter required`

When I use istioClient.gateway().createOrReplace(gateway) to update gateway. Come out Namespace parameter required error, but there have Namespace in metadata.

{
	"apiVersion": "networking.istio.io/v1alpha3",
	"kind": "Gateway",
	"metadata": {
		"creationTimestamp": "2019-08-02T17:42:55Z",
		"generation": 1,
		"name": "aaaa1",
		"namespace": "istio-bookinfo",
		"resourceVersion": "663342228",
		"selfLink": "/apis/networking.istio.io/v1alpha3/namespaces/istio-bookinfo/gateways/aaaa1",
		"uid": "f5e4d9ce-b54c-11e9-91b0-aeb2e5e2ff0c"
	},
	"spec": {
		"selector": {
			"additionalProp1": "string",
			"additionalProp2": "string",
			"additionalProp3": "string"
		},
		"servers": [{
			"bind": "string",
			"defaultEndpoint": "string",
			"hosts": [
				"string"
			],
			"port": {
				"name": "string",
				"number": 0,
				"protocol": "string"
			},
			"tls": {
				"caCertificates": "string",
				"cipherSuites": [
					"string"
				],
				"credentialName": "string",
				"httpsRedirect": true,
				"maxProtocolVersion": "Server_TLSOptions_TLS_AUTO",
				"minProtocolVersion": "Server_TLSOptions_TLS_AUTO",
				"mode": "PASSTHROUGH",
				"privateKey": "string",
				"serverCertificate": "string",
				"subjectAltNames": [
					"string"
				]
			}
		}]
	}
}

Error in Get method:

[2019-08-05 14:22:18,284][TRACE:http-nio-8080-exec-9][InvocableHandlerMethod.java:136] Arguments: [io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: GET at: https://47.122.216.138:6443/apis/networking.istio.io/v1alpha3/gateways/aaaa1. Message: Namespace parameter required.. Received status: Status(apiVersion=v1, code=400, details=null, kind=Status, message=Namespace parameter required., metadata=ListMeta(_continue=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=BadRequest, status=Failure, additionalProperties={}).]
[2019-08-05 14:22:18,285][INFO :http-nio-8080-exec-9][CustomControllerAdvice.java:59] Failure executing: GET at: https://47.122.216.138:6443/apis/networking.istio.io/v1alpha3/gateways/aaaa1. Message: Namespace parameter required.. Received status: Status(apiVersion=v1, code=400, details=null, kind=Status, message=Namespace parameter required., metadata=ListMeta(_continue=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=BadRequest, status=Failure, additionalProperties={}).
io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: GET at: https://47.122.216.138:6443/apis/networking.istio.io/v1alpha3/gateways/aaaa1. Message: Namespace parameter required.. Received status: Status(apiVersion=v1, code=400, details=null, kind=Status, message=Namespace parameter required., metadata=ListMeta(_continue=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=BadRequest, status=Failure, additionalProperties={}).

How to delete gateway/virtualService via name?

Hi Team,
I want to delete an Istio gateway via gateway name.
Following is my code but it doesn't work(Return false and gateway not be deleted)
Boolean delGateway = istioClient.virtualService().inNamespace(nsLaunchpad).withName(gatewayName).delete();

Or how can I get the gateway via gateway name? Then I can delete gateway by this way
istioClient.gateway().delete(gateway)

Please take a look at this, Thanks in advance.

Istio yaml can contain more than one document inside

Istio yaml can contain more than one document inside. YAML allows defines more than one document in the same file by separating them with ---.

We need to configure Jackson library to read in that way.

@hemanik can help on this providing some hints on how to do it since she did it in kubernetes client.

Error while creating VirtualService resource

I am running version 1.1.0 of istio-java-api and get following error while creating VirtualService resource:

Exception in thread "main" java.lang.NoSuchFieldError: _visitables
at me.snowdrop.istio.api.networking.v1alpha3.VirtualServiceFluentImpl.withMetadata(VirtualServiceFluentImpl.java:72)
at me.snowdrop.istio.api.networking.v1alpha3.VirtualServiceBuilder.(VirtualServiceBuilder.java:44)
at me.snowdrop.istio.api.networking.v1alpha3.VirtualServiceBuilder.(VirtualServiceBuilder.java:18)
at me.snowdrop.istio.api.networking.v1alpha3.VirtualServiceBuilder.(VirtualServiceBuilder.java:15)

Pasting a section of code:
VirtualService vs = new VirtualServiceBuilder()
.withApiVersion("networking.istio.io/v1alpha3")
.withKind("VirtualService")
.withNewMetadata().withName("reviews-route").endMetadata()
.withNewSpec()
.addToHosts("reviews.prod.svc.cluster.local")
.addToGateways("logforwarding-gateway")

Any idea how to fix this?

Unable to create destinationrule in istio-system namespace

I want to create a destinationrule in istio-system namespace, but it is failing with the following error:

DestinationRule drDefault = new DestinationRuleBuilder()
.withApiVersion("networking.istio.io/v1alpha3")
.withKind("DestinationRule")
.withNewMetadata().withName("default").withNamespace("istio-system")
.endMetadata()
.withNewSpec().withHost("*.local")
.withNewTrafficPolicy().withNewTls().withMode(TLSSettingsMode.ISTIO_MUTUAL).endTls()
.endTrafficPolicy()
.endSpec()
.build();

"io.fabric8.kubernetes.client.KubernetesClientException: Namespace mismatch. Item namespace:istio-system. Operation namespace:default.

Lookup on http route in Virtualservice yaml is not working

Hello @metacosm ,

I have this yaml file:

spec:
  gateways:
  - logforwarding-gateway
  hosts:
  - '*'
  http:
  - match:
    - uri:
        exact: /onboard
    route:
    - destination:
        host: provision-service
        port:
          number: 9080
  - match:
    - headers:
        tenantid:
          exact: "coke"
    route:
    - destination:
        host: service-coke
        port:
          number: 8080

I want to do a lookup on http route with route/destination/host as service-coke and port 8080.

I wrote this code and it returned false:

Destination dst = new DestinationBuilder()
                    .withHost("service-coke")
                    .withPort(new PortSelector(new NumberPort(8080))).build();

            HTTPRouteDestination routeDst = new HTTPRouteDestinationBuilder()
                    .withDestination(dst).build();
            HTTPRoute route = new HTTPRouteBuilder().withRoute(routeDst).build();
            
boolean entryFound = istioClient.virtualService().inNamespace(istioClient.getNamespace())
                    .withName("logforwarding-virtualservice")
                    .get().getSpec().getHttp().contains(route);

I got entryFound as false.
Is this the right way to do a lookup for http route?
Thanks in advance

Need to check that all fields of classes with interfaces are taken into account

When updating Istio, it might happen that new fields are added to existing entities. If such an entity has interface fields, the corresponding entry needs to be updated in classes-with-interface-fields.yml accordingly. See #64 for example.
We, therefore, need to automate the detection of such fields so that they can be properly added.

Error parsing VirtualService object

@metacosm Hi, I have a valid Yaml file for VirtualService, which I translate to VirtualService object and send that virtual service object as Json to decorator controller, I see serialized VirtualService object have additional attribute of matchtype and that's been rejected by Istio pilot validation

logs from Metacontroller
E0819 16:51:18.506464 1 controller.go:245] failed to sync c4-service-controller "apps/v1:Deployment:r1-utility:service-test-basic": can't reconcile children for Deployment r1-utility/service-test-basic: admission webhook "pilot.valida ││ tion.istio.io" denied the request: error decoding configuration: YAML decoding error: gateways: │
│ - ilb-gateway-internal ││ hosts: ││ - ilb-gateway-. │
│ http: ││ - match: ││ - gateways: [] │
│ headers: ││ x-instanceid: ││ matchType: │
│ exact: "11343434" ││ x-serviceid: ││ matchType: │
│ exact: "123" ││ removeResponseHeaders: [] ││ retries:

Ideally this should not include match type object for http match. Any suggestion will be helpful

editMatchingHttp() is not able to find a matching http

@metacosm , editMatchingHttp() is throwing the following error when trying to remove a specific match from virtualservice yaml file.

java.lang.RuntimeException: Can't edit matching http. No match found. at me.snowdrop.istio.api.networking.v1alpha3.VirtualServiceSpecFluentImpl.editMatchingHttp(VirtualServiceSpecFluentImpl.java

Here is the sample of yaml file and the code:

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: reviews-route
  namespace: default
  resourceVersion: "2418174"
spec:
  gateways:
  - in-gateway
  hosts:
  - reviews.prod.svc.cluster.local
  http:
  - match:
    - uri:
        exact: /onboard
    - uri:
        exact: /offboard
    route:
    - destination:
        host: reviews.prod.svc.cluster.local
        port:
          number: 9080
  - match:
    - headers:
        tenantid:
          exact: coke
    route:
    - destination:
        host: service-coke
        port:
          number: 8080

In the above yaml file I am trying to remove match with headers "coke" and destionation host as "service-coke":

          Map<String, StringMatch> matchMap = new HashMap<String, StringMatch>();
           matchMap.put("tenantid", new StringMatch(new ExactMatchType("coke")));
           HTTPMatchRequest req = new HTTPMatchRequestBuilder().withHeaders(matchMap)
                   .build();

           HTTPRouteDestination dst = new HTTPRouteDestinationBuilder()
                   .withNewDestination().withHost("service-coke").endDestination().build();

           HTTPRouteBuilder builder = new HTTPRouteBuilder(new HTTPRouteBuilder()
                   .withMatch(req).withRoute(dst).build());

           istioClient.virtualService().inNamespace("default").withName("reviews-route")
                   .edit().editSpec()
                   .editMatchingHttp(r -> (r.withRoute(dst).withMatch(req) == builder))
                   .removeFromMatch(req)
                   .endHttp().endSpec().done();

Am I doing it the wrong way? Please let me know. Thanks for your help.

Bug - Bad resourceT in ServiceEntryOperationImpl class

Hi,

I am using the library with Rancher 2.0 and EKS and I am not able to create a serviceEntry or to list of serviceEntry previously created.
The resourceT in the ServiceEntryOperationImpl class is set as serviceentrys. This seems to be an issue with the plurials.

I changed to serviceentries and everything works as expected.

  public ServiceEntryOperationImpl(OkHttpClient client, Config config, String apiVersion, String namespace, String name, Boolean cascading, ServiceEntry item, String resourceVersion, Boolean reloadingFromServer, long gracePeriodSeconds, Map<String, String> labels, Map<String, String> labelsNot, Map<String, String[]> labelsIn, Map<String, String[]> labelsNotIn, Map<String, String> fields) {
    super(client, config, "networking.istio.io", apiVersion, "serviceentrys", namespace, name, cascading, item, resourceVersion, reloadingFromServer, gracePeriodSeconds, labels, labelsNot, labelsIn, labelsNotIn, fields);
  }

Upgrade Istio to 1.5.1

Hi,

I did some work to upgrade Istio version to 1.5.1. I know it is not perfect but maybe you can use it somehow. I use only model and needed AuthorizationPolicy so I added it. I have also upgraded network to v1beta1.
Link to my commit: mraszplewicz@2fff582

There were two issues while upgrading:

  1. In CorsPolicy there are both allowOrigin and allowOrigins fields - I had to change istio-schema.json manually.
  2. When I use StringMatch in allowOrigins or http.match It is trying to add matchType field in yaml. This is not a new problem - it was present also in current version.

Regards,
Maciej Raszplewicz

Error occurs when Istio Auth is enabled

I was testing whether or not the demo Spring Boot Istio application works correctly when Istio Auth is enabled.
Unfortunately I encountered the following issue when deploying the application using mvn clean package fabric8:deploy -Pistio-openshift.

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal io.fabric8:fabric8-maven-plugin:3.5.33:resource (default) on project greeting-service: Execution default of goal io.fabric8:fabric8-maven-plugin:3.5.33:resource failed: Couldn't parse Istio Mesh configuration
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default of goal io.fabric8:fabric8-maven-plugin:3.5.33:resource failed: Couldn't parse Istio Mesh configuration
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
        ... 20 more
Caused by: java.lang.IllegalArgumentException: Couldn't parse Istio Mesh configuration
        at me.snowdrop.cloud.fabric8.IstioEnricher.fetchConfigMap(IstioEnricher.java:232)
        at me.snowdrop.cloud.fabric8.IstioEnricher.addMissingResources(IstioEnricher.java:89)
        at io.fabric8.maven.plugin.enricher.EnricherManager$1.apply(EnricherManager.java:114)
        at io.fabric8.maven.plugin.enricher.EnricherManager$1.apply(EnricherManager.java:111)
        at io.fabric8.maven.plugin.enricher.EnricherManager.loop(EnricherManager.java:214)
        at io.fabric8.maven.plugin.enricher.EnricherManager.createDefaultResources(EnricherManager.java:111)
        at io.fabric8.maven.plugin.enricher.EnricherManager.createDefaultResources(EnricherManager.java:106)
        at io.fabric8.maven.plugin.mojo.build.ResourceMojo.generateAppResources(ResourceMojo.java:544)
        at io.fabric8.maven.plugin.mojo.build.ResourceMojo.generateResources(ResourceMojo.java:456)
        at io.fabric8.maven.plugin.mojo.build.ResourceMojo.executeInternal(ResourceMojo.java:264)
        at io.fabric8.maven.plugin.mojo.AbstractFabric8Mojo.execute(AbstractFabric8Mojo.java:74)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        ... 21 more
Caused by: com.fasterxml.jackson.databind.exc.InvalidFormatException: Can not construct instance of java.lang.Integer from String value ("MUTUAL_TLS"): not a valid Integer value
 at [Source: java.io.StringReader@a99c42c; line: 2, column: 13] (through reference chain: me.snowdrop.istio.api.model.v1.mesh.MeshConfig["authPolicy"])
        at com.fasterxml.jackson.databind.exc.InvalidFormatException.from(InvalidFormatException.java:74)
        at com.fasterxml.jackson.databind.DeserializationContext.weirdStringException(DeserializationContext.java:1022)
        at com.fasterxml.jackson.databind.deser.std.StdDeserializer._parseInteger(StdDeserializer.java:444)
        at com.fasterxml.jackson.databind.deser.std.NumberDeserializers$IntegerDeserializer.deserialize(NumberDeserializers.java:315)
        at com.fasterxml.jackson.databind.deser.std.NumberDeserializers$IntegerDeserializer.deserialize(NumberDeserializers.java:293)
        at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:490)
        at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:95)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:260)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:125)
        at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3807)
        at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2797)
        at me.snowdrop.cloud.fabric8.IstioEnricher.fetchConfigMap(IstioEnricher.java:228)
        ... 32 more

It seems that there is a mismatch between the Java model specified for the MeshConfig object and the actual data being used in Openshift.

When Auth is enabled, the ConfigMap that holds the Mesh configuration in Openshift looks something like the following:

apiVersion: v1
data:
  mesh: |-
    # Uncomment the following line to enable mutual TLS between proxies
    authPolicy: MUTUAL_TLS
    #
    # Edit this list to avoid using mTLS to connect to these services.
    # Typically, these are control services (e.g kubernetes API server) that don't have Istio sidecar
    # to transparently terminate mTLS authentication.
    mtlsExcludedServices: ["kubernetes.default.svc.cluster.local"]
    ...

Note that when Auth is not enabled, the line authPolicy: MUTUAL_TLS is commented out, which is why there is no mapping exception occurring in that case.

Furthermore, this seems to be the AuthenticationPolicy type definition in istio/api.

I am guessing that the Java model assumes the Golang enum would end up in the ConfigMap as an Integer, when it actually ends up as a String.

Cannot use Istio Client with versioned kubernetes client

Currently Istio resources extends from HasMetadata interface. This interface comes from io.fabric8.kubernetes.api.model. The problem is that when you want to use the versioned uberjar kubernetes client, internally the client expects that any resource implements from io.fabric8.kubernetes.api.model.v3_1.HasMetadata so obviously I got some compilation errors.

So for now the only thing I see to fix this problem is to do as kubernetes-client is doing and release one istio-api depending on kubernetes-model and another one istio-api (classsifier versioned) that uses the uber versioned thingy.

Maybe @iocanel can come with another solution, but now this is what it comes to my mind.

Not compatible with newer fabric8 kubernetes client versions

Hi,

I'm using latest version 1.1.0 and it uses the version 4.2.2 of io.fabric8.kubernetes-client.

I just upgraded my io.fabric8.kubernetes-client dependency from 4.3.1 to 4.5.2 and suddenly started to get NoClassDefFoundError for io.fabric8.kubernetes.api.builder.ValidationUtils because it's deleted one of the later versions. And all builder classes of istio-java-api uses validate method of this ValidationUtils.

Would it be possible to have a new release with a newer version of Fabric8 kubernetes client anytime soon?

Unable to deploy DestinationRule with tls mode set

Using the generic-derializer branch I am unable to deploy:

apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
  name: spring-boot-istio-routing-service
spec:
  host: spring-boot-istio-routing-service
  trafficPolicy:
    tls:
      mode: DISABLE
  subsets:
    - name: a
      labels:
        version: a
    - name: b
      labels:
        version: b

with istioClient.registerCustomResources(resourceAsStream);

The stacktrace is:

java.lang.IllegalArgumentException: Can not construct instance of me.snowdrop.istio.api.model.v1.networking.TLSmode from String value ("DISABLE"): value not one of declared Enum instance names: [SIMPLE, PASSTHROUGH, MUTUAL]
 at [Source: N/A; line: -1, column: -1] (through reference chain: me.snowdrop.istio.api.model.v1.networking.DestinationRule["trafficPolicy"]->me.snowdrop.istio.api.model.v1.networking.TrafficPolicy["tls"]->me.snowdrop.istio.api.model.v1.networking.TLSSettings["mode"])

	at com.fasterxml.jackson.databind.ObjectMapper._convert(ObjectMapper.java:3530)
	at com.fasterxml.jackson.databind.ObjectMapper.convertValue(ObjectMapper.java:3449)
	at me.snowdrop.istio.util.YAML.loadIstioResources(YAML.java:67)
	at me.snowdrop.istio.client.IstioClient.registerCustomResources(IstioClient.java:26)
	at me.snowdrop.istio.client.IstioClient.registerCustomResources(IstioClient.java:39)
	at com.example.SimpleTest.run(SimpleTest.java:25)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: com.fasterxml.jackson.databind.exc.InvalidFormatException: Can not construct instance of me.snowdrop.istio.api.model.v1.networking.TLSmode from String value ("DISABLE"): value not one of declared Enum instance names: [SIMPLE, PASSTHROUGH, MUTUAL]
 at [Source: N/A; line: -1, column: -1] (through reference chain: me.snowdrop.istio.api.model.v1.networking.DestinationRule["trafficPolicy"]->me.snowdrop.istio.api.model.v1.networking.TrafficPolicy["tls"]->me.snowdrop.istio.api.model.v1.networking.TLSSettings["mode"])
	at com.fasterxml.jackson.databind.exc.InvalidFormatException.from(InvalidFormatException.java:74)
	at com.fasterxml.jackson.databind.DeserializationContext.weirdStringException(DeserializationContext.java:1022)
	at com.fasterxml.jackson.databind.deser.std.EnumDeserializer._deserializeAltString(EnumDeserializer.java:151)
	at com.fasterxml.jackson.databind.deser.std.EnumDeserializer.deserialize(EnumDeserializer.java:96)
	at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:490)
	at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:95)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:260)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:125)
	at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:490)
	at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:95)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:260)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:125)
	at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:490)
	at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:95)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:260)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:125)
	at com.fasterxml.jackson.databind.ObjectMapper._readValue(ObjectMapper.java:3779)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2050)
	at com.fasterxml.jackson.databind.ObjectMapper.treeToValue(ObjectMapper.java:2547)
	at me.snowdrop.istio.api.internal.IstioDeserializer.getIstioSpec(IstioDeserializer.java:58)
	at me.snowdrop.istio.api.internal.IstioDeserializer.deserialize(IstioDeserializer.java:49)
	at me.snowdrop.istio.api.internal.IstioDeserializer.deserialize(IstioDeserializer.java:25)
	at com.fasterxml.jackson.databind.ObjectMapper._convert(ObjectMapper.java:3525)
	... 27 more

'Caused by: javax.net.ssl.SSLHandshakeException: Remote host terminated the handshake' and 'java.io.EOFException: SSL peer shut down incorrectly'

I config IstioClient with cluster-admin token,

    @PostConstruct
    public void SetIstioClient() {
        System.setProperty(Config.KUBERNETES_TRUST_CERT_SYSTEM_PROPERTY, k8s_cluster_trust_cert);
        System.setProperty(Config.KUBERNETES_DISABLE_HOSTNAME_VERIFICATION_SYSTEM_PROPERTY, k8s_cluster_disable_hostname_verification);
        System.setProperty(Config.KUBERNETES_MASTER_SYSTEM_PROPERTY, k8s_cluster_url);
        System.setProperty(Config.KUBERNETES_OAUTH_TOKEN_SYSTEM_PROPERTY, k8s_cluster_serviceaccount_token);
        config = new ConfigBuilder().build();
        istioClient = new DefaultIstioClient(config);
    }

I run my app locally in IDEA spring boot is OK, but when I put it in Kubernetes pod, It come out this problems

[2019-07-31 21:32:40,613][TRACE:http-nio-8080-exec-6][AbstractBeanFactory.java:254] Returning cached instance of singleton bean 'gatewayController'
[2019-07-31 21:32:40,613][TRACE:http-nio-8080-exec-6][AbstractHandlerMapping.java:417] Mapped to public com.authine.lateinos.svc.ResponseResult<me.snowdrop.istio.api.networking.v1alpha3.Gateway> com.authine.lateinos.kube.api.controller.GatewayController.get(java.lang.String,java.lang.String,com.authine.lateinos.kube.api.model.ReqOption)
[2019-07-31 21:32:40,614][TRACE:http-nio-8080-exec-6][LogFormatUtils.java:88] Read "application/json;charset=UTF-8" to [com.authine.lateinos.kube.api.model.ReqOption@4748dedd]
[2019-07-31 21:32:40,614][TRACE:http-nio-8080-exec-6][InvocableHandlerMethod.java:136] Arguments: [istio-bookinfo, bookinfo-gateway, com.authine.lateinos.kube.api.model.ReqOption@4748dedd]
[2019-07-31 21:32:40,624][TRACE:http-nio-8080-exec-6][AbstractBeanFactory.java:254] Returning cached instance of singleton bean 'customControllerAdvice'
[2019-07-31 21:32:40,624][DEBUG:http-nio-8080-exec-6][ExceptionHandlerExceptionResolver.java:403] Using @ExceptionHandler public com.authine.lateinos.svc.ResponseResult<java.lang.Object> com.authine.lateinos.container.handler.CustomControllerAdvice.handle(java.lang.Throwable)
[2019-07-31 21:32:40,625][TRACE:http-nio-8080-exec-6][InvocableHandlerMethod.java:136] Arguments: [io.fabric8.kubernetes.client.KubernetesClientException: Operation: [get]  for kind: [Gateway]  with name: [bookinfo-gateway]  in namespace: [istio-bookinfo]  failed.]
[2019-07-31 21:32:40,625][INFO :http-nio-8080-exec-6][CustomControllerAdvice.java:59] Operation: [get]  for kind: [Gateway]  with name: [bookinfo-gateway]  in namespace: [istio-bookinfo]  failed.
io.fabric8.kubernetes.client.KubernetesClientException: Operation: [get]  for kind: [Gateway]  with name: [bookinfo-gateway]  in namespace: [istio-bookinfo]  failed.
	at io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:64)
	at io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:72)
	at io.fabric8.kubernetes.client.dsl.base.BaseOperation.getMandatory(BaseOperation.java:229)
	at io.fabric8.kubernetes.client.dsl.base.BaseOperation.get(BaseOperation.java:162)
	at com.authine.lateinos.kube.api.service.impl.GatewayCtrl.getGateway(GatewayCtrl.java:29)
	at com.authine.lateinos.kube.api.service.impl.GatewayServiceImpl.getGateway(GatewayServiceImpl.java:23)
	at com.authine.lateinos.kube.api.controller.GatewayController.get(GatewayController.java:65)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:892)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797)
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1039)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005)
	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:908)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:200)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:836)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1747)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: javax.net.ssl.SSLHandshakeException: Remote host terminated the handshake
	at java.base/sun.security.ssl.SSLSocketImpl.handleEOF(SSLSocketImpl.java:1321)
	at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1160)
	at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1063)
	at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:402)
	at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.java:319)
	at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.java:283)
	at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:168)
	at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:257)
	at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:135)
	at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:114)
	at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:126)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at io.fabric8.kubernetes.client.utils.BackwardsCompatibilityInterceptor.intercept(BackwardsCompatibilityInterceptor.java:119)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at io.fabric8.kubernetes.client.utils.ImpersonatorInterceptor.intercept(ImpersonatorInterceptor.java:68)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at io.fabric8.kubernetes.client.utils.HttpClientUtils.lambda$createHttpClient$1(HttpClientUtils.java:100)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:254)
	at okhttp3.RealCall.execute(RealCall.java:92)
	at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:404)
	at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:365)
	at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleGet(OperationSupport.java:330)
	at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleGet(OperationSupport.java:311)
	at io.fabric8.kubernetes.client.dsl.base.BaseOperation.handleGet(BaseOperation.java:810)
	at io.fabric8.kubernetes.client.dsl.base.BaseOperation.getMandatory(BaseOperation.java:218)
	... 58 more
Caused by: java.io.EOFException: SSL peer shut down incorrectly
	at java.base/sun.security.ssl.SSLSocketInputRecord.decode(SSLSocketInputRecord.java:167)
	at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:108)
	at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1152)
	... 94 more
[2019-07-31 21:32:40,631][DEBUG:http-nio-8080-exec-6][AbstractMessageConverterMethodProcessor.java:268] Using 'application/json', given [*/*] and supported [application/json, application/*+json, application/json, application/*+json]
[2019-07-31 21:32:40,631][TRACE:http-nio-8080-exec-6][AbstractBeanFactory.java:254] Returning cached instance of singleton bean 'customControllerAdvice'

Conflicting ResourceHandler when two different object kinds exist

When trying to load Istio resources from a yaml file that contains an Istio Policy I will receive a following exception:
java.lang.ClassCastException: me.snowdrop.istio.api.authentication.v1alpha1.Policy cannot be cast to io.fabric8.openshift.api.model.v4_0.Policy

Links to this issue.

Add support to create "metric" as a istio resource

When I try to create a metric as in https://github.com/anmolbabu/hdd-istio-java-poc,
it fails with the following error:

java.lang.IllegalArgumentException: metric is not a known Istio resource.
at me.snowdrop.istio.client.IstioClient.registerCustomResources(IstioClient.java:50)
at me.snowdrop.istio.client.IstioClient.registerCustomResources(IstioClient.java:72)
at org.osio.hdd.istio.com.App.main(App.java:44)

On some debugging, I found that it was failing at:
https://github.com/snowdrop/istio-java-api/blob/master/istio-common/src/main/java/me/snowdrop/istio/api/internal/IstioSpecRegistry.java#L78 as it seems from https://github.com/snowdrop/istio-java-api/blob/master/istio-common/src/main/java/me/snowdrop/istio/api/internal/IstioSpecRegistry.java#L45-L47 that the type "metric" is not supported.

Note: The metric I am trying to create is the same as in the istio tutorial @ https://github.com/redhat-developer-demos/istio-tutorial#custom-metrics

In Virtualservice how to append new match rule

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:

  • logforwarding-gateway
    hosts:
  • reviews.prod.svc.cluster.local
    http:
  • match:
    • uri:
      exact: /onboard
    • uri:
      exact: /offboard
      route:
    • destination:
      host: reviews.prod.svc.cluster.local
      port:
      number: 9080
  • match:
    • headers:
      tenantid:
      exact: hello-901
      route:
    • destination:
      host: service-hello-901
      port:
      number: 8080
      **- match:
    • headers:
      tenantid:
      exact: coke
      route:
    • destination:
      host: service-coke
      port:
      number: 8080**

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();

        Map<String, StringMatch> matchMap1 = new HashMap<String, StringMatch>();
        matchMap1.put("tenantid", new StringMatch(new ExactMatchType("coke")));
        istioClient.virtualService().withName("reviews-route").edit().editSpec()
                .addNewHttp()
                .addNewMatch().withHeaders(matchMap1).endMatch()
                .addNewRoute()
                .withNewDestination().withHost("service-"+"coke").withNewPort().withNewNumberPort(8080).endPort()
                .endDestination()
                .endRoute()
                .endHttp()
                .endSpec()
                .done();`

Error parsing Policy YAML

When attempting to parse the following:

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  creationTimestamp: null
  name: recommendation
  namespace: tutorial
spec:
  hosts:
  - recommendation
  http:
  - match:
    - headers:
        baggage-user-agent:
          regex: .*DarkLaunch.*
    route:
    - destination:
        host: recommendation
        subset: version-v2
  - route:
    - destination:
        host: recommendation
        subset: version-v1

via mapper.readValue(inputStream, VirtualService.class) we get the following error: https://gist.github.com/geoand/98395a190f83949407305ef6bed8f868

Update metadata generation for new Istio file layout

Previous Istio install used Helm charts that we were relying on to get CRD information. These charts don't exist anymore so we need to use something else instead: the CRD information automatically generated that exists in the API project under /kubernetes/customresourcedefinitions.gen.yaml.

make 'strict' failed : Unknown interfaces, Unvisited packages, Unvisited CRDs

Istio Version=1.1.8

[creasy:~/go-workspace/src/istio.io/istio] 145b18a44 15s ± git status
HEAD detached at 1.1.8
nothing to commit, working tree clean

Istio Api Version=release-1.1

[creasy:~/go-workspace/src/istio.io/api] release-1.1 2m45s ± git status
On branch release-1.1

make crd ( I changed oc to kubectl in Makefile ):

[creasy:~/go-workspace … /github.com/snowdrop/istio-java-api] master(+41/-5273) 34m6s 2 ± make crd
kubectl get crd -o=jsonpath="{range .items[*]}{.spec.names.kind}={.metadata.name}| istio={.metadata.labels.istio}| version={.spec.version}{'\n'}{end}" |grep istio.io > /home/creasy/go-workspace/src/github.com/snowdrop/istio-java-api/istio-common/src/main/resources/istio-crd.properties

$ cat /home/creasy/go-workspace/src/github.com/snowdrop/istio-java-api/istio-common/src/main/resources/istio-crd.properties
adapter=adapters.config.istio.io| istio=rbac| version=v1alpha2
apikey=apikeys.config.istio.io| istio=mixer-instance| version=v1alpha2
attributemanifest=attributemanifests.config.istio.io| istio=core| version=v1alpha2
authorization=authorizations.config.istio.io| istio=mixer-instance| version=v1alpha2
bypass=bypasses.config.istio.io| istio=mixer-adapter| version=v1alpha2
checknothing=checknothings.config.istio.io| istio=mixer-instance| version=v1alpha2
circonus=circonuses.config.istio.io| istio=mixer-adapter| version=v1alpha2
cloudwatch=cloudwatches.config.istio.io| istio=mixer-adapter| version=v1alpha2
ClusterRbacConfig=clusterrbacconfigs.rbac.istio.io| istio=rbac| version=v1alpha1
denier=deniers.config.istio.io| istio=mixer-adapter| version=v1alpha2
DestinationRule=destinationrules.networking.istio.io| istio=| version=v1alpha3
dogstatsd=dogstatsds.config.istio.io| istio=mixer-adapter| version=v1alpha2
edge=edges.config.istio.io| istio=mixer-instance| version=v1alpha2
EnvoyFilter=envoyfilters.networking.istio.io| istio=| version=v1alpha3
fluentd=fluentds.config.istio.io| istio=mixer-adapter| version=v1alpha2
Gateway=gateways.networking.istio.io| istio=| version=v1alpha3
handler=handlers.config.istio.io| istio=mixer-handler| version=v1alpha2
HTTPAPISpecBinding=httpapispecbindings.config.istio.io| istio=| version=v1alpha2
HTTPAPISpec=httpapispecs.config.istio.io| istio=| version=v1alpha2
instance=instances.config.istio.io| istio=mixer-instance| version=v1alpha2
kubernetesenv=kubernetesenvs.config.istio.io| istio=mixer-adapter| version=v1alpha2
kubernetes=kuberneteses.config.istio.io| istio=mixer-instance| version=v1alpha2
listchecker=listcheckers.config.istio.io| istio=mixer-adapter| version=v1alpha2
listentry=listentries.config.istio.io| istio=mixer-instance| version=v1alpha2
logentry=logentries.config.istio.io| istio=mixer-instance| version=v1alpha2
memquota=memquotas.config.istio.io| istio=mixer-adapter| version=v1alpha2
MeshPolicy=meshpolicies.authentication.istio.io| istio=| version=v1alpha1
metric=metrics.config.istio.io| istio=mixer-instance| version=v1alpha2
noop=noops.config.istio.io| istio=mixer-adapter| version=v1alpha2
opa=opas.config.istio.io| istio=mixer-adapter| version=v1alpha2
Policy=policies.authentication.istio.io| istio=| version=v1alpha1
prometheus=prometheuses.config.istio.io| istio=mixer-adapter| version=v1alpha2
quota=quotas.config.istio.io| istio=mixer-instance| version=v1alpha2
QuotaSpecBinding=quotaspecbindings.config.istio.io| istio=| version=v1alpha2
QuotaSpec=quotaspecs.config.istio.io| istio=| version=v1alpha2
RbacConfig=rbacconfigs.rbac.istio.io| istio=rbac| version=v1alpha1
rbac=rbacs.config.istio.io| istio=mixer-adapter| version=v1alpha2
redisquota=redisquotas.config.istio.io| istio=mixer-adapter| version=v1alpha2
reportnothing=reportnothings.config.istio.io| istio=mixer-instance| version=v1alpha2
rule=rules.config.istio.io| istio=core| version=v1alpha2
servicecontrolreport=servicecontrolreports.config.istio.io| istio=mixer-instance| version=v1alpha2
servicecontrol=servicecontrols.config.istio.io| istio=mixer-adapter| version=v1alpha2
ServiceEntry=serviceentries.networking.istio.io| istio=| version=v1alpha3
ServiceRoleBinding=servicerolebindings.rbac.istio.io| istio=rbac| version=v1alpha1
ServiceRole=serviceroles.rbac.istio.io| istio=rbac| version=v1alpha1
Sidecar=sidecars.networking.istio.io| istio=| version=v1alpha3
signalfx=signalfxs.config.istio.io| istio=mixer-adapter| version=v1alpha2
solarwinds=solarwindses.config.istio.io| istio=mixer-adapter| version=v1alpha2
stackdriver=stackdrivers.config.istio.io| istio=mixer-adapter| version=v1alpha2
statsd=statsds.config.istio.io| istio=mixer-adapter| version=v1alpha2
stdio=stdios.config.istio.io| istio=mixer-adapter| version=v1alpha2
template=templates.config.istio.io| istio=mixer-template| version=v1alpha2
tracespan=tracespans.config.istio.io| istio=mixer-instance| version=v1alpha2
VirtualService=virtualservices.networking.istio.io| istio=| version=v1alpha3
zipkin=zipkins.config.istio.io| istio=mixer-adapter| version=v1alpha2

make packages:

[creasy:~/go-workspace … /github.com/snowdrop/istio-java-api] master(+41/-5273) 45m21s ± make packages
./scripts/generate_package_info.sh

[creasy:~/go-workspace … /github.com/snowdrop/istio-java-api] master(+41/-5273) 45m49s ± cat istio-common/src/main/resources/packages.csv
github.com/golang/protobuf/ptypes/duration       ,me.snowdrop.istio.api                         ,protobuf_duration_
github.com/gogo/protobuf/types                   ,me.snowdrop.istio.api                         ,protobuf_types_
github.com/golang/protobuf/ptypes/any            ,me.snowdrop.istio.api                         ,protobuf_any_
github.com/gogo/googleapis/google/rpc            ,me.snowdrop.istio.api                         ,google_rpc_
## END MANUAL DEFINITIONS
# api
istio.io/api/authentication/v1alpha1,me.snowdrop.istio.api.authentication.v1alpha1,istio_authentication_v1alpha1_
istio.io/api/mcp/v1alpha1,me.snowdrop.istio.api.mcp.v1alpha1,istio_mcp_v1alpha1_
istio.io/api/mesh/v1alpha1,me.snowdrop.istio.api.mesh.v1alpha1,istio_mesh_v1alpha1_
istio.io/api/mixer/v1,me.snowdrop.istio.api.mixer.v1,istio_mixer_v1_
istio.io/api/networking/v1alpha3,me.snowdrop.istio.api.networking.v1alpha3,istio_networking_v1alpha3_
istio.io/api/policy/v1beta1,me.snowdrop.istio.api.policy.v1beta1,istio_policy_v1beta1_
istio.io/api/rbac/v1alpha1,me.snowdrop.istio.api.rbac.v1alpha1,istio_rbac_v1alpha1_
# adapter
istio.io/istio/mixer/adapter/bypass/config,me.snowdrop.istio.mixer.adapter.bypass,istio_adapter_bypass_
istio.io/istio/mixer/adapter/circonus/config,me.snowdrop.istio.mixer.adapter.circonus,istio_adapter_circonus_
istio.io/istio/mixer/adapter/cloudwatch/config,me.snowdrop.istio.mixer.adapter.cloudwatch,istio_adapter_cloudwatch_
istio.io/istio/mixer/adapter/denier/config,me.snowdrop.istio.mixer.adapter.denier,istio_adapter_denier_
istio.io/istio/mixer/adapter/dogstatsd/config,me.snowdrop.istio.mixer.adapter.dogstatsd,istio_adapter_dogstatsd_
istio.io/istio/mixer/adapter/fluentd/config,me.snowdrop.istio.mixer.adapter.fluentd,istio_adapter_fluentd_
istio.io/istio/mixer/adapter/kubernetesenv/config,me.snowdrop.istio.mixer.adapter.kubernetesenv,istio_adapter_kubernetesenv_
istio.io/istio/mixer/adapter/list/config,me.snowdrop.istio.mixer.adapter.list,istio_adapter_list_
istio.io/istio/mixer/adapter/memquota/config,me.snowdrop.istio.mixer.adapter.memquota,istio_adapter_memquota_
istio.io/istio/mixer/adapter/opa/config,me.snowdrop.istio.mixer.adapter.opa,istio_adapter_opa_
istio.io/istio/mixer/adapter/prometheus/config,me.snowdrop.istio.mixer.adapter.prometheus,istio_adapter_prometheus_
istio.io/istio/mixer/adapter/rbac/config,me.snowdrop.istio.mixer.adapter.rbac,istio_adapter_rbac_
istio.io/istio/mixer/adapter/redisquota/config,me.snowdrop.istio.mixer.adapter.redisquota,istio_adapter_redisquota_
istio.io/istio/mixer/adapter/signalfx/config,me.snowdrop.istio.mixer.adapter.signalfx,istio_adapter_signalfx_
istio.io/istio/mixer/adapter/solarwinds/config,me.snowdrop.istio.mixer.adapter.solarwinds,istio_adapter_solarwinds_
istio.io/istio/mixer/adapter/stackdriver/config,me.snowdrop.istio.mixer.adapter.stackdriver,istio_adapter_stackdriver_
istio.io/istio/mixer/adapter/statsd/config,me.snowdrop.istio.mixer.adapter.statsd,istio_adapter_statsd_
istio.io/istio/mixer/adapter/stdio/config,me.snowdrop.istio.mixer.adapter.stdio,istio_adapter_stdio_
istio.io/istio/mixer/adapter/zipkin/config,me.snowdrop.istio.mixer.adapter.zipkin,istio_adapter_zipkin_
# template
istio.io/istio/mixer/template/apikey,me.snowdrop.istio.mixer.template.apikey,istio_mixer_apikey_
istio.io/istio/mixer/template/authorization,me.snowdrop.istio.mixer.template.authorization,istio_mixer_authorization_
istio.io/istio/mixer/template/checknothing,me.snowdrop.istio.mixer.template.checknothing,istio_mixer_checknothing_
istio.io/istio/mixer/template/edge,me.snowdrop.istio.mixer.template.edge,istio_mixer_edge_
istio.io/istio/mixer/template/listentry,me.snowdrop.istio.mixer.template.listentry,istio_mixer_listentry_
istio.io/istio/mixer/template/logentry,me.snowdrop.istio.mixer.template.logentry,istio_mixer_logentry_
istio.io/istio/mixer/template/metric,me.snowdrop.istio.mixer.template.metric,istio_mixer_metric_
istio.io/istio/mixer/template/quota,me.snowdrop.istio.mixer.template.quota,istio_mixer_quota_
istio.io/istio/mixer/template/reportnothing,me.snowdrop.istio.mixer.template.reportnothing,istio_mixer_reportnothing_
istio.io/istio/mixer/template/sample,me.snowdrop.istio.mixer.template.sample,istio_mixer_sample_
istio.io/istio/mixer/template/tracespan,me.snowdrop.istio.mixer.template.tracespan,istio_mixer_tracespan_

classes-with-interface-fields.yml

[creasy:~/go-workspace … /github.com/snowdrop/istio-java-api] master(+41/-5273) 58m17s ± cat istio-common/src/main/resources/classes-with-interface-fields.yml 
# Currently ignored interfaces (or mapped to TypedValue):
# isAttributes_AttributeValue_Value field value in istio.io/api/mixer/v1/Attributes_AttributeValue
# isValue_Kind field kind in github.com/gogo/protobuf/types/Value
# isValue_Value field value in istio.io/api/policy/v1beta1/Value
classes:
  - class: me.snowdrop.istio.api.networking.v1alpha3.Abort
    fields:
      percent: integer
      grpcStatus: isHTTPFaultInjection_Abort_ErrorType
      httpStatus: isHTTPFaultInjection_Abort_ErrorType
      http2Error: isHTTPFaultInjection_Abort_ErrorType
      percentage: me.snowdrop.istio.api.networking.v1alpha3.Percent
  - class: me.snowdrop.istio.api.networking.v1alpha3.Delay
    fields:
      percent: integer
      exponentialDelay: isHTTPFaultInjection_Delay_HttpDelayType
      fixedDelay: isHTTPFaultInjection_Delay_HttpDelayType
  - class: me.snowdrop.istio.api.networking.v1alpha3.LoadBalancerSettings
    fields:
      simple: isLoadBalancerSettings_LbPolicy
      consitentHash: isLoadBalancerSettings_LbPolicy
  - class: me.snowdrop.istio.api.networking.v1alpha3.PortSelector
    fields:
      name: isPortSelector_Port
      number: isPortSelector_Port
  - class: me.snowdrop.istio.api.authentication.v1alpha1.PortSelector
    fields:
      name: isPortSelector_Port
      number: isPortSelector_Port
  - class: me.snowdrop.istio.api.networking.v1alpha3.StringMatch
    fields:
      exact: isStringMatch_MatchType
      prefix: isStringMatch_MatchType
      regex: isStringMatch_MatchType
  - class: me.snowdrop.istio.api.networking.v1alpha3.ConsistentHashLB
    fields:
      httpHeaderName: isLoadBalancerSettings_ConsistentHashLB_HashKey
      httpCookie: isLoadBalancerSettings_ConsistentHashLB_HashKey
      minimumRingSize: integer
      useSourceIp: isLoadBalancerSettings_ConsistentHashLB_HashKey
  - class: me.snowdrop.istio.api.authentication.v1alpha1.PeerAuthenticationMethod
    fields:
      jwt: isPeerAuthenticationMethod_Params
      mtls: isPeerAuthenticationMethod_Params
  - class: me.snowdrop.istio.mixer.adapter.prometheus.BucketsDefinition
    fields:
      explicitBuckets: isParams_MetricInfo_BucketsDefinition_Definition
      exponentialBuckets: isParams_MetricInfo_BucketsDefinition_Definition
      linearBuckets: isParams_MetricInfo_BucketsDefinition_Definition
  - class: me.snowdrop.istio.mixer.adapter.stackdriver.BucketsDefinition
    fields:
      explicitBuckets: isParams_MetricInfo_BucketsDefinition_Definition
      exponentialBuckets: isParams_MetricInfo_BucketsDefinition_Definition
      linearBuckets: isParams_MetricInfo_BucketsDefinition_Definition
  - class: me.snowdrop.istio.mixer.adapter.stackdriver.Stackdriver
    fields:
      endpoint: string
      projectId: string
      pushInterval: me.snowdrop.istio.api.Duration
      appCredentials: isParams_Creds
      apiKey: isParams_Creds
      serviceAccountPath: isParams_Creds
      metricInfo: map<String,MetricInfo>
      logInfo: map<String,LogInfo>
      trace: me.snowdrop.istio.mixer.adapter.stackdriver.Trace
  - class: me.snowdrop.istio.api.mesh.v1alpha1.Tracing
    fields:
      zipkin: isTracing_Tracer
      lightstep: isTracing_Tracer
      datadog: isTracing_Tracer
  - class: me.snowdrop.istio.api.authentication.v1alpha1.StringMatch
    fields:
      exact: isStringMatch_MatchType
      prefix: isStringMatch_MatchType
      regex: isStringMatch_MatchType
      suffix: isStringMatch_MatchType

make strict:

[creasy:~/go-workspace … /github.com/snowdrop/istio-java-api] master(+41/-5273) 46m47s ± make strict
go run ./cmd/generate/generate.go -strict > /home/creasy/go-workspace/src/github.com/snowdrop/istio-java-api/istio-model/src/main/resources/schema/istio-schema.json


Unknown interfaces:
isAttributes_AttributeValue_Value field value in istio.io/api/mixer/v1/Attributes_AttributeValue
isValue_Kind field kind in github.com/gogo/protobuf/types/Value
isValue_Value field value in istio.io/api/policy/v1beta1/Value

Unvisited packages:
istio.io/api/mcp/v1alpha1

Unvisited CRDs:
adapter: rbac
attributemanifest: core
clusterrbacconfig: rbac
handler: mixer-handler
httpapispec: 
httpapispecbinding: 
instance: mixer-instance
kubernetes: mixer-instance
listchecker: mixer-adapter
meshpolicy: 
noop: mixer-adapter
quotaspec: 
quotaspecbinding: 
servicecontrol: mixer-adapter
servicecontrolreport: mixer-instance
template: mixer-template

exit status 1
Makefile:27: recipe for target 'strict' failed
make: *** [strict] Error 1

Unable to delete custom resources

When running some Istio tests, I ran into an issue where I can't seem to delete custom resources.

The custom resources being used are VirtualService, Gateway and DestinationRule and while debugging the IstioClient does return true when deleteCustomResources is called, although no actual deletion is being performed.

I should add that deleting the resources from the command line does work for me (oc delete gateway client-gateway) and I testing against Openshift 3.10 and Istio 1.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.