apache / camel-k

Apache Camel K is a lightweight integration platform, born on Kubernetes, with serverless superpowers
https://camel.apache.org/camel-k
Apache License 2.0
868 stars 348 forks source link

Integrations fail with Jib publish strategy #5007

Closed hernanDatgDev closed 10 months ago

hernanDatgDev commented 10 months ago

What happened?

Integrations do not run with publish strategy Jib. While using v2.1.0 the build fails before an image can be created with minimal logging detail While using v2.0.0 the build succeeds but the container is not able to be created/deployed

Steps to reproduce

  1. Install camel-k 2.1.0 or 2.0.0 with --build-publish-strategy Jib
  2. Run an integration

Relevant log output

2.1.0 logs:
{"level":"info","ts":"2023-12-21T21:16:07Z","logger":"camel-k.maven.build","msg":"OS name: \"linux\", version: \"5.15.49-linuxkit-pr\", arch: \"amd64\", family: \"unix\""}
{"level":"error","ts":"2023-12-21T21:16:22Z","logger":"camel-k","msg":"jib integration image containerization did not run successfully","error":": exit status 1","stacktrace":"github.com/apache/camel-k/v2/pkg/util/log.Logger.Errorf\n\tgithub.com/apache/camel-k/v2/pkg/util/log/log.go:60\ngithub.com/apache/camel-k/v2/pkg/util/log.Errorf\n\tgithub.com/apache/camel-k/v2/pkg/util/log/log.go:227\ngithub.com/apache/camel-k/v2/pkg/builder.(*jibTask).Do\n\tgithub.com/apache/camel-k/v2/pkg/builder/jib.go:124\ngithub.com/apache/camel-k/v2/pkg/controller/build.(*monitorRoutineAction).runBuild\n\tgithub.com/apache/camel-k/v2/pkg/controller/build/monitor_routine.go:167"}
{"level":"info","ts":"2023-12-21T21:16:22Z","logger":"camel-k.controller.build","msg":"Build duration 25.49116277s","request-namespace":"default","request-name":"file-test","build-attempt":2,"build-result":"Failed","build-duration":25.49116277,"api-version":"camel.apache.org/v1","kind":"Build","ns":"default","name":"kit-cm2akkc738hs73cqta0g"}

2.0.0 integration event:
Cannot reconcile Integration file-test: error executing post actions: error during apply resource: default/file-test: Deployment.apps "file-test" is invalid: spec.template.spec.containers[0].image: Required value

2.0.0 logs:
{"level":"info","ts":1703194322.3954227,"logger":"camel-k.maven.build","msg":"BUILD SUCCESS"}
{"level":"info","ts":1703194322.395581,"logger":"camel-k.maven.build","msg":"------------------------------------------------------------------------"}
{"level":"info","ts":1703194322.3977785,"logger":"camel-k.maven.build","msg":"Total time:  02:15 min (Wall Clock)"}
{"level":"info","ts":1703194322.397876,"logger":"camel-k.maven.build","msg":"Finished at: 2023-12-21T21:32:02Z"}
...
{"level":"info","ts":1703194322.6735744,"logger":"camel-k.controller.integration","msg":"Reconciling Integration","request-namespace":"default","request-name":"file-test"}
{"level":"info","ts":1703194322.67364,"logger":"camel-k.controller.integration","msg":"Invoking action monitor","request-namespace":"default","request-name":"file-test","api-version":"camel.apache.org/v1","kind":"Integration","ns":"default","name":"file-test"}
{"level":"error","ts":1703194322.7993717,"msg":"Reconciler error","controller":"integration-controller","controllerGroup":"camel.apache.org","controllerKind":"Integration","Integration":{"name":"file-test","namespace":"default"},"namespace":"default","name":"file-test","reconcileID":"114fbd50-21ce-4059-88eb-5e2748bdfdeb","error":"error executing post actions: error during apply resource: default/file-test: Deployment.apps \"file-test\" is invalid: spec.template.spec.containers[0].image: Required value","stacktrace":"sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\tsigs.k8s.io/controller-runtime@v0.13.1/pkg/internal/controller/controller.go:326\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\tsigs.k8s.io/controller-runtime@v0.13.1/pkg/internal/controller/controller.go:273\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2\n\tsigs.k8s.io/controller-runtime@v0.13.1/pkg/internal/controller/controller.go:234"}
{"level":"info","ts":1703194322.8051429,"logger":"camel-k.controller.integration","msg":"Reconciling Integration","request-namespace":"default","request-name":"file-test"}

Camel K version

2.1.0 & 2.0.0

squakez commented 10 months ago

@gansheer can you please have a look?

gansheer commented 10 months ago

Hi @hernanDatgDev, I can't reproduce your issue, it works well for me. Can you give us more details on your use case: how you installed the operator, with which configuration, what type of integration you are trying to run, etc.

hernanDatgDev commented 10 months ago

Install command camel-k v2.1.0: kamel install --registry docker.io --organization hguardado --registry-secret dockerhub-cred --maven-settings configmap:aws-repo/settings.xml --build-publish-strategy Jib --max-running-pipelines 2

Integration Platform: ip-jib.yaml.txt

Test integration (timer-log.groovy):

from('timer:heartbeat?period=3000')
.log('heartbeat: (${exchangeProperty.CamelTimerCounter})')

Operator logs:

{"level":"info","ts":"2023-12-22T16:14:35Z","logger":"camel-k.controller.integrationkit","msg":"Build running","request-namespace":"default","request-name":"kit-cm2rbqvrbkps73cbuidg","api-version":"camel.apache.org/v1","kind":"IntegrationKit","ns":"default","name":"kit-cm2rbqvrbkps73cbuidg"}
{"level":"info","ts":"2023-12-22T16:14:35Z","logger":"camel-k.maven","msg":"executing: ./mvnw -V --no-transfer-progress -Dstyle.color=never package -Dmaven.repo.local=/etc/maven/m2 --global-settings /tmp/kit-cm2rbqvrbkps73cbuidg-4244968166/maven/settings.xml --settings /tmp/kit-cm2rbqvrbkps73cbuidg-4244968166/maven/user-settings.xml -Dmaven.artifact.threads=6 -T 6","MAVEN_OPTS":""}
{"level":"info","ts":"2023-12-22T16:14:35Z","logger":"camel-k.maven.build","msg":"Executed command: ./mvnw -V --no-transfer-progress -Dstyle.color=never package -Dmaven.repo.local=/etc/maven/m2 --global-settings /tmp/kit-cm2rbqvrbkps73cbuidg-4244968166/maven/settings.xml --settings /tmp/kit-cm2rbqvrbkps73cbuidg-4244968166/maven/user-settings.xml -Dmaven.artifact.threads=6 -T 6"}
{"level":"info","ts":"2023-12-22T16:14:36Z","logger":"camel-k.maven.build","msg":"SLF4J: Failed to load class \"org.slf4j.impl.StaticLoggerBinder\"."}
{"level":"info","ts":"2023-12-22T16:14:36Z","logger":"camel-k.maven.build","msg":"SLF4J: Defaulting to no-operation (NOP) logger implementation"}
{"level":"info","ts":"2023-12-22T16:14:36Z","logger":"camel-k.maven.build","msg":"SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details."}
{"level":"info","ts":"2023-12-22T16:14:36Z","logger":"camel-k.maven.build","msg":"Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)"}
{"level":"info","ts":"2023-12-22T16:14:36Z","logger":"camel-k.maven.build","msg":"Maven home: /usr/share/maven/wrapper/dists/apache-maven-3.8.6-bin/5f1464e3/apache-maven-3.8.6"}
{"level":"info","ts":"2023-12-22T16:14:36Z","logger":"camel-k.maven.build","msg":"Java version: 17.0.8.1, vendor: Eclipse Adoptium, runtime: /opt/java/openjdk"}
{"level":"info","ts":"2023-12-22T16:14:36Z","logger":"camel-k.maven.build","msg":"Default locale: en_US, platform encoding: UTF-8"}
{"level":"info","ts":"2023-12-22T16:14:36Z","logger":"camel-k.maven.build","msg":"OS name: \"linux\", version: \"5.15.49-linuxkit-pr\", arch: \"amd64\", family: \"unix\""}
{"level":"info","ts":"2023-12-22T16:17:08Z","logger":"camel-k.builder","msg":"running builder task package in context directory: /tmp/kit-cm2rbqvrbkps73cbuidg-4244968166"}
{"level":"info","ts":"2023-12-22T16:17:08Z","logger":"camel-k.maven.build","msg":"Executed command: ./mvnw jib:build -V --no-transfer-progress -Dstyle.color=never -Dmaven.repo.local=/etc/maven/m2 --global-settings /tmp/kit-cm2rbqvrbkps73cbuidg-4244968166/maven/settings.xml --settings /tmp/kit-cm2rbqvrbkps73cbuidg-4244968166/maven/user-settings.xml -Dmaven.artifact.threads=6 -T 6 -P jib -Djib.to.image=docker.io/hguardado/camel-k-kit-cm2rbqvrbkps73cbuidg:2368668 -Djib.from.image=eclipse-temurin:17"}
{"level":"info","ts":"2023-12-22T16:17:08Z","logger":"camel-k.maven.build","msg":"SLF4J: Failed to load class \"org.slf4j.impl.StaticLoggerBinder\"."}
{"level":"info","ts":"2023-12-22T16:17:08Z","logger":"camel-k.maven.build","msg":"SLF4J: Defaulting to no-operation (NOP) logger implementation"}
{"level":"info","ts":"2023-12-22T16:17:08Z","logger":"camel-k.maven.build","msg":"SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details."}
{"level":"info","ts":"2023-12-22T16:17:08Z","logger":"camel-k.maven.build","msg":"Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)"}
{"level":"info","ts":"2023-12-22T16:17:08Z","logger":"camel-k.maven.build","msg":"Maven home: /usr/share/maven/wrapper/dists/apache-maven-3.8.6-bin/5f1464e3/apache-maven-3.8.6"}
{"level":"info","ts":"2023-12-22T16:17:08Z","logger":"camel-k.maven.build","msg":"Java version: 17.0.8.1, vendor: Eclipse Adoptium, runtime: /opt/java/openjdk"}
{"level":"info","ts":"2023-12-22T16:17:08Z","logger":"camel-k.maven.build","msg":"Default locale: en_US, platform encoding: UTF-8"}
{"level":"info","ts":"2023-12-22T16:17:08Z","logger":"camel-k.maven.build","msg":"OS name: \"linux\", version: \"5.15.49-linuxkit-pr\", arch: \"amd64\", family: \"unix\""}
{"level":"error","ts":"2023-12-22T16:17:49Z","logger":"camel-k","msg":"jib integration image containerization did not run successfully","error":": exit status 1","stacktrace":"github.com/apache/camel-k/v2/pkg/util/log.Logger.Errorf\n\tgithub.com/apache/camel-k/v2/pkg/util/log/log.go:60\ngithub.com/apache/camel-k/v2/pkg/util/log.Errorf\n\tgithub.com/apache/camel-k/v2/pkg/util/log/log.go:227\ngithub.com/apache/camel-k/v2/pkg/builder.(*jibTask).Do\n\tgithub.com/apache/camel-k/v2/pkg/builder/jib.go:124\ngithub.com/apache/camel-k/v2/pkg/controller/build.(*monitorRoutineAction).runBuild\n\tgithub.com/apache/camel-k/v2/pkg/controller/build/monitor_routine.go:167"}
{"level":"info","ts":"2023-12-22T16:17:49Z","logger":"camel-k.controller.build","msg":"Build duration 3m14.774239727s","request-namespace":"default","request-name":"timer-log","build-attempt":0,"build-result":"Failed","build-duration":194.774239727,"api-version":"camel.apache.org/v1","kind":"Build","ns":"default","name":"kit-cm2rbqvrbkps73cbuidg"}
{"level":"error","ts":"2023-12-22T16:17:49Z","logger":"camel-k.controller.build","msg":"Build kit-cm2rbqvrbkps73cbuidg failed: : exit status 1","request-namespace":"default","request-name":"kit-cm2rbqvrbkps73cbuidg","api-version":"camel.apache.org/v1","kind":"Build","ns":"default","name":"kit-cm2rbqvrbkps73cbuidg","stacktrace":"github.com/apache/camel-k/v2/pkg/util/log.Logger.Errorf\n\tgithub.com/apache/camel-k/v2/pkg/util/log/log.go:60\ngithub.com/apache/camel-k/v2/pkg/controller/build.(*monitorRoutineAction).updateBuildStatus\n\tgithub.com/apache/camel-k/v2/pkg/controller/build/monitor_routine.go:216\ngithub.com/apache/camel-k/v2/pkg/controller/build.(*monitorRoutineAction).runBuild\n\tgithub.com/apache/camel-k/v2/pkg/controller/build/monitor_routine.go:200"}
hernanDatgDev commented 10 months ago

Tried with camel-k v2.2.0 snapshot and received more information. Seems like a problem accessing the docker registry. The same registry secret works with Spectrum as the default publish strategy. I'm only seeing this when I use Jib. Also for more context I'm using docker-desktop as my test cluster.

{"level":"info","ts":"2023-12-22T18:09:19Z","logger":"camel-k.maven.build","msg":"Containerizing application to hguardado/camel-k-kit-cm2svndvohps73a2vhn0:2381653..."}
{"level":"info","ts":"2023-12-22T18:09:19Z","logger":"camel-k.maven.build","msg":"Base image 'eclipse-temurin:17' does not use a specific image digest - build may not be reproducible"}
{"level":"info","ts":"2023-12-22T18:09:19Z","logger":"camel-k.maven.build","msg":"Getting manifest for base image eclipse-temurin:17..."}
{"level":"info","ts":"2023-12-22T18:09:19Z","logger":"camel-k.maven.build","msg":"Building extra files layer..."}
{"level":"info","ts":"2023-12-22T18:09:20Z","logger":"camel-k.maven.build","msg":"The base image requires auth. Trying again for eclipse-temurin:17..."}
{"level":"info","ts":"2023-12-22T18:09:21Z","logger":"camel-k.maven.build","msg":"Using base image with digest: sha256:891bc1f583d287ba1f5f429e172c10ac5d692d2a02197dfef9bd6d16b2d9ed15"}
{"level":"error","ts":"2023-12-22T18:09:27Z","logger":"camel-k.maven.build","msg":"I/O error for image [registry-1.docker.io/hguardado/camel-k-kit-cm2svndvohps73a2vhn0]:","stacktrace":"github.com/apache/camel-k/v2/pkg/util/log.Logger.Error\n\tgithub.com/apache/camel-k/v2/pkg/util/log/log.go:81\ngithub.com/apache/camel-k/v2/pkg/util/maven.normalizeLog\n\tgithub.com/apache/camel-k/v2/pkg/util/maven/maven_log.go:83\ngithub.com/apache/camel-k/v2/pkg/util/maven.MavenLogHandler\n\tgithub.com/apache/camel-k/v2/pkg/util/maven/maven_log.go:54\ngithub.com/apache/camel-k/v2/pkg/util.scan\n\tgithub.com/apache/camel-k/v2/pkg/util/command.go:76\ngithub.com/apache/camel-k/v2/pkg/util.RunAndLog.func1\n\tgithub.com/apache/camel-k/v2/pkg/util/command.go:55\ngolang.org/x/sync/errgroup.(*Group).Go.func1\n\tgolang.org/x/sync@v0.5.0/errgroup/errgroup.go:75"}
{"level":"error","ts":"2023-12-22T18:09:27Z","logger":"camel-k.maven.build","msg":"    java.net.SocketException","stacktrace":"github.com/apache/camel-k/v2/pkg/util/log.Logger.Error\n\tgithub.com/apache/camel-k/v2/pkg/util/log/log.go:81\ngithub.com/apache/camel-k/v2/pkg/util/maven.normalizeLog\n\tgithub.com/apache/camel-k/v2/pkg/util/maven/maven_log.go:83\ngithub.com/apache/camel-k/v2/pkg/util/maven.MavenLogHandler\n\tgithub.com/apache/camel-k/v2/pkg/util/maven/maven_log.go:54\ngithub.com/apache/camel-k/v2/pkg/util.scan\n\tgithub.com/apache/camel-k/v2/pkg/util/command.go:76\ngithub.com/apache/camel-k/v2/pkg/util.RunAndLog.func1\n\tgithub.com/apache/camel-k/v2/pkg/util/command.go:55\ngolang.org/x/sync/errgroup.(*Group).Go.func1\n\tgolang.org/x/sync@v0.5.0/errgroup/errgroup.go:75"}
{"level":"error","ts":"2023-12-22T18:09:27Z","logger":"camel-k.maven.build","msg":"    Socket closed","stacktrace":"github.com/apache/camel-k/v2/pkg/util/log.Logger.Error\n\tgithub.com/apache/camel-k/v2/pkg/util/log/log.go:81\ngithub.com/apache/camel-k/v2/pkg/util/maven.normalizeLog\n\tgithub.com/apache/camel-k/v2/pkg/util/maven/maven_log.go:83\ngithub.com/apache/camel-k/v2/pkg/util/maven.MavenLogHandler\n\tgithub.com/apache/camel-k/v2/pkg/util/maven/maven_log.go:54\ngithub.com/apache/camel-k/v2/pkg/util.scan\n\tgithub.com/apache/camel-k/v2/pkg/util/command.go:76\ngithub.com/apache/camel-k/v2/pkg/util.RunAndLog.func1\n\tgithub.com/apache/camel-k/v2/pkg/util/command.go:55\ngolang.org/x/sync/errgroup.(*Group).Go.func1\n\tgolang.org/x/sync@v0.5.0/errgroup/errgroup.go:75"}
{"level":"info","ts":"2023-12-22T18:09:27Z","logger":"camel-k.maven.build","msg":""}
{"level":"info","ts":"2023-12-22T18:09:27Z","logger":"camel-k.maven.build","msg":"A new version of jib-maven-plugin (3.4.0) is available (currently using 3.3.2). Update your build configuration to use the latest features and fixes!"}
{"level":"info","ts":"2023-12-22T18:09:27Z","logger":"camel-k.maven.build","msg":"https://github.com/GoogleContainerTools/jib/blob/master/jib-maven-plugin/CHANGELOG.md"}
{"level":"info","ts":"2023-12-22T18:09:27Z","logger":"camel-k.maven.build","msg":""}
{"level":"info","ts":"2023-12-22T18:09:27Z","logger":"camel-k.maven.build","msg":"Please see https://github.com/GoogleContainerTools/jib/blob/master/docs/privacy.md for info on disabling this update check."}
{"level":"info","ts":"2023-12-22T18:09:27Z","logger":"camel-k.maven.build","msg":""}
{"level":"info","ts":"2023-12-22T18:09:27Z","logger":"camel-k.maven.build","msg":""}
{"level":"info","ts":"2023-12-22T18:09:27Z","logger":"camel-k.maven.build","msg":"------------------------------------------------------------------------"}
{"level":"info","ts":"2023-12-22T18:09:27Z","logger":"camel-k.maven.build","msg":"BUILD FAILURE"}
{"level":"info","ts":"2023-12-22T18:09:27Z","logger":"camel-k.maven.build","msg":"------------------------------------------------------------------------"}
{"level":"info","ts":"2023-12-22T18:09:27Z","logger":"camel-k.maven.build","msg":"Total time:  9.211 s (Wall Clock)"}
{"level":"info","ts":"2023-12-22T18:09:27Z","logger":"camel-k.maven.build","msg":"Finished at: 2023-12-22T18:09:27Z"}
{"level":"info","ts":"2023-12-22T18:09:27Z","logger":"camel-k.maven.build","msg":"------------------------------------------------------------------------"}
{"level":"error","ts":"2023-12-22T18:09:27Z","logger":"camel-k.maven.build","msg":"Failed to execute goal com.google.cloud.tools:jib-maven-plugin:3.3.2:build (default-cli) on project camel-k-integration: Build image failed, perhaps you should make sure your credentials for 'registry-1.docker.io/hguardado/camel-k-kit-cm2svndvohps73a2vhn0' are set up correctly. See https://github.com/GoogleContainerTools/jib/blob/master/docs/faq.md#what-should-i-do-when-the-registry-responds-with-unauthorized for help: Unauthorized for registry-1.docker.io/hguardado/camel-k-kit-cm2svndvohps73a2vhn0: 401 Unauthorized","stacktrace":"github.com/apache/camel-k/v2/pkg/util/log.Logger.Error\n\tgithub.com/apache/camel-k/v2/pkg/util/log/log.go:81\ngithub.com/apache/camel-k/v2/pkg/util/maven.normalizeLog\n\tgithub.com/apache/camel-k/v2/pkg/util/maven/maven_log.go:83\ngithub.com/apache/camel-k/v2/pkg/util/maven.MavenLogHandler\n\tgithub.com/apache/camel-k/v2/pkg/util/maven/maven_log.go:54\ngithub.com/apache/camel-k/v2/pkg/util.scan\n\tgithub.com/apache/camel-k/v2/pkg/util/command.go:76\ngithub.com/apache/camel-k/v2/pkg/util.RunAndLog.func1\n\tgithub.com/apache/camel-k/v2/pkg/util/command.go:55\ngolang.org/x/sync/errgroup.(*Group).Go.func1\n\tgolang.org/x/sync@v0.5.0/errgroup/errgroup.go:75"}
{"level":"error","ts":"2023-12-22T18:09:27Z","logger":"camel-k.maven.build","msg":"HEAD https://registry-1.docker.io/v2/hguardado/camel-k-kit-cm2svndvohps73a2vhn0/blobs/sha256:cf9fc801eb7a0d37087e74dcf17515971db337122da90a47e46bf441147f809a","stacktrace":"github.com/apache/camel-k/v2/pkg/util/log.Logger.Error\n\tgithub.com/apache/camel-k/v2/pkg/util/log/log.go:81\ngithub.com/apache/camel-k/v2/pkg/util/maven.normalizeLog\n\tgithub.com/apache/camel-k/v2/pkg/util/maven/maven_log.go:83\ngithub.com/apache/camel-k/v2/pkg/util/maven.MavenLogHandler\n\tgithub.com/apache/camel-k/v2/pkg/util/maven/maven_log.go:54\ngithub.com/apache/camel-k/v2/pkg/util.scan\n\tgithub.com/apache/camel-k/v2/pkg/util/command.go:76\ngithub.com/apache/camel-k/v2/pkg/util.RunAndLog.func1\n\tgithub.com/apache/camel-k/v2/pkg/util/command.go:55\ngolang.org/x/sync/errgroup.(*Group).Go.func1\n\tgolang.org/x/sync@v0.5.0/errgroup/errgroup.go:75"}
{"level":"error","ts":"2023-12-22T18:09:27Z","logger":"camel-k.maven.build","msg":"-> [Help 1]","stacktrace":"github.com/apache/camel-k/v2/pkg/util/log.Logger.Error\n\tgithub.com/apache/camel-k/v2/pkg/util/log/log.go:81\ngithub.com/apache/camel-k/v2/pkg/util/maven.normalizeLog\n\tgithub.com/apache/camel-k/v2/pkg/util/maven/maven_log.go:83\ngithub.com/apache/camel-k/v2/pkg/util/maven.MavenLogHandler\n\tgithub.com/apache/camel-k/v2/pkg/util/maven/maven_log.go:54\ngithub.com/apache/camel-k/v2/pkg/util.scan\n\tgithub.com/apache/camel-k/v2/pkg/util/command.go:76\ngithub.com/apache/camel-k/v2/pkg/util.RunAndLog.func1\n\tgithub.com/apache/camel-k/v2/pkg/util/command.go:55\ngolang.org/x/sync/errgroup.(*Group).Go.func1\n\tgolang.org/x/sync@v0.5.0/errgroup/errgroup.go:75"}
{"level":"error","ts":"2023-12-22T18:09:27Z","logger":"camel-k.maven.build","msg":"","stacktrace":"github.com/apache/camel-k/v2/pkg/util/log.Logger.Error\n\tgithub.com/apache/camel-k/v2/pkg/util/log/log.go:81\ngithub.com/apache/camel-k/v2/pkg/util/maven.normalizeLog\n\tgithub.com/apache/camel-k/v2/pkg/util/maven/maven_log.go:83\ngithub.com/apache/camel-k/v2/pkg/util/maven.MavenLogHandler\n\tgithub.com/apache/camel-k/v2/pkg/util/maven/maven_log.go:54\ngithub.com/apache/camel-k/v2/pkg/util.scan\n\tgithub.com/apache/camel-k/v2/pkg/util/command.go:76\ngithub.com/apache/camel-k/v2/pkg/util.RunAndLog.func1\n\tgithub.com/apache/camel-k/v2/pkg/util/command.go:55\ngolang.org/x/sync/errgroup.(*Group).Go.func1\n\tgolang.org/x/sync@v0.5.0/errgroup/errgroup.go:75"}
{"level":"error","ts":"2023-12-22T18:09:27Z","logger":"camel-k.maven.build","msg":"To see the full stack trace of the errors, re-run Maven with the -e switch.","stacktrace":"github.com/apache/camel-k/v2/pkg/util/log.Logger.Error\n\tgithub.com/apache/camel-k/v2/pkg/util/log/log.go:81\ngithub.com/apache/camel-k/v2/pkg/util/maven.normalizeLog\n\tgithub.com/apache/camel-k/v2/pkg/util/maven/maven_log.go:83\ngithub.com/apache/camel-k/v2/pkg/util/maven.MavenLogHandler\n\tgithub.com/apache/camel-k/v2/pkg/util/maven/maven_log.go:54\ngithub.com/apache/camel-k/v2/pkg/util.scan\n\tgithub.com/apache/camel-k/v2/pkg/util/command.go:76\ngithub.com/apache/camel-k/v2/pkg/util.RunAndLog.func1\n\tgithub.com/apache/camel-k/v2/pkg/util/command.go:55\ngolang.org/x/sync/errgroup.(*Group).Go.func1\n\tgolang.org/x/sync@v0.5.0/errgroup/errgroup.go:75"}
{"level":"error","ts":"2023-12-22T18:09:27Z","logger":"camel-k.maven.build","msg":"Re-run Maven using the -X switch to enable full debug logging.","stacktrace":"github.com/apache/camel-k/v2/pkg/util/log.Logger.Error\n\tgithub.com/apache/camel-k/v2/pkg/util/log/log.go:81\ngithub.com/apache/camel-k/v2/pkg/util/maven.normalizeLog\n\tgithub.com/apache/camel-k/v2/pkg/util/maven/maven_log.go:83\ngithub.com/apache/camel-k/v2/pkg/util/maven.MavenLogHandler\n\tgithub.com/apache/camel-k/v2/pkg/util/maven/maven_log.go:54\ngithub.com/apache/camel-k/v2/pkg/util.scan\n\tgithub.com/apache/camel-k/v2/pkg/util/command.go:76\ngithub.com/apache/camel-k/v2/pkg/util.RunAndLog.func1\n\tgithub.com/apache/camel-k/v2/pkg/util/command.go:55\ngolang.org/x/sync/errgroup.(*Group).Go.func1\n\tgolang.org/x/sync@v0.5.0/errgroup/errgroup.go:75"}
{"level":"error","ts":"2023-12-22T18:09:27Z","logger":"camel-k.maven.build","msg":"","stacktrace":"github.com/apache/camel-k/v2/pkg/util/log.Logger.Error\n\tgithub.com/apache/camel-k/v2/pkg/util/log/log.go:81\ngithub.com/apache/camel-k/v2/pkg/util/maven.normalizeLog\n\tgithub.com/apache/camel-k/v2/pkg/util/maven/maven_log.go:83\ngithub.com/apache/camel-k/v2/pkg/util/maven.MavenLogHandler\n\tgithub.com/apache/camel-k/v2/pkg/util/maven/maven_log.go:54\ngithub.com/apache/camel-k/v2/pkg/util.scan\n\tgithub.com/apache/camel-k/v2/pkg/util/command.go:76\ngithub.com/apache/camel-k/v2/pkg/util.RunAndLog.func1\n\tgithub.com/apache/camel-k/v2/pkg/util/command.go:55\ngolang.org/x/sync/errgroup.(*Group).Go.func1\n\tgolang.org/x/sync@v0.5.0/errgroup/errgroup.go:75"}
{"level":"error","ts":"2023-12-22T18:09:27Z","logger":"camel-k.maven.build","msg":"For more information about the errors and possible solutions, please read the following articles:","stacktrace":"github.com/apache/camel-k/v2/pkg/util/log.Logger.Error\n\tgithub.com/apache/camel-k/v2/pkg/util/log/log.go:81\ngithub.com/apache/camel-k/v2/pkg/util/maven.normalizeLog\n\tgithub.com/apache/camel-k/v2/pkg/util/maven/maven_log.go:83\ngithub.com/apache/camel-k/v2/pkg/util/maven.MavenLogHandler\n\tgithub.com/apache/camel-k/v2/pkg/util/maven/maven_log.go:54\ngithub.com/apache/camel-k/v2/pkg/util.scan\n\tgithub.com/apache/camel-k/v2/pkg/util/command.go:76\ngithub.com/apache/camel-k/v2/pkg/util.RunAndLog.func1\n\tgithub.com/apache/camel-k/v2/pkg/util/command.go:55\ngolang.org/x/sync/errgroup.(*Group).Go.func1\n\tgolang.org/x/sync@v0.5.0/errgroup/errgroup.go:75"}
{"level":"error","ts":"2023-12-22T18:09:27Z","logger":"camel-k.maven.build","msg":"[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException","stacktrace":"github.com/apache/camel-k/v2/pkg/util/log.Logger.Error\n\tgithub.com/apache/camel-k/v2/pkg/util/log/log.go:81\ngithub.com/apache/camel-k/v2/pkg/util/maven.normalizeLog\n\tgithub.com/apache/camel-k/v2/pkg/util/maven/maven_log.go:83\ngithub.com/apache/camel-k/v2/pkg/util/maven.MavenLogHandler\n\tgithub.com/apache/camel-k/v2/pkg/util/maven/maven_log.go:54\ngithub.com/apache/camel-k/v2/pkg/util.scan\n\tgithub.com/apache/camel-k/v2/pkg/util/command.go:76\ngithub.com/apache/camel-k/v2/pkg/util.RunAndLog.func1\n\tgithub.com/apache/camel-k/v2/pkg/util/command.go:55\ngolang.org/x/sync/errgroup.(*Group).Go.func1\n\tgolang.org/x/sync@v0.5.0/errgroup/errgroup.go:75"}
{"level":"error","ts":"2023-12-22T18:09:27Z","logger":"camel-k","msg":"jib integration image containerization did not run successfully","error":": exit status 1","stacktrace":"github.com/apache/camel-k/v2/pkg/util/log.Logger.Errorf\n\tgithub.com/apache/camel-k/v2/pkg/util/log/log.go:66\ngithub.com/apache/camel-k/v2/pkg/util/log.Errorf\n\tgithub.com/apache/camel-k/v2/pkg/util/log/log.go:233\ngithub.com/apache/camel-k/v2/pkg/builder.(*jibTask).Do\n\tgithub.com/apache/camel-k/v2/pkg/builder/jib.go:129\ngithub.com/apache/camel-k/v2/pkg/controller/build.(*monitorRoutineAction).runBuild\n\tgithub.com/apache/camel-k/v2/pkg/controller/build/monitor_routine.go:167"}
{"level":"info","ts":"2023-12-22T18:09:27Z","logger":"camel-k.controller.build","msg":"Build duration 17.483306024s","request-namespace":"default","request-name":"timer-log","build-attempt":3,"build-result":"Failed","build-duration":17.483306024,"api-version":"camel.apache.org/v1","kind":"Build","ns":"default","name":"kit-cm2svndvohps73a2vhn0"}
{"level":"error","ts":"2023-12-22T18:09:27Z","logger":"camel-k.controller.build","msg":"Build kit-cm2svndvohps73a2vhn0 failed: : exit status 1","request-namespace":"default","request-name":"kit-cm2svndvohps73a2vhn0","api-version":"camel.apache.org/v1","kind":"Build","ns":"default","name":"kit-cm2svndvohps73a2vhn0","stacktrace":"github.com/apache/camel-k/v2/pkg/util/log.Logger.Errorf\n\tgithub.com/apache/camel-k/v2/pkg/util/log/log.go:66\ngithub.com/apache/camel-k/v2/pkg/controller/build.(*monitorRoutineAction).updateBuildStatus\n\tgithub.com/apache/camel-k/v2/pkg/controller/build/monitor_routine.go:216\ngithub.com/apache/camel-k/v2/pkg/controller/build.(*monitorRoutineAction).runBuild\n\tgithub.com/apache/camel-k/v2/pkg/controller/build/monitor_routine.go:200"}
{"level":"info","ts":"2023-12-22T18:09:27Z","logger":"camel-k.controller.build","msg":"State transition","request-namespace":"default","request-name":"kit-cm2svndvohps73a2vhn0","api-version":"camel.apache.org/v1","kind":"Build","ns":"default","name":"kit-cm2svndvohps73a2vhn0","phase-from":"Running","phase-to":"Failed"}
gansheer commented 10 months ago

@hernanDatgDev it is probably an issue with how the registry secret is managed by the Jib publish strategy. @squakez can you assign this to me ? I will look more into it.

hernanDatgDev commented 10 months ago

@gansheer Unfortunately I'm still facing this unauthorized 401 registry issue with the latest release 2.2.0 This occurs in both my docker-desktop cluster and a local Minikube (with & without internal registry enabled) Were you able to reproduce the error?

These are the latest steps I have for v 2.2.0:

  1. kamel install --registry docker.io --organization hguardado --registry-secret dockerhub-cred \ --build-publish-strategy Jib
  2. kamel run src/main/groovy/timer-log.groovy --dev

Log snippet from builder pod init-container: jib

{"level":"error","ts":"2024-01-08T20:47:58Z","logger":"camel-k.maven.build","msg":"Failed to execute goal com.google.cloud.tools:jib-maven-plugin:3.3.2:build (default-cli) on project camel-k-integration: Build image failed, perhaps you should make sure your credentials for 'registry-1.docker.io/hguardado/camel-k-kit-cme5uej3kd2c73eeqvqg' are set up correctly. See https://github.com/GoogleContainerTools/jib/blob/master/docs/faq.md#what-should-i-do-when-the-registry-responds-with-unauthorized for help: Unauthorized for registry-1.docker.io/hguardado/camel-k-kit-cme5uej3kd2c73eeqvqg: 401 Unauthorized

Full log: builder.log

📓 Note: I've tried both with and without build pod enabled. I thought builder pod was default for jib however I have not seen this behavior. By default my jib build occurs within operator.

gansheer commented 10 months ago

@hernanDatgDev Thanks for giving the detail of your installation.

I identified what you report while working on this issue #5017. There are definitely some multiple custom behavior on what registry URL is used when dealing with docker hub registry via docker.io. This will be fixed in #5017.

I will try to give you some workaround when I have more informations.

gansheer commented 10 months ago

@hernanDatgDev To make it work with Jib you have two possibilities:

  1. access to the docker hub registry via registry-1.docker.io: kamel install --registry registry-1.docker.io. That means using it also as you auth server in your secret: {"auths":{"registry-1.docker.io":{"xxxx","password":"xxxx","auth":"xxxxx"}}}.

  2. access to the docker hub registry via docker.io: kamel install --registry docker.io. That means using it also as you auth server in your secret: {"auths":{"docker.io":{"xxxx","password":"xxxx","auth":"xxxxx"}}}.

hernanDatgDev commented 10 months ago

Hey @gansheer, unfortunately neither of these options worked for me and I tried other possibilities as well, but no luck. After all attempts I tried with the latest 2.3.0-SNAPSHOT and I got the expected behavior. For now this will work since I can proceed with my task. I'm still not sure what the issue is however I suspect there is some default docker values that are overriding whatever I input as you mentioned in #5017. I'm guessing this is the case because of the "/v2" I saw appended to my registry parameters in the logs despite explicitly defining only "v1"

gansheer commented 10 months ago

You are right, it does not work in 2.2.0 release but works in 2.3.0-SNAPSHOT. The fix is not in the 2.2.0 release but will be part of the next one.

hernanDatgDev commented 9 months ago

@gansheer What would it look like to take the 2.2.0 fix RE this issue and patch it for v2.1.x? Could it really be as simple as taking the authentication refactoring you did and applying it to 2.1? My only concern is that the fix you made applies to errors seen w/ 2.2.0 and not with 2.1.0. I'm bringing this up again because my team and I tried using the JIB publishing strategy with a fresh Azure cluster and camel-k 2.1.0 and got similar errors with Jib as I did when I logged this ticket with my personal cluster and camel-k 2.1.0

hernanDatgDev commented 9 months ago

@gansheer I tried applying your fix to 2.1.0 and the Jib strategy is working as expected. I believe that the logging in 2.1.0 w/ Jib simply was not detailed enough so the errors I was getting were hiding the fact that there was an issue with the container registry. I'm willing to make a PR for patching 2.1.0 but I must admit I'm not sure what the patching process looks like.

squakez commented 9 months ago

We can backport to 2.1.x and if it's an issue that is blocking any production behavior we can make a patch release accordingly.

gansheer commented 9 months ago

@hernanDatgDev To make a backport you just need to do a PR on the release-2.1.x branch with the backported code.

hernanDatgDev commented 9 months ago

@gansheer I've made the PR. Also I noticed there aren't any tests for the publish strategies. Would you happen to know if this is intentional?

gansheer commented 9 months ago

The jib strategy are tested in e2e test - the builder workflow. The e2e tests are thoses executed with a kubernetes environment. Also the default strategy is used in lots of the other e2e tests that build any integration kit to run an integration. On main branch it has been changed as the default startegy replacing spectrum, so from now on the jib strategy it will be used by all e2e tests.