workflowdef

package
v0.0.0-...-fd86124 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2024 License: Apache-2.0 Imports: 16 Imported by: 1

Documentation

Index

Constants

View Source
const KogitoWorkflowJSONFileExt = ".sw.json"

Variables

This section is empty.

Functions

func ContainsEventKind

func ContainsEventKind(workflow *operatorapi.SonataFlow, eventKind cncfmodel.EventKind) bool

func CreateNewConfigMap

func CreateNewConfigMap(workflow *operatorapi.SonataFlow) (*corev1.ConfigMap, error)

CreateNewConfigMap creates a new configMap object instance with the workflow definition based on the given SonataFlow custom resource. It does not persist the CM into the Kubernetes storage. The name and namespace are the same of the given CR.

func ExternalResCMsToVolumesAndMount

func ExternalResCMsToVolumesAndMount(configMaps []operatorapi.ConfigMapWorkflowResource, baseMountPath string) ([]corev1.Volume, []corev1.VolumeMount)

ExternalResCMsToVolumesAndMount creates volume mounts for ExtResType ConfigMaps references. See FetchExternalResourcesConfigMapsRef that should return the maps needed as input for this function. `baseMountPath` is a string with the base mount path to join with the given relative path in the configMap reference.

func FetchExternalResourcesConfigMapsRef

func FetchExternalResourcesConfigMapsRef(client client.Client, workflow *operatorapi.SonataFlow) ([]operatorapi.ConfigMapWorkflowResource, error)

FetchExternalResourcesConfigMapsRef fetches the Resource ConfigMaps into a LocalObjectReference that a client can mount to the workflow application. The map format is map[<resource_type>]<ConfigMap_reference>. For example map["resource-openapi"]{MyOpenApisConfigMap}

func GetDefaultImageTag

func GetDefaultImageTag(imgTag string) string

func GetDefaultWorkflowBuilderImageTag

func GetDefaultWorkflowBuilderImageTag() string

func GetDefaultWorkflowDevModeImageTag

func GetDefaultWorkflowDevModeImageTag() string

func GetJSONWorkflow

func GetJSONWorkflow(workflowCR *operatorapi.SonataFlow, ctx context.Context) ([]byte, error)

GetJSONWorkflow return a Kogito compliant JSON format workflow as bytearray give a specific workflow CR

func GetWorkflowAppImageNameTag

func GetWorkflowAppImageNameTag(w *v1alpha08.SonataFlow) string

GetWorkflowAppImageNameTag returns the image name with tag to use for the image to be produced for a given workflow. Before, we generated the tags based on the workflow version annotation, however this produced the following undesired effects. Empirically, it was detected that, if we deploy a workflow several times, for instance, the workflow is deleted for a modification, and then deployed again. When the build cycle is produced, etc., if the workflow version remains the same, e.g. 1.0.0, the bits for the new image are not written in the respective registry (because an image with the given tag already exists), and thus, when the workflow executes the old bits are executed. To avoid this, the workflow version must be changed, for example to 2.0.0, and thus the subsequent image will have a different tag, and the expected bits will be stored at the registry and finally executed. This workflow version bump must be produced by the users, but we don't have control over this. So by now, considering that the operator images build is oriented to "dev" and "preview" scenarios, and not for "production" scenarios, we decided to use "latest" as the tag. In that way, we ensure that the last image produced bits will be used to execute a given workflow.

func GetWorkflowDefFileName

func GetWorkflowDefFileName(workflow *operatorapi.SonataFlow) string

GetWorkflowDefFileName returns the default workflow file definition that should be injected/mounted to a workflow application given a SonataFlow CR.

func HasCallbackStateTimeouts

func HasCallbackStateTimeouts(state *model.CallbackState) bool

func HasEventStateTimeouts

func HasEventStateTimeouts(state *model.EventState) bool

func HasForEachStateTimeouts

func HasForEachStateTimeouts(state *model.ForEachState) bool

func HasOperationStateTimeouts

func HasOperationStateTimeouts(state *model.OperationState) bool

func HasParallelStateTimeouts

func HasParallelStateTimeouts(state *model.ParallelState) bool

func HasSwitchStateTimeouts

func HasSwitchStateTimeouts(state *model.SwitchState) bool

func HasTimeouts

func HasTimeouts(workflow *operatorapi.SonataFlow) bool

HasTimeouts returns true if current workflow has configured any of the SonataFlow supported timeouts, false in any other case. This method might be reviewed when more timeouts are supported.

func HasWorkflowEventTimeout

func HasWorkflowEventTimeout(flow *operatorapi.Flow) bool

func HasWorkflowExecTimeout

func HasWorkflowExecTimeout(flow *operatorapi.Flow) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL