snowdrop / istio-java-api

A Java API to generate Istio descriptors, inspired by Fabric8's kubernetes-model.
Apache License 2.0
112 stars 33 forks source link

Unable to deploy policy #37

Closed geoand closed 5 years ago

geoand commented 5 years ago

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
metacosm commented 5 years ago

Should be fixed now.

geoand commented 5 years ago

Indeed problem solved, thanks @metacosm !