hernanDatgDev opened a new issue, #5752:
URL: https://github.com/apache/camel-k/issues/5752

   ### What happened?
   
   Related [Zulip 
chat](https://camel.zulipchat.com/#narrow/stream/257299-camel-k/topic/Sourceless.20failure.20when.20operator.20applies.20ksvc.20to.20cluster).
   
   📓 Please keep in mind the integrations tested with are "sourceless" i.e. we 
generate and provide our own integration image.
   
   I recently extended the mount trait which allows for emptyDir volumes to be 
mounted in the integration container. On its own this works fine, but fails 
when used with knative:
   ```
   error executing post actions - 1/1 failed: [error during apply resource: 
camel-k/template-health-check: admission webhook 
\"validation.webhook.serving.knative.dev\" denied the request: validation 
failed: expected exactly one, got neither: 
spec.template.spec.volumes[0].configMap, 
spec.template.spec.volumes[0].emptyDir, etc...
   ```
   When the ksvc (knative-service) is applied by the operator, knative doesn't 
recognize the emptyDir volume that came from the mount trait. It's as if the 
volume type is undefined and you can see knative requesting one of the valid 
volume types: configMap, emptyDir, etc...
   We've verified that the ksvc generated by the operator includes the desired 
emptyDir. The error occurs when the ksvc resource is applied by the operator in 
`pkg/trait/deployer.go/serverSideApply()` in the following code snippet:
   ```
       err = env.Client.Patch(env.Ctx, target, ctrl.Apply, ctrl.ForceOwnership, 
ctrl.FieldOwner("camel-k-operator"))
       if err != nil {
           return fmt.Errorf("error during apply resource: %s/%s: %w", 
resource.GetNamespace(), resource.GetName(), err)
       }
   ```
   The reason we believe this is not a knative issue is because when we apply 
the integration without the knative trait, apply a copy of the same ksvc the 
operator generated, everything works. The pod is deployed with the emptyDir 
volume and there is no error from knative.
   
   ### Steps to reproduce
   
   1. Ensure knative is installed properly on your cluster
   2. Deploy a sourceless integration:
   * configure knative-service trait enabled=true & auto=false
   * configure mount trait with an emptyDir volume
   3. The integration fails.
   
   ### Relevant log output
   
   _No response_
   
   ### Camel K version
   
   2.4.0 (pre-release)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to