Uploaded image for project: 'Kogito'
  1. Kogito
  2. KOGITO-9263

[Operator] Enforce ConfigMap mount path for files referenced by the function definition

    XMLWordPrintable

Details

    • 2023 Week 21-23 (from May 22)

    Description

      Today, every ConfigMap external resource definition mounted to the workflow pod is using the src/main/resources by default.

      But a workflow might have the following definition:

      {
      "functions": [
          {
            "name": "isWinner",
            "operation": "specs/workflow-service-openapi.json#isWinner",
            "type": "rest"
          }
        ]
      }
      

      In a situation like this, the ConfigMap in the workflow annotation resource-openapi must have a key named "workflow-service-openapi.json" and the mount path must be src/main/resources/specs. Otherwise, the application will fail to find the given resource.

      What we will do to provide more flexibility is to get rid of the "resources types" in the annotation and use the resources attribute instead in the KogitoServerlessWorkflow structure.

      So in the example above, we have a ConfigMap like:

      apiVersion: v1
      data: 
        - supplier.yaml: ...
      metadata: 
        name: openapi-configmap
      kind: ConfigMap
      

      And the workflow:

      apiVersion: sw.kogito.kie.org/v1alpha08
      kind: KogitoServerlessWorkflow
      metadata: 
        name: serverless-workflow-service-calls-quarkus
        annotations: 
          sw.kogito.kie.org/description: Serverless Workflow Service calls example on k8s!
          sw.kogito.kie.org/version: 0.0.1
          sw.kogito.kie.org/profile: dev
      spec: 
          flow: 
             - 
          resources: 
            - configMaps: 
                   - name: openapi-configmap
                      workflowPath: specs
      

      In this example, the file supplier.yaml will be mounted in src/main/resources/specs/supplier.yaml

      If not specified, the mount path will be in the root of src/main/resources.

      The new workflowproj module (see KOGITO-9177) should also create the ConfigMaps according to this rule.

      Attachments

        Issue Links

          Activity

            People

              rhn-support-zanini Ricardo Zanini Fernandes
              rhn-support-zanini Ricardo Zanini Fernandes
              Tristan Radisson Tristan Radisson
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: