dekorateio / dekorate

Tools for generating Kubernetes related manifests.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Certmanager annotation config fails missing name

aureamunoz opened this issue · comments

The annotation config for certmanager module doesnt work.

Use the Spring boot cert manager example for reproducing:

1 - Comment out the cert manager configuration in the application.properties file:

#dekorate.certificate.secret-name=tls-secret
#dekorate.certificate.dnsNames=kubernetes-example.com,localhost
#dekorate.certificate.self-signed.enabled=true
#dekorate.certificate.subject.organizations=Dekorate,Community
#dekorate.certificate.duration=2160h0m0s
#dekorate.certificate.renewBefore=360h0m0s
#dekorate.certificate.privateKey.algorithm=RSA
#dekorate.certificate.privateKey.encoding=PKCS8
#dekorate.certificate.privateKey.size=2048
#dekorate.certificate.keystores.pkcs12.create=true
#dekorate.certificate.keystores.pkcs12.passwordSecretRef.name=pkcs12-pass
#dekorate.certificate.keystores.pkcs12.passwordSecretRef.key=password
#dekorate.certificate.usages=server auth,client auth

2-Add the configuration using annotations, in this class:


@Certificate(name = "cert-name", secretName = "tls-secret", selfSigned = @SelfSigned(enabled = true), usages={"server auth", "client auth"}, dnsNames={"kubernetes-example.com","localhost"}, organizations={"Dekorate", "Community"}, duration="2160h0m0s", renewBefore="360h0m0s",
  privateKey = @CertificatePrivateKey(algorithm= PrivateKeyAlgorithm.RSA, encoding = PrivateKeyEncoding.PKCS8, size = 2048), keystores= @CertificateKeystores(pkcs12 = @CertificateKeystore(create = true,passwordSecretRef = @LocalObjectReference(name ="pkcs12-pass", key="password" ))))

3 - Build the project from the root:
mvn clean install

The build fails with:

[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ spring-boot-with-certmanager-example ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /Users/auri/Code/dekorate/examples/spring-boot-with-certmanager-example/target/classes
[INFO] Found Spring web annotation!
[INFO] Initializing dekorate session.
[INFO] Found @SpringBootApplication on: io.dekorate.example.Main
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.643 s
[INFO] Finished at: 2023-02-27T17:33:55+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project spring-boot-with-certmanager-example: Fatal error compiling: java.lang.IllegalArgumentException: Missing property 'name' in Certificate -> [Help 1]