Documentation ¶
Index ¶
- Constants
- func CreateNewManagedPropsConfigMap(workflow *operatorapi.SonataFlow, properties string) *corev1.ConfigMap
- func CreateNewUserPropsConfigMap(workflow *operatorapi.SonataFlow) *corev1.ConfigMap
- func GetDefaultLabels(workflow *operatorapi.SonataFlow) map[string]string
- func GetManagedPropertiesFileName(workflow *operatorapi.SonataFlow) string
- func GetMergedLabels(workflow *operatorapi.SonataFlow) map[string]string
- func GetWorkflowManagedPropertiesConfigMapName(workflow *operatorapi.SonataFlow) string
- func GetWorkflowUserPropertiesConfigMapName(workflow *operatorapi.SonataFlow) string
- func IsDevProfile(workflow *operatorapi.SonataFlow) bool
- func SetMergedLabels(workflow *operatorapi.SonataFlow, object metav1.Object)
- func SetTypeToObject(obj runtime.Object, s *runtime.Scheme) error
- func SetWorkflowProfile(workflow *operatorapi.SonataFlow, profile metadata.ProfileType)
- type ResourceKind
- type WorkflowProject
- type WorkflowProjectHandler
Constants ¶
const ( // ApplicationPropertiesFileName is the default application properties file name holding user properties ApplicationPropertiesFileName = "application.properties" // LabelApp key to use among object selectors, "app" is used among k8s applications to group objects in some UI consoles LabelApp = "app" // LabelService key to use among object selectors LabelService = metadata.Domain + "/service" // LabelWorkflow specialized label managed by the controller LabelWorkflow = metadata.Domain + "/workflow-app" )
Variables ¶
This section is empty.
Functions ¶
func CreateNewManagedPropsConfigMap ¶
func CreateNewManagedPropsConfigMap(workflow *operatorapi.SonataFlow, properties string) *corev1.ConfigMap
CreateNewManagedPropsConfigMap creates a new ConfigMap object to hold the managed application properties of the workflos.
func CreateNewUserPropsConfigMap ¶
func CreateNewUserPropsConfigMap(workflow *operatorapi.SonataFlow) *corev1.ConfigMap
CreateNewUserPropsConfigMap creates a new empty ConfigMap object to hold the user application properties of the workflow.
func GetDefaultLabels ¶
func GetDefaultLabels(workflow *operatorapi.SonataFlow) map[string]string
GetDefaultLabels gets the default labels based on the given workflow.
func GetManagedPropertiesFileName ¶
func GetManagedPropertiesFileName(workflow *operatorapi.SonataFlow) string
GetManagedPropertiesFileName gets the default ConfigMap name that holds the managed application property for the given workflow
func GetMergedLabels ¶
func GetMergedLabels(workflow *operatorapi.SonataFlow) map[string]string
GetMergedLabels gets labels based on the given workflow, includes their own labels, merged with the default ones.
func GetWorkflowManagedPropertiesConfigMapName ¶
func GetWorkflowManagedPropertiesConfigMapName(workflow *operatorapi.SonataFlow) string
GetWorkflowManagedPropertiesConfigMapName gets the default ConfigMap name that holds the managed application property for the given workflow
func GetWorkflowUserPropertiesConfigMapName ¶
func GetWorkflowUserPropertiesConfigMapName(workflow *operatorapi.SonataFlow) string
GetWorkflowUserPropertiesConfigMapName gets the default ConfigMap name that holds the user application property for the given workflow
func IsDevProfile ¶
func IsDevProfile(workflow *operatorapi.SonataFlow) bool
IsDevProfile detects if the workflow is using the Dev profile or not
func SetMergedLabels ¶
func SetMergedLabels(workflow *operatorapi.SonataFlow, object metav1.Object)
SetMergedLabels adds the merged labels to the given object.
func SetTypeToObject ¶
SetTypeToObject sets the Kind and ApiVersion to a given object since the default constructor won't do it. See: https://github.com/kubernetes/client-go/issues/308#issuecomment-700099260
func SetWorkflowProfile ¶
func SetWorkflowProfile(workflow *operatorapi.SonataFlow, profile metadata.ProfileType)
SetWorkflowProfile adds the profile annotation to the workflow
Types ¶
type ResourceKind ¶
type ResourceKind int
const ( OpenApiResource ResourceKind = iota AsyncApiResource CamelRouteResource GenericResource )
func ParseResourceKind ¶
func ParseResourceKind(contents []byte) ResourceKind
ParseResourceKind tries to parse the contents of the given resource and find the correct type. Async and OpenAPI files are pretty fast to parse (0.00s). Camel and generic files can take a fair price from the CPU (0.03s on the i5) since it takes more processing power.
type WorkflowProject ¶
type WorkflowProject struct { // Workflow the workflow definition Workflow *operatorapi.SonataFlow // Properties the application properties for the workflow Properties *corev1.ConfigMap // Resources any resource that this workflow requires, like an OpenAPI specification file. Resources []*corev1.ConfigMap }
WorkflowProject is a structure to hold every Kubernetes object generated by the given WorkflowProjectHandler handler.
type WorkflowProjectHandler ¶
type WorkflowProjectHandler interface { // Named overwrites the workflow ID. The handler will use this name instead to generate the manifests name. // Remember that together with the Namespace, the Name is the unique key of a Kubernetes object. Named(name string) WorkflowProjectHandler // Profile overrides the default profile (dev) in the generated SonataFlow manifest Profile(profile metadata.ProfileType) WorkflowProjectHandler // WithWorkflow reader for a file or the content stream of a workflow definition. WithWorkflow(reader io.Reader) WorkflowProjectHandler // WithAppProperties reader for a file or the content stream of a workflow application properties. WithAppProperties(reader io.Reader) WorkflowProjectHandler // AddResource reader for a file or the content stream of any resource needed by the workflow. E.g. an OpenAPI specification file. // Name is required, should match the workflow function definition. AddResource(name string, reader io.Reader) WorkflowProjectHandler // AddResourceAt same as AddResource, but defines the path instead of using the default. AddResourceAt(name, path string, reader io.Reader) WorkflowProjectHandler // SaveAsKubernetesManifests saves the project in the given file system path in YAML format. SaveAsKubernetesManifests(path string) error // AsObjects returns a reference to the WorkflowProject holding the Kubernetes Manifests based on your files. AsObjects() (*WorkflowProject, error) }
WorkflowProjectHandler is the description of the handler interface. A handler can generate Kubernetes manifests to deploy a new SonataFlow project in the cluster
func New ¶
func New(namespace string) WorkflowProjectHandler
New is the entry point for this package. You can create a new handler with the given namespace, meaning that every manifest generated will use this namespace.