Closed habibali95 closed 4 years ago
I had the same issue in a web app deployed in Open Liberty. What I found was that Yaml class was building the list of known kinds by scanning the app classpath. This approach didn't work in my environment resulting in an empty list.
My workaround was to get an instance of Snake Yaml class and load the file using the "loadas" method.
org.yaml.snakeyaml.Yaml yaml = Yaml.getSnakeYaml(); Reader reader = new FileReader(yamlFileName); (V1Role) yaml.loadAs(reader, V1Role.class)
Not ideal by far since it allows only a single object of a known kind in the file but it got me over the roadblock. Would be interesting to see if anyone can recommend a better solution.
Yeah the code is here:
Depending on your classpath, it may not work correctly.
You can manually add kind information using Yaml.addModelMap(...)
or you can pass the type in explicitly as was shown in the previous comment.
Thanks everyone
Greetings,
I'm trying to load a yaml file and this exception occurs :
10:01:56,848 ERROR [stderr] (Thread-100) java.io.IOException: Unknown apiVersionKind: v1/Pod known kinds are: {} 10:01:56,848 ERROR [stderr] (Thread-100) at io.kubernetes.client.util.Yaml.modelMapper(Yaml.java:491) 10:01:56,849 ERROR [stderr] (Thread-100) at io.kubernetes.client.util.Yaml.load(Yaml.java:185) 10:01:56,850 ERROR [stderr] (Thread-100) at io.kubernetes.client.util.Yaml.load(Yaml.java:173)
I've tried my other kinds and always the same problem.
I'm using version 6.0.1. The app is deployed using WildFly 12. this is the line of code to load the file
Object config = Yaml.load(new File(yamlFile));