Integration fails to retrieve the publish task and the image digest on OCP
What happened?
When using build strategy pod on OCP the integration build is marked as Phase=Error because the image digest is not available.
The build condition state that causes the build to fail:
message: ' publishing task completed but no digest is available in container status. Make sure that the process successfully push the image to the registry and write its digest to /dev/termination-log'
reason: ImageDigestAvailable
status: 'False'
type: ImageDigestAvailable
I noticed that the monitor action is not able to determine the publish task name from the list of build tasks although it is there in the build spec.
spec:
configuration: {}
tasks:
- builder:
baseImage: 'eclipse-temurin:17'
configuration:
#...
- package:
baseImage: 'eclipse-temurin:17'
configuration:
# ...
- s2i:
configuration: {}
name: s2i
tag: '3804935125'
Having a look into the code it assumes that the last task in the build spec is the publish task and retrieves the name of that task. But for some reason the ordering of tasks in the spec may not be the same in different environments. I have seen this on OCP that the publish task is not the last task in the list. As a result of this the task name is empty which leads to the ImageDigestAvailable condition failure as seen above.
Unfortunately the Integration status does not reflect this build/integration kit error root cause at all.
message: integration kit camel-k-operator/kit-cosstuufr893vlutccf0 is in state "Error"
reason: IntegrationKitAvailable
status: 'False'
type: IntegrationKitAvailable
It would be good to see the build error cause with ImageDigestAvailable=false in the IntegrationKitAvailable status.
Also, the operator logs should reveal the error status of the Build with the ImageDigestAvailable error. At the moment there is not real evidence of the error root cause unless you have a look into the build status.
Also, as a result of the missing integration kit a trait execution failure on the mount trait is reported on the Integration resource which is quite misleading.
message: 'error during trait customization: mount trait execution failed: unable to find integration container: roll-dice'
reason: InitializationFailed
status: 'False'
type: Ready
Steps to reproduce
- Install Camel K 2.3.0 on OCP
- Set build strategy on IntegrationPlatform to
pod - Run an integration
- See the Integration, IntegrationKit and Build in error Phase
Relevant log output
{"level":"info","ts":"2024-05-07T06:50:20Z","logger":"camel-k.controller.integrationkit","msg":"Invoking action error","request-namespace":"camel-k-operator","request-name":"kit-cosstuufr893vlutccf0","api-version":"camel.apache.org/v1","kind":"IntegrationKit","ns":"camel-k-operator","name":"kit-cosstuufr893vlutccf0"}
{"level":"info","ts":"2024-05-07T06:50:20Z","logger":"camel-k.controller.integration","msg":"State transition","request-namespace":"camel-k-operator","request-name":"roll-dice","api-version":"camel.apache.org/v1","kind":"Integration","ns":"camel-k-operator","name":"roll-dice","phase-from":"Building Kit","phase-to":"Error"}
{"level":"error","ts":"2024-05-07T06:50:20Z","msg":"Reconciler error","controller":"integration-controller","controllerGroup":"camel.apache.org","controllerKind":"Integration","Integration":{"name":"roll-dice","namespace":"camel-k-operator"},"namespace":"camel-k-operator","name":"roll-dice","reconcileID":"deedb3f9-a496-4ea2-82db-f5e99955190e","error":"error during trait customization: mount trait execution failed: unable to find integration container: roll-dice","stacktrace":"sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\tsigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:324\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\tsigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:265\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2\n\tsigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:226"}
Camel K version
2.3.0
Fixed by https://github.com/apache/camel-k/pull/5435
It did not make time to put it into 2.3.1, we will do a patch release asap. In the while, stick to routine builder pod strategy.