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

Annotation-less for general-purpose JVM applications like Vert.x #354

Closed
jponge opened this issue Oct 7, 2019 · 1 comment

Comments

@jponge
Copy link

commented Oct 7, 2019

It would be nice to be able to use Dekorate for general-purpose JVM applications like those using Vert.x.

I tried building an example with Vert.x and I can use, say, @KubernetesApplication just fine to generate the YAML data:

@KubernetesApplication(ports = @Port(containerPort = 8080, name = "http"), serviceType = ServiceType.LoadBalancer)
public class MainVerticle extends AbstractVerticle {

  @Override
  public void start(Promise<Void> startPromise) {
    vertx.createHttpServer()
      .requestHandler(this::handleRequest)
      .listen(8080, ar -> {
        if (ar.succeeded()) {
          startPromise.complete();
        } else {
          startPromise.fail(ar.cause());
        }
      });
  }

  private void handleRequest(HttpServerRequest request) {
    request.response()
      .putHeader("Content-Type", "plain/text")
      .end("Yo");
  }

  public static void main(String[] args) {
    Vertx.vertx().deployVerticle(new MainVerticle());
  }
}

That being said having K8S / runtime specific meta-data hardwired into code is not desirable, so I thought I could just have @KubernetesApplication (no parameters) and a src/main/resources/application.yml to let Dekorate generate YAML for me:

dekorate:
  kubernetes:
    serviceType: "LoadBalancer"
    ports:
      - name: "http"
        containerPort: 8080

Unfortunately it seems like annotation-less only works for frameworks (Spring Boot / Thorntail).

Being able to leverage Dekorate just with a descriptor file like the one above would definitely make it useful in a Vert.x context, and more generally, for any JVM application.

@iocanel iocanel self-assigned this Oct 7, 2019
@iocanel iocanel added this to Week schedule in Dekorate Oct 7, 2019
iocanel added a commit to iocanel/dekorate that referenced this issue Oct 7, 2019
…th generic

java applications. Add vertx examples.
@iocanel iocanel moved this from Week schedule to In progress in Dekorate Oct 7, 2019
iocanel added a commit to iocanel/dekorate that referenced this issue Oct 7, 2019
iocanel added a commit that referenced this issue Oct 9, 2019
iocanel added a commit that referenced this issue Oct 9, 2019
@iocanel

This comment has been minimized.

Copy link
Member

commented Oct 9, 2019

I think we can close this now.

@iocanel iocanel closed this Oct 9, 2019
Dekorate automation moved this from In progress to Done Oct 9, 2019
@iocanel iocanel moved this from Done to Done this week in Dekorate Oct 9, 2019
@iocanel iocanel moved this from Done this week to Done in Dekorate Oct 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Dekorate
  
Done
2 participants
You can’t perform that action at this time.