halkyonio / primaza-poc

Quarkus Primaza Application - POC
1 stars 7 forks source link

Switch the repository to xpkg.upbound.io/crossplane-contrib to install the crossplane providers #475

Closed cmoulliard closed 5 months ago

cmoulliard commented 5 months ago
cmoulliard commented 5 months ago

There is now another issue

./scripts/data/bind_application.sh application_name=atomic-fruits claim_name=fruits-claim
  shell: /usr/bin/bash -e {0}
  env:
    PSEUDO_TTY: false
    JAVA_HOME: /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.10-7/x6[4](https://github.com/halkyonio/primaza-poc/actions/runs/8923233395/job/24507035138?pr=475#step:13:4)
    JAVA_HOME_17_X64: /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.10-7/x64
    KIND_REGISTRY: kind-registry:[5](https://github.com/halkyonio/primaza-poc/actions/runs/8923233395/job/24507035138?pr=475#step:13:5)000
    PRIMAZA_URL: primaza.127.0.0.1.nip.io
    PRIMAZA_NAMESPACE: primaza
NOTE: Searching about the application to be bound ...
NOTE: curl -H 'Accept: application/json' -s primaza.12[7](https://github.com/halkyonio/primaza-poc/actions/runs/8923233395/job/24507035138?pr=475#step:13:7).0.0.1.nip.io/applications/name/atomic-fruits
NOTE: Application ID to be bound: 1
NOTE: Searching about the claim ...
NOTE: Claim ID to be bound: 1
NOTE: curl -X POST -H 'Content-Type: application/x-www-form-urlencoded' -d "claimId=1" -s -i primaza.[12](https://github.com/halkyonio/primaza-poc/actions/runs/8923233395/job/24507035138?pr=475#step:13:13)7.0.0.1.nip.io/applications/claim/1
ERROR: Application failed to be bound in Primaza: 500 Internal Server Error
Error: Process completed with exit code 1.

due to

Caused by: org.postgresql.util.PSQLException: The connection attempt failed.
    at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:358)
    at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:54)
    at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:273)
    at org.postgresql.Driver.makeConnection(Driver.java:446)
    at org.postgresql.Driver.connect(Driver.java:298)
    at io.agroal.pool.ConnectionFactory.createConnection(ConnectionFactory.java:225)
    at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:545)
    at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:526)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at io.agroal.pool.util.PriorityScheduledExecutor.beforeExecute(PriorityScheduledExecutor.java:75)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    ... 1 more
Caused by: java.net.UnknownHostException: fruits-app-db
    at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:572)
    at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327)
    at java.base/java.net.Socket.connect(Socket.java:633)
    at org.postgresql.core.PGStream.createSocket(PGStream.java:243)
    at org.postgresql.core.PGStream.<init>(PGStream.java:98)
    at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:136)
    at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:262)
    ... 12 more

If I replay the scenario locally I discover that the db is not installed by crossplane as the script ./scripts/data/bind_application.sh application_name=atomic-fruits claim_name=fruits-claim reports an error HTTP 500

Caused by: java.lang.ClassCastException: class java.lang.String cannot be cast to class io.crossplane.helm.v1beta1.ReleaseSpec$ManagementPolicies (java.lang.String is in module java.base of loader 'b
ootstrap'; io.crossplane.helm.v1beta1.ReleaseSpec$ManagementPolicies is in unnamed module of loader io.quarkus.bootstrap.runner.RunnerClassLoader @475530b9)
    at io.crossplane.helm.v1beta1.ReleaseSpecFluent.withManagementPolicies(ReleaseSpecFluent.java:337)
    at io.crossplane.helm.v1beta1.ReleaseSpecFluent.copyInstance(ReleaseSpecFluent.java:57)
    at io.crossplane.helm.v1beta1.ReleaseSpecBuilder.<init>(ReleaseSpecBuilder.java:15)
    at io.crossplane.helm.v1beta1.ReleaseFluent$SpecNested.<init>(ReleaseFluent.java:232)
    at io.crossplane.helm.v1beta1.ReleaseFluent.withNewSpec(ReleaseFluent.java:101)
    at io.halkyon.services.KubernetesClientService.createCrossplaneHelmRelease(KubernetesClientService.java:247)

Code: https://github.com/halkyonio/primaza-poc/blob/ecf2f80da0f48b010b2ceef29c69a7c7a30cfb35/app/src/main/java/io/halkyon/services/KubernetesClientService.java#L246

Here is the java code generated by dekorate

    public enum ManagementPolicies {

        @com.fasterxml.jackson.annotation.JsonProperty("Observe")
        OBSERVE("Observe"),
        @com.fasterxml.jackson.annotation.JsonProperty("Create")
        CREATE("Create"),
        @com.fasterxml.jackson.annotation.JsonProperty("Update")
        UPDATE("Update"),
        @com.fasterxml.jackson.annotation.JsonProperty("Delete")
        DELETE("Delete"),
        @com.fasterxml.jackson.annotation.JsonProperty("LateInitialize")
        LATEINITIALIZE("LateInitialize"),
        @com.fasterxml.jackson.annotation.JsonProperty("*")
        __("*");

        java.lang.String value;

        ManagementPolicies(java.lang.String value) {
            this.value = value;
        }

        @com.fasterxml.jackson.annotation.JsonValue()
        public java.lang.String getValue() {
            return value;
        }
    }

I dont really understand why it complains about the ManagementPolicies - https://github.com/crossplane/crossplane-runtime/blob/master/apis/common/v1/policies.go as the object that we are creating which is a Release do not include it: https://github.com/crossplane-contrib/provider-helm/blob/master/apis/release/v1beta1/types.go

@aureamunoz

aureamunoz commented 5 months ago

It would be nice to squash all commits ;-)