6.3. Defining global-managed-properties
You can define custom global managed properties for all workflows in a specific namespace by editing the SonataFlowPlatform resource. These properties are defined under the .spec.properties.flow attribute and are automatically applied to every workflow service in the same namespace.
Prerequisites
- You have OpenShift Serverless Logic Operator installed on your cluster.
- You have created your OpenShift Serverless Logic project.
- You have access to a OpenShift Serverless Logic project with the appropriate roles and permissions to create applications and other workloads in OpenShift Container Platform.
-
You have installed the OpenShift CLI (
oc).
Procedure
Locate the
SonataFlowPlatformresource in the same namespace as your workflow services.This is where you will define global managed properties.
Open the
SonataFlowPlatformresource in your default editor by executing the following command:$ oc edit sonataflowplatform sonataflow-platform-exampleDefine custom global managed properties.
In the editor, navigate to the
spec.properties.flowsection and define your desired properties as shown in the following example:Example of a SonataFlowPlatform with flow properties
apiVersion: sonataflow.org/v1alpha08 kind: SonataFlowPlatform metadata: name: sonataflow-platform-example spec: properties: flow:1 - name: quarkus.log.category2 value: INFO3 This configuration adds the
quarkus.log.category=INFOproperty to the managed properties of every workflow service in the namespace.Optional: Use external
ConfigMapsorSecrets.You can also reference values from existing
ConfigMaporSecretresources using thevalueFromattribute as shown in the following example:Example of a SonataFlowPlatform properties from ConfigMap and Secret
apiVersion: sonataflow.org/v1alpha08 kind: SonataFlowPlatform metadata: name: sonataflow-platform-example spec: properties: flow: - name: my.petstore.auth.token valueFrom:1 secretKeyRef: petstore-credentials2 keyName: AUTH_TOKEN - name: my.petstore.url valueFrom: configMapRef: petstore-props3 keyName: PETSTORE_URL- 1
- The
valueFromattribute is derived from the KubernetesEnvVarAPI and works similarly to how environment variables reference external sources. - 2
valueFrom.secretKeyRefpulls the value from a key namedAUTH_TOKENin thepetstore-credentialssecret.- 3
valueFrom.configMapRefpulls the value from a key namedPETSTORE_URLin thepetstore-propsConfigMap.