Documentation ¶
Index ¶
- func DeploymentCreator(workflow *operatorapi.SonataFlow, plf *operatorapi.SonataFlowPlatform) (client.Object, error)
- func EnsureDeployment(original *appsv1.Deployment, object *appsv1.Deployment) error
- func EnsureKService(original *servingv1.Service, object *servingv1.Service) error
- func GetDeploymentUnavailabilityMessage(deployment *appsv1.Deployment) string
- func KServiceCreator(workflow *operatorapi.SonataFlow, plf *operatorapi.SonataFlowPlatform) (client.Object, error)
- func ManagedPropsConfigMapCreator(workflow *operatorapi.SonataFlow, platform *operatorapi.SonataFlowPlatform) (client.Object, error)
- func OpenShiftRouteCreator(workflow *operatorapi.SonataFlow) (client.Object, error)
- func ServiceCreator(workflow *operatorapi.SonataFlow) (client.Object, error)
- func ServiceMonitorCreator(workflow *operatorapi.SonataFlow) (client.Object, error)
- func SinkBindingCreator(workflow *operatorapi.SonataFlow, plf *operatorapi.SonataFlowPlatform) (client.Object, error)
- func TriggersCreator(workflow *operatorapi.SonataFlow, plf *operatorapi.SonataFlowPlatform) ([]client.Object, error)
- func UserPropsConfigMapCreator(workflow *operatorapi.SonataFlow) (client.Object, error)
- type KnativeEventingHandler
- type MutateVisitor
- func DeploymentMutateVisitor(workflow *operatorapi.SonataFlow, plf *operatorapi.SonataFlowPlatform) MutateVisitor
- func ImageDeploymentMutateVisitor(workflow *operatorapi.SonataFlow, image string) MutateVisitor
- func ImageKServiceMutateVisitor(workflow *operatorapi.SonataFlow, image string) MutateVisitor
- func KServiceMutateVisitor(workflow *operatorapi.SonataFlow, plf *operatorapi.SonataFlowPlatform) MutateVisitor
- func ManagedPropertiesMutateVisitor(ctx context.Context, catalog discovery.ServiceCatalog, ...) MutateVisitor
- func RestoreDeploymentVolumeAndVolumeMountMutateVisitor() MutateVisitor
- func RestoreKServiceVolumeAndVolumeMountMutateVisitor() MutateVisitor
- func RolloutDeploymentIfCMChangedMutateVisitor(workflow *operatorapi.SonataFlow, userPropsCM *corev1.ConfigMap, ...) MutateVisitor
- func ServiceMutateVisitor(workflow *operatorapi.SonataFlow) MutateVisitor
- type ObjectCreator
- type ObjectCreatorWithPlatform
- type ObjectEnsurer
- type ObjectEnsurerResult
- type ObjectEnsurerWithPlatform
- type ObjectsCreator
- type ObjectsCreatorWithPlatform
- type ObjectsEnsurer
- type ObjectsEnsurerWithPlatform
- type Reconciler
- type ReconciliationStateMachine
- type StateSupport
- type StatusEnricher
- type StatusEnricherFn
- type WorkflowDeploymentManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeploymentCreator ¶
func DeploymentCreator(workflow *operatorapi.SonataFlow, plf *operatorapi.SonataFlowPlatform) (client.Object, error)
DeploymentCreator is an objectCreator for a base Kubernetes Deployments for profiles that need to deploy the workflow on a vanilla deployment. It serves as a basis for a basic Quarkus Java application, expected to listen on http 8080.
func EnsureDeployment ¶
func EnsureDeployment(original *appsv1.Deployment, object *appsv1.Deployment) error
EnsureDeployment Ensure that the original Deployment fields are immutable.
func EnsureKService ¶
EnsureKService Ensure that the original Knative Service fields are immutable.
func GetDeploymentUnavailabilityMessage ¶
func GetDeploymentUnavailabilityMessage(deployment *appsv1.Deployment) string
GetDeploymentUnavailabilityMessage gets the replica failure reason. MUST be called after checking that the Deployment is NOT available. If there's no reason, the Deployment state has no apparent reason to be in failed state.
func KServiceCreator ¶
func KServiceCreator(workflow *operatorapi.SonataFlow, plf *operatorapi.SonataFlowPlatform) (client.Object, error)
KServiceCreator creates the default Knative Service object for SonataFlow instances. It's based on the default DeploymentCreator.
func ManagedPropsConfigMapCreator ¶
func ManagedPropsConfigMapCreator(workflow *operatorapi.SonataFlow, platform *operatorapi.SonataFlowPlatform) (client.Object, error)
ManagedPropsConfigMapCreator creates an empty ConfigMap to hold the external application properties
func OpenShiftRouteCreator ¶
func OpenShiftRouteCreator(workflow *operatorapi.SonataFlow) (client.Object, error)
OpenShiftRouteCreator is an ObjectCreator for a basic Route for a workflow running on OpenShift. It enables the exposition of the service using an OpenShift Route. See: https://github.com/openshift/api/blob/d170fcdc0fa638b664e4f35f2daf753cb4afe36b/route/v1/route.crd.yaml
func ServiceCreator ¶
func ServiceCreator(workflow *operatorapi.SonataFlow) (client.Object, error)
ServiceCreator is an objectCreator for a basic Service aiming a vanilla Kubernetes Deployment. It maps the default HTTP port (80) to the target Java application webserver on port 8080.
func ServiceMonitorCreator ¶
func ServiceMonitorCreator(workflow *operatorapi.SonataFlow) (client.Object, error)
ServiceMonitorCreator is an ObjectsCreator for Service Monitor for the workflow service.
func SinkBindingCreator ¶
func SinkBindingCreator(workflow *operatorapi.SonataFlow, plf *operatorapi.SonataFlowPlatform) (client.Object, error)
SinkBindingCreator is an ObjectsCreator for SinkBinding. It will create v1.SinkBinding based on events defined in workflow.
func TriggersCreator ¶
func TriggersCreator(workflow *operatorapi.SonataFlow, plf *operatorapi.SonataFlowPlatform) ([]client.Object, error)
TriggersCreator is an ObjectsCreator for Triggers. It will create a list of eventingv1.Trigger based on events defined in workflow.
func UserPropsConfigMapCreator ¶
func UserPropsConfigMapCreator(workflow *operatorapi.SonataFlow) (client.Object, error)
UserPropsConfigMapCreator creates an empty ConfigMap to hold the user application properties
Types ¶
type KnativeEventingHandler ¶
type KnativeEventingHandler interface {
Ensure(ctx context.Context, workflow *operatorapi.SonataFlow) ([]client.Object, error)
}
func NewKnativeEventingHandler ¶
func NewKnativeEventingHandler(support *StateSupport, pl *operatorapi.SonataFlowPlatform) KnativeEventingHandler
type MutateVisitor ¶
type MutateVisitor func(object client.Object) controllerutil.MutateFn
MutateVisitor is a visitor function that mutates the given object before performing any updates in the cluster. It gets called after the objectEnforcer reference.
The defaultObjectEnsurer will call the returned MutateVisitor function after creating the given object structure, so callers is ensured to have the default reference of the given object.
Usually you can safely do `object.(*<kubernetesType>).Spec...` since you control the ObjectCreator.
Example: `object.(*appsv1.Deployment).Spec.Template.Name="myApp"` to change the pod's name.
func DeploymentMutateVisitor ¶
func DeploymentMutateVisitor(workflow *operatorapi.SonataFlow, plf *operatorapi.SonataFlowPlatform) MutateVisitor
DeploymentMutateVisitor guarantees the state of the default Deployment object
func ImageDeploymentMutateVisitor ¶
func ImageDeploymentMutateVisitor(workflow *operatorapi.SonataFlow, image string) MutateVisitor
ImageDeploymentMutateVisitor creates a visitor that mutates a vanilla Kubernetes Deployment to apply the given image in the DefaultContainerName container Only overrides the image if .spec.podTemplate.container.Image is empty.
func ImageKServiceMutateVisitor ¶
func ImageKServiceMutateVisitor(workflow *operatorapi.SonataFlow, image string) MutateVisitor
ImageKServiceMutateVisitor same as ImageDeploymentMutateVisitor for Knative Serving
func KServiceMutateVisitor ¶
func KServiceMutateVisitor(workflow *operatorapi.SonataFlow, plf *operatorapi.SonataFlowPlatform) MutateVisitor
KServiceMutateVisitor guarantees the state of the default Knative Service object
func ManagedPropertiesMutateVisitor ¶
func ManagedPropertiesMutateVisitor(ctx context.Context, catalog discovery.ServiceCatalog, workflow *operatorapi.SonataFlow, plf *operatorapi.SonataFlowPlatform, userProps *corev1.ConfigMap) MutateVisitor
func RestoreDeploymentVolumeAndVolumeMountMutateVisitor ¶
func RestoreDeploymentVolumeAndVolumeMountMutateVisitor() MutateVisitor
func RestoreKServiceVolumeAndVolumeMountMutateVisitor ¶
func RestoreKServiceVolumeAndVolumeMountMutateVisitor() MutateVisitor
func RolloutDeploymentIfCMChangedMutateVisitor ¶
func RolloutDeploymentIfCMChangedMutateVisitor(workflow *operatorapi.SonataFlow, userPropsCM *corev1.ConfigMap, managedPropsCM *corev1.ConfigMap) MutateVisitor
RolloutDeploymentIfCMChangedMutateVisitor forces a pod refresh if the workflow definition suffered any changes. This method can be used as an alternative to the Kubernetes ConfigMap refresher.
func ServiceMutateVisitor ¶
func ServiceMutateVisitor(workflow *operatorapi.SonataFlow) MutateVisitor
type ObjectCreator ¶
type ObjectCreator func(workflow *operatorapi.SonataFlow) (client.Object, error)
ObjectCreator is the func that creates the initial reference object, if the object doesn't exist in the cluster, this one is created. Can be used as a reference to keep the object immutable
type ObjectCreatorWithPlatform ¶
type ObjectCreatorWithPlatform func(workflow *operatorapi.SonataFlow, platform *operatorapi.SonataFlowPlatform) (client.Object, error)
ObjectCreatorWithPlatform is the func equivalent to ObjectCreator to use when the resource being created needs a reference to the SonataFlowPlatform
type ObjectEnsurer ¶
type ObjectEnsurer interface {
Ensure(ctx context.Context, workflow *operatorapi.SonataFlow, visitors ...MutateVisitor) (client.Object, controllerutil.OperationResult, error)
}
func NewNoopObjectEnsurer ¶
func NewNoopObjectEnsurer() ObjectEnsurer
NewNoopObjectEnsurer see noopObjectEnsurer
func NewObjectEnsurer ¶
func NewObjectEnsurer(client client.Client, creator ObjectCreator) ObjectEnsurer
NewObjectEnsurer see defaultObjectEnsurer
type ObjectEnsurerResult ¶
type ObjectEnsurerResult struct { client.Object Result controllerutil.OperationResult Error error }
type ObjectEnsurerWithPlatform ¶
type ObjectEnsurerWithPlatform interface {
Ensure(ctx context.Context, workflow *operatorapi.SonataFlow, pl *operatorapi.SonataFlowPlatform, visitors ...MutateVisitor) (client.Object, controllerutil.OperationResult, error)
}
func NewObjectEnsurerWithPlatform ¶
func NewObjectEnsurerWithPlatform(client client.Client, creator ObjectCreatorWithPlatform) ObjectEnsurerWithPlatform
NewObjectEnsurerWithPlatform see defaultObjectEnsurerWithPLatform
type ObjectsCreator ¶
type ObjectsCreator func(workflow *operatorapi.SonataFlow) ([]client.Object, error)
ObjectsCreator creates multiple resources
type ObjectsCreatorWithPlatform ¶
type ObjectsCreatorWithPlatform func(workflow *operatorapi.SonataFlow, platform *operatorapi.SonataFlowPlatform) ([]client.Object, error)
ObjectsCreatorWithPlatform creates multiple resources
type ObjectsEnsurer ¶
type ObjectsEnsurer interface {
Ensure(ctx context.Context, workflow *operatorapi.SonataFlow, visitors ...MutateVisitor) []ObjectEnsurerResult
}
ObjectsEnsurer is an ensurer to apply multiple objects
func NewObjectsEnsurer ¶
func NewObjectsEnsurer(client client.Client, creator ObjectsCreator) ObjectsEnsurer
type ObjectsEnsurerWithPlatform ¶
type ObjectsEnsurerWithPlatform interface {
Ensure(ctx context.Context, workflow *operatorapi.SonataFlow, pl *operatorapi.SonataFlowPlatform, visitors ...MutateVisitor) []ObjectEnsurerResult
}
ObjectsEnsurer is an ensurer to apply multiple objects
func NewObjectsEnsurerWithPlatform ¶
func NewObjectsEnsurerWithPlatform(client client.Client, creator ObjectsCreatorWithPlatform) ObjectsEnsurerWithPlatform
type Reconciler ¶
type Reconciler struct { *StateSupport // contains filtered or unexported fields }
Reconciler is the base structure used by every reconciliation profile. Use NewReconciler to build a new reference.
func NewReconciler ¶
func NewReconciler(support *StateSupport, stateMachine *ReconciliationStateMachine) Reconciler
func (*Reconciler) Reconcile ¶
func (b *Reconciler) Reconcile(ctx context.Context, workflow *operatorapi.SonataFlow) (ctrl.Result, error)
Reconcile does the actual reconciliation algorithm based on a set of ReconciliationState
type ReconciliationStateMachine ¶
type ReconciliationStateMachine struct {
// contains filtered or unexported fields
}
ReconciliationStateMachine implements (sort of) the command pattern and delegate to a chain of ReconciliationState the actual task to reconcile in a given workflow condition
TODO: implement state transition, so based on a given condition we do the status update which actively transition the object state
func NewReconciliationStateMachine ¶
func NewReconciliationStateMachine(states ...profiles.ReconciliationState) *ReconciliationStateMachine
NewReconciliationStateMachine builder for the ReconciliationStateMachine
type StateSupport ¶
type StateSupport struct { C client.Client Cfg *rest.Config Catalog discovery.ServiceCatalog Recorder record.EventRecorder }
StateSupport is the shared structure with common accessors used throughout the whole reconciliation profiles
func (*StateSupport) PerformStatusUpdate ¶
func (s *StateSupport) PerformStatusUpdate(ctx context.Context, workflow *operatorapi.SonataFlow) (bool, error)
PerformStatusUpdate updates the SonataFlow Status conditions
type StatusEnricher ¶
type StatusEnricher struct { C client.Client Config *rest.Config Enricher StatusEnricherFn }
StatusEnricher ...
func NewStatusEnricher ¶
func NewStatusEnricher(client client.Client, enricher StatusEnricherFn) *StatusEnricher
NewStatusEnricher ...
func (*StatusEnricher) Enrich ¶
func (d *StatusEnricher) Enrich(ctx context.Context, workflow *operatorapi.SonataFlow) (controllerutil.OperationResult, error)
type StatusEnricherFn ¶
type StatusEnricherFn func(ctx context.Context, client client.Client, workflow *operatorapi.SonataFlow) (client.Object, error)
StatusEnricherFn is the func that creates the initial reference object, if the object doesn't exist in the cluster, this one is created. Can be used as a reference to keep the object immutable
type WorkflowDeploymentManager ¶
type WorkflowDeploymentManager interface { // SyncDeploymentStatus updates the workflow status aligned with the deployment counterpart. // For example, if the deployment is in a failed state, it sets the status to // Running `false` and the Message and Reason to human-readable format. SyncDeploymentStatus(ctx context.Context, workflow *operatorapi.SonataFlow) (ctrl.Result, error) // RolloutDeployment rolls out the underlying deployment object for the given workflow. RolloutDeployment(ctx context.Context, workflow *operatorapi.SonataFlow) error }
WorkflowDeploymentManager interface to handle workflow deployment features.
func DeploymentManager ¶
func DeploymentManager(c client.Client) WorkflowDeploymentManager
DeploymentManager creates a new WorkflowDeploymentManager implementation based on the current profile.