Skip to content

Commit

Permalink
add CRD status validation
Browse files Browse the repository at this point in the history
rename artifact
add README
  • Loading branch information
simingweng committed Aug 19, 2020
1 parent 784dc8a commit fe7d99b
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 2 deletions.
28 changes: 28 additions & 0 deletions client-java-contrib/cert-manager/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Cert-Manager Model Classes
This module contains the Java model classes generated from the release version of [cert-manager](https://cert-manager.io) CRDs.

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.
## Usage
To use this library, include the following maven dependency
```xml
<dependency>
<groupId>io.kubernetes</groupId>
<artifactId>client-java-cert-manager-models</artifactId>
<version>0.16.1-SNAPSHOT</version>
</dependency>
```
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.
## Compatibility
Artifact Version|Cert-Manager Release Version|CRD Source
----------------|----------------------------|----------
0.16.1-SNAPSHOT|0.16.1|[Here](https://github.com/jetstack/cert-manager/releases/download/v0.16.1/cert-manager.crds.yaml)
## Code Generation
There is a utility script [update.sh](update.sh) to help with the code generation.

* The only prerequisites required is Docker installed on the host

Under the `cert-manager` directory, execute:
```shell script
./update.sh
```
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.
2 changes: 1 addition & 1 deletion client-java-contrib/cert-manager/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>cert-manager</artifactId>
<artifactId>client-java-cert-manager-models</artifactId>
<name>cert-manager-models</name>
<url>https://github.com/kubernetes-client/java</url>
<parent>
Expand Down
15 changes: 15 additions & 0 deletions client-java-contrib/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,21 @@ kubectl apply -f "${CRD_URL}"
sleep 5
kubectl get --raw="/openapi/v2" > /tmp/swagger

echo "Verifying CRD installation.."
kubectl get crd -o name \
| while read L
do
if [[ $(kubectl get $L -o jsonpath='{.status.conditions[?(@.type=="NonStructuralSchema")].status}') == "True" ]]; then
echo "$L failed publishing openapi schema because it's attached non-structral-schema condition."
exit 1
fi
if [[ $(kubectl get $L -o jsonpath='{.preserveUnknownFields}') == "true" ]]; then
echo "$L failed publishing openapi schema because it explicitly disabled unknown fields pruning."
exit 1
fi
echo "$L successfully installed"
done

# destroy the KinD cluster
kind delete cluster

Expand Down
2 changes: 1 addition & 1 deletion examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
</dependency>
<dependency>
<groupId>io.kubernetes</groupId>
<artifactId>cert-manager</artifactId>
<artifactId>client-java-cert-manager-models</artifactId>
<version>0.16.1-SNAPSHOT</version>
</dependency>
<!-- test dependencies -->
Expand Down

0 comments on commit fe7d99b

Please sign in to comment.