Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Certmanager annotation config fails missing name #1158

Closed
aureamunoz opened this issue Feb 27, 2023 · 1 comment · Fixed by #1159
Closed

Certmanager annotation config fails missing name #1158

aureamunoz opened this issue Feb 27, 2023 · 1 comment · Fixed by #1159

Comments

@aureamunoz
Copy link
Collaborator

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]
@aureamunoz
Copy link
Collaborator Author

cc @Sgitario @iocanel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant