wmedvede commented on PR #447:
URL: 
https://github.com/apache/incubator-kie-kogito-serverless-operator/pull/447#issuecomment-2100381704

   @ricardozanini OK, I can see what the problem above is:
   
   The workflow I'm using to test the persistence + deploymentMode : knative is 
like this the one below, see that it uses **initiContainers**, which is 
perfectly fine according with the SonataFlow spec. And this works fine for 
kubernetes deployments.
   
   However, knative deployments **don't support initContainers**, and in the 
sonataflow-controller logs we can see this message:
   
   E0508 11:02:32.582067       1 controller.go:324] sonataflow-manager 
"msg"="Reconciler error" "error"="admission webhook 
\"validation.webhook.serving.knative.dev\" denied the request: **validation 
failed: must not set the field(s): spec.template.spec.initContainers\npod spec 
support for init-containers is off, but found 1 init containers**: " 
"SonataFlow"={"name":"callbackstatetimeouts","namespace":"usecase3-persistence"}
 "controller"="sonataflow" "controllerGroup"="sonataflow.org" 
"controllerKind"="SonataFlow" "name"="callbackstatetimeouts" 
"namespace"="usecase3-persistence" 
"reconcileID"="808f0b61-f24c-428c-acbb-c989bc750554"
   
   **I think that the SonataflowController should catch-up this situation and 
produce a validation error, and the documentation should be updated accordingly 
too.**
   
   @ricardozanini feel free to add the validation on this PR or a followup one.
   
   **Workflow used for testing with persistence:**
   
   ```
   apiVersion: sonataflow.org/v1alpha08
   kind: SonataFlow
   metadata:
     name: callbackstatetimeouts
     annotations:
       sonataflow.org/description: Callback State Timeouts Example k8s
       sonataflow.org/version: 0.0.1
   spec:
     persistence:
       postgresql:
         secretRef:
           name: postgres-secrets
           userKey: POSTGRES_USER
           passwordKey: POSTGRES_PASSWORD
         serviceRef:
           name: postgres
           databaseName: sonataflow
           databaseSchema: public
     podTemplate:
       deploymentModel: knative
       initContainers:
         - name: init-postgres
           image: registry.access.redhat.com/ubi9/ubi-minimal:latest
           imagePullPolicy: IfNotPresent
           command: [ 'sh', '-c', 'until (echo 1 > /dev/tcp/postgres.$(cat 
/var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local/5432)
 >/dev/null 2>&1; do echo "Waiting for postgres server"; sleep 3; done;' ]
       container:
         env:
           # by now, when the WF persistence is initialized we don't set 
migration to true.
           # we can re-evaluate to default to true.
           - name: QUARKUS_FLYWAY_MIGRATE_AT_START
             value: 'false'
     flow: bla bla bla
   
   ```
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to