question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

openshift-maven-plugin does not include annotations when using jkube-openshift-autotls enricher

See original GitHub issue

Description

Using the jkube-openshift-autotls enricher does not add service metadata annotation

metadata:
  annotations:
    service.alpha.openshift.io/serving-cert-secret-name: <secret-name>

Init container args are added.

Info

  • Eclipse JKube version : 1.0.0-rc-1
  • Maven version (mvn -v) :
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /Users/sej/.sdkman/candidates/maven/current
Java version: 11.0.7, vendor: AdoptOpenJDK, runtime: /Users/sej/.sdkman/candidates/java/11.0.7.hs-adpt
Default locale: en_DK, platform encoding: US-ASCII
OS name: "mac os x", version: "10.15.5", arch: "x86_64", family: "mac"

  • Kubernetes / Red Hat OpenShift setup and version :

OpenShift Master: v3.11.216 Kubernetes Master: v1.11.0+d4cacc0 OpenShift Web Console: >9000

  • If it’s a bug, how to reproduce :
  • Use the given zero-config sample.
  • Include the enricher as documented:
  <executions>
    <execution>
      <goals>
        <goal>resource</goal>
      </goals>
    </execution>
  </executions>
  <configuration>
    <enricher>
      <includes>
        <include>jkube-openshift-autotls</include>
      </includes>
      <config>
        <jkube-openshift-autotls>
          <!-- ... -->
        </jkube-openshift-autotls>
      </config>
    </enricher>
  </configuration>
  • run mvn clean oc:resource -Popenshift

Expected to have a service annotation like stated above.

I have peeked in the AutoTLSEnricher.java class. The #create method seems to have support for adding the annotation:

        builder.accept(new TypedVisitor<ServiceBuilder>() {
            @Override
            public void visit(ServiceBuilder service) {
                /*
                 * Set the service.alpha.openshift.io/serving-cert-secret-name annotation on your
                 * service with the value set to the name you want to use for your secret.
                 *
                 * https://docs.openshift.com/online/dev_guide/secrets.html#service-serving-certificate-secrets
                 */
                service.editOrNewMetadata()
                        .addToAnnotations(AUTOTLS_ANNOTATION_KEY, secretName)
                        .endMetadata();
            }
        });
  • Sample Reproducer Project :

Happy to work on this, hints appreciated, as I am apparently pretty rusty 😃

I am trying to write a test that will generate the correct resource files, can only find coverage for the #enrich method in AutoTLSEnricherTest.java class.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
rohanKanojiacommented, Aug 11, 2020

I don’t see any problem in doing so if it’s working. Please go ahead and create a PR 😃

0reactions
sejacobsencommented, Aug 11, 2020

OK, I think the problem may be that no visitables are available when calling the create method on AutoTLSEnricher. Ie., the builder will not add anything. However, when moving the code from #create to #enrich, both the serving-cert-secret-name annotation and the volume + volumemounts are generated (they were not before).

@rohanKanojia Do you think it is reasonable to simply move all builder code to the enrich method?

Read more comments on GitHub >

github_iconTop Results From Across the Web

OpenShift Maven Plugin - JKube - Eclipse
Kubernetes & OpenShift resource fragments are user provided YAML files that can be enriched by the plugin. This allows expert users to use...
Read more >
Deploy a Java application on Red Hat OpenShift using JKube
JKube provides an OpenShift Maven plugin that extends the features of Maven, ... An enricher is a structured way to add common capabilities, ......
Read more >
eclipse/jkube - Gitter
This channel is for discussions related to Eclipse JKube, successor of Fabric8 Maven Plugin. People. Repo info.
Read more >
fabric8io/fabric8-maven-plugin
Default Enrichers will create a default Service and Deployment (DeploymentConfig for OpenShift) when no other resource objects are provided.
Read more >
Mojo API Specification - Apache Maven
Maven plugins can be written in Java or any of a number of scripting languages. ... plugin-tools) to generate this descriptor, so developers...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found