Skip to content

Commit fe7d99b

Browse files
committed
add CRD status validation
rename artifact add README
1 parent 784dc8a commit fe7d99b

File tree

4 files changed

+45
-2
lines changed

4 files changed

+45
-2
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Cert-Manager Model Classes
2+
This module contains the Java model classes generated from the release version of [cert-manager](https://cert-manager.io) CRDs.
3+
4+
It makes it possible to CRUD custom resources defined by `cert-manager` in a strong-typed manner in your Java application, such as create an issuer, request a certificate, etc.
5+
## Usage
6+
To use this library, include the following maven dependency
7+
```xml
8+
<dependency>
9+
<groupId>io.kubernetes</groupId>
10+
<artifactId>client-java-cert-manager-models</artifactId>
11+
<version>0.16.1-SNAPSHOT</version>
12+
</dependency>
13+
```
14+
Please refer to the [CertManagerExample](../../examples/src/main/java/io/kubernetes/client/examples/CertManagerExample.java), which demonstrates how to create a self signed issuer using the model class and Kubernetes Java client generic API.
15+
## Compatibility
16+
Artifact Version|Cert-Manager Release Version|CRD Source
17+
----------------|----------------------------|----------
18+
0.16.1-SNAPSHOT|0.16.1|[Here](https://github.com/jetstack/cert-manager/releases/download/v0.16.1/cert-manager.crds.yaml)
19+
## Code Generation
20+
There is a utility script [update.sh](update.sh) to help with the code generation.
21+
22+
* The only prerequisites required is Docker installed on the host
23+
24+
Under the `cert-manager` directory, execute:
25+
```shell script
26+
./update.sh
27+
```
28+
It will generate the model classes from the CRDs hosted at the URL specified via the `-u` option in the [update.sh](update.sh) script. If newer version of CRDs becomes available, just update the `-u` option accordingly.

client-java-contrib/cert-manager/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
22
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
33
<modelVersion>4.0.0</modelVersion>
4-
<artifactId>cert-manager</artifactId>
4+
<artifactId>client-java-cert-manager-models</artifactId>
55
<name>cert-manager-models</name>
66
<url>https://github.com/kubernetes-client/java</url>
77
<parent>

client-java-contrib/generate.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,21 @@ kubectl apply -f "${CRD_URL}"
4949
sleep 5
5050
kubectl get --raw="/openapi/v2" > /tmp/swagger
5151

52+
echo "Verifying CRD installation.."
53+
kubectl get crd -o name \
54+
| while read L
55+
do
56+
if [[ $(kubectl get $L -o jsonpath='{.status.conditions[?(@.type=="NonStructuralSchema")].status}') == "True" ]]; then
57+
echo "$L failed publishing openapi schema because it's attached non-structral-schema condition."
58+
exit 1
59+
fi
60+
if [[ $(kubectl get $L -o jsonpath='{.preserveUnknownFields}') == "true" ]]; then
61+
echo "$L failed publishing openapi schema because it explicitly disabled unknown fields pruning."
62+
exit 1
63+
fi
64+
echo "$L successfully installed"
65+
done
66+
5267
# destroy the KinD cluster
5368
kind delete cluster
5469

examples/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
</dependency>
4848
<dependency>
4949
<groupId>io.kubernetes</groupId>
50-
<artifactId>cert-manager</artifactId>
50+
<artifactId>client-java-cert-manager-models</artifactId>
5151
<version>0.16.1-SNAPSHOT</version>
5252
</dependency>
5353
<!-- test dependencies -->

0 commit comments

Comments
 (0)