Documentation ¶
Index ¶
- Constants
- func CreateNewAppPropsConfigMap(workflow *operatorapi.SonataFlow, properties string) *corev1.ConfigMap
- func GetDefaultLabels(workflow *operatorapi.SonataFlow) map[string]string
- func GetWorkflowPropertiesConfigMapName(workflow *operatorapi.SonataFlow) string
- func SetDefaultLabels(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 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" // LabelWorkflow specialized label managed by the controller LabelWorkflow = metadata.Domain + "/workflow-app" )
Variables ¶
This section is empty.
Functions ¶
func CreateNewAppPropsConfigMap ¶
func CreateNewAppPropsConfigMap(workflow *operatorapi.SonataFlow, properties string) *corev1.ConfigMap
CreateNewAppPropsConfigMap creates a new ConfigMap object to hold the workflow application properties.
func GetDefaultLabels ¶
func GetDefaultLabels(workflow *operatorapi.SonataFlow) map[string]string
GetDefaultLabels gets the default labels based on the given workflow. You can use SetDefaultLabels that essentially does the same thing, if you don't need the labels explicitly.
func GetWorkflowPropertiesConfigMapName ¶
func GetWorkflowPropertiesConfigMapName(workflow *operatorapi.SonataFlow) string
GetWorkflowPropertiesConfigMapName gets the default ConfigMap name that holds the application property for the given workflow
func SetDefaultLabels ¶
func SetDefaultLabels(workflow *operatorapi.SonataFlow, object metav1.Object)
SetDefaultLabels adds the default workflow application labels to the given object. Overrides the defined labels.
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 // 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. namespace is a required parameter.