Snowdrop :: Istio Java API :: Model Annotator

An Istio Java API generated from the Go API

License

License

GroupId

GroupId

me.snowdrop
ArtifactId

ArtifactId

istio-model-annotator
Last Version

Last Version

1.7.7.1
Release Date

Release Date

Type

Type

jar
Description

Description

Snowdrop :: Istio Java API :: Model Annotator
An Istio Java API generated from the Go API
Project URL

Project URL

http://www.snowdrop.me/istio-model-annotator
Project Organization

Project Organization

Red Hat

Download istio-model-annotator

How to add to project

<!-- https://jarcasting.com/artifacts/me.snowdrop/istio-model-annotator/ -->
<dependency>
    <groupId>me.snowdrop</groupId>
    <artifactId>istio-model-annotator</artifactId>
    <version>1.7.7.1</version>
</dependency>
// https://jarcasting.com/artifacts/me.snowdrop/istio-model-annotator/
implementation 'me.snowdrop:istio-model-annotator:1.7.7.1'
// https://jarcasting.com/artifacts/me.snowdrop/istio-model-annotator/
implementation ("me.snowdrop:istio-model-annotator:1.7.7.1")
'me.snowdrop:istio-model-annotator:jar:1.7.7.1'
<dependency org="me.snowdrop" name="istio-model-annotator" rev="1.7.7.1">
  <artifact name="istio-model-annotator" type="jar" />
</dependency>
@Grapes(
@Grab(group='me.snowdrop', module='istio-model-annotator', version='1.7.7.1')
)
libraryDependencies += "me.snowdrop" % "istio-model-annotator" % "1.7.7.1"
[me.snowdrop/istio-model-annotator "1.7.7.1"]

Dependencies

compile (6)

Group / Artifact Type Version
me.snowdrop : istio-common jar 1.7.7.1
io.sundr : builder-annotations jar 0.21.0
io.sundr : transform-annotations jar 0.21.0
org.jsonschema2pojo : jsonschema2pojo-core jar 1.0.2
org.projectlombok : lombok jar 1.18.2
io.fabric8 : kubernetes-model-common jar 5.1.0

Project Modules

There are no modules declared in this project.

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.

me.snowdrop

Snowdrop

Home of Snowdrop

Versions

Version
1.7.7.1
1.7.7
1.7.5-Beta2
1.7.5-Beta1
1.7.3-Alpha2
1.6.14
1.6.5-Beta6
1.6.5-Beta5
1.6.5-Beta4
1.6.5-Beta3
1.6.5-Beta2
1.6.3-Beta1
1.6.2-Alpha1
1.5.5
1.5.4-Alpha1
1.1.1
1.1.0
1.1.0-Beta5
1.1.0-Beta4
1.1.0-Beta3
1.1.0-Beta2
1.1.0-Beta1
1.1.0-Alpha1
1.0.1
1.0.0
1.0.0.Beta4
1.0.0.Beta3
1.0.0.Beta2
1.0.0.Beta1
1.0.0.Alpha2
1.0.0.Alpha1
0.13
0.12
0.11
0.10
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1