Documentation
¶
Index ¶
- Constants
- func CreateOrUpdateWithDefaults(ctx context.Context, p *operatorapi.SonataFlowPlatform, verbose bool) error
- func GetActivePlatform(ctx context.Context, c ctrl.Client, namespace string, createIfNotExists bool) (*operatorapi.SonataFlowPlatform, error)
- func GetCustomizedBuilderDockerfile(dockerfile string, platform operatorapi.SonataFlowPlatform) string
- func GetFromImageTagDockerfile(dockerfile string) string
- func GetOperatorLockName(operatorID string) string
- func GetOperatorNamespace() string
- func HandleDBMigrationJob(ctx context.Context, client client.Client, ...) (*operatorapi.SonataFlowPlatform, error)
- func IsActive(p *operatorapi.SonataFlowPlatform) bool
- func IsCurrentOperatorGlobal() bool
- func IsJobsBasedDBMigration(platform *operatorapi.SonataFlowPlatform, ...) bool
- func IsKanikoCacheEnabled(platform *v08.SonataFlowPlatform) bool
- func IsNamespaceLocked(ctx context.Context, c ctrl.Reader, namespace string) (bool, error)
- func IsOperatorAllowedOnNamespace(ctx context.Context, c ctrl.Reader, namespace string) (bool, error)
- func IsOperatorHandler(object ctrl.Object) bool
- func IsOperatorHandlerConsideringLock(ctx context.Context, c ctrl.Reader, namespace string, object ctrl.Object) bool
- func IsSecondary(p *operatorapi.SonataFlowPlatform) bool
- func NewSonataFlowPlatformDBMigrationPhase(status operatorapi.DBMigrationStatus, message string, reason string) *operatorapi.SonataFlowPlatformDBMigrationPhase
- func ReplaceFromImageTagDockerfile(dockerfile string, fromReplacement string) string
- func SafeUpdatePlatform(ctx context.Context, target *operatorapi.SonataFlowPlatform) error
- func SafeUpdatePlatformStatus(ctx context.Context, target *operatorapi.SonataFlowPlatform) error
- func UpdateSonataFlowPlatformDBMigrationPhase(dbMigrationStatus *operatorapi.SonataFlowPlatformDBMigrationPhase, ...) *operatorapi.SonataFlowPlatformDBMigrationPhase
- type Action
- type DBMigrationJobCfg
- type DBMigratorJob
- type DBMigratorJobStatus
- type LocalRegistryHostingV1
- type QuarkusDataSource
- type ResourceCustomizer
Constants ¶
const ( // DefaultPlatformName is the standard name used for the platform. DefaultPlatformName = "kogito-serverless-platform" OperatorWatchNamespaceEnvVariable = "WATCH_NAMESPACE" )
const OperatorLockName = "kogito-serverless-lock"
Variables ¶
This section is empty.
Functions ¶
func CreateOrUpdateWithDefaults ¶
func CreateOrUpdateWithDefaults(ctx context.Context, p *operatorapi.SonataFlowPlatform, verbose bool) error
func GetActivePlatform ¶
func GetActivePlatform(ctx context.Context, c ctrl.Client, namespace string, createIfNotExists bool) (*operatorapi.SonataFlowPlatform, error)
GetActivePlatform returns the currently installed active platform in the local namespace. The parameter createIfNotExists determines if such platform must be created when not exists. Never nil when createsIfNotExists is true, unless an error.
func GetCustomizedBuilderDockerfile ¶
func GetCustomizedBuilderDockerfile(dockerfile string, platform operatorapi.SonataFlowPlatform) string
GetCustomizedBuilderDockerfile determines if the default Dockerfile provided by the sonataflow-operator-builder-config_v1_configmap.yaml must be customized to use a different builder base image, before building a workflow. The following ordered criteria are applied: 1) if the current platform has a configured platform.Spec.Build.Config.BaseImage, that base image must be used. 2) if the current sonataflow-operator-controllers-config.yaml has a configured SonataFlowBaseBuilderImageTag, that base image must be used. 3) No customization apply.
func GetOperatorLockName ¶
GetOperatorLockName returns the name of the lock lease that is electing a leader on the particular namepsace.
func GetOperatorNamespace ¶
func GetOperatorNamespace() string
GetOperatorNamespace returns the namespace where the current operator is located (if set).
func HandleDBMigrationJob ¶
func HandleDBMigrationJob(ctx context.Context, client client.Client, platform *operatorapi.SonataFlowPlatform, psDI services.PlatformServiceHandler, psJS services.PlatformServiceHandler) (*operatorapi.SonataFlowPlatform, error)
HandleDBMigrationJob Creates db migration job and executes it on the cluster
func IsActive ¶
func IsActive(p *operatorapi.SonataFlowPlatform) bool
IsActive determines if the given platform is being used.
func IsCurrentOperatorGlobal ¶
func IsCurrentOperatorGlobal() bool
IsCurrentOperatorGlobal returns true if the operator is configured to watch all namespaces.
func IsJobsBasedDBMigration ¶
func IsJobsBasedDBMigration(platform *operatorapi.SonataFlowPlatform, pshDI services.PlatformServiceHandler, pshJS services.PlatformServiceHandler) bool
IsJobsBasedDBMigration returns whether job based db migration approach is needed?
func IsKanikoCacheEnabled ¶
func IsKanikoCacheEnabled(platform *v08.SonataFlowPlatform) bool
func IsNamespaceLocked ¶
IsNamespaceLocked tells if the namespace contains a lock indicating that an operator owns it.
func IsOperatorAllowedOnNamespace ¶
func IsOperatorAllowedOnNamespace(ctx context.Context, c ctrl.Reader, namespace string) (bool, error)
IsOperatorAllowedOnNamespace returns true if the current operator is allowed to react on changes in the given namespace.
func IsOperatorHandler ¶
IsOperatorHandler Operators matching the annotation operator id are allowed to reconcile. For legacy resources that are missing a proper operator id annotation the default global operator or the local operator in this namespace are candidates for reconciliation.
func IsOperatorHandlerConsideringLock ¶
func IsOperatorHandlerConsideringLock(ctx context.Context, c ctrl.Reader, namespace string, object ctrl.Object) bool
IsOperatorHandlerConsideringLock uses normal IsOperatorHandler checks and adds additional check for legacy resources that are missing a proper operator id annotation. In general two kind of operators race for reconcile these legacy resources. The local operator for this namespace and the default global operator instance. Based on the existence of a namespace lock the current local operator has precedence. When no lock exists the default global operator should reconcile.
func IsSecondary ¶
func IsSecondary(p *operatorapi.SonataFlowPlatform) bool
IsSecondary determines if the given platform is marked as secondary.
func NewSonataFlowPlatformDBMigrationPhase ¶
func NewSonataFlowPlatformDBMigrationPhase(status operatorapi.DBMigrationStatus, message string, reason string) *operatorapi.SonataFlowPlatformDBMigrationPhase
NewSonataFlowPlatformDBMigrationPhase Returns a new DB migration phase for SonataFlowPlatform
func ReplaceFromImageTagDockerfile ¶
ReplaceFromImageTagDockerfile replaces the "FROM" clause from the given dockerfile with the given fromReplacement. For example: "FROM myimage:latest AS builder"
func SafeUpdatePlatform ¶
func SafeUpdatePlatform(ctx context.Context, target *operatorapi.SonataFlowPlatform) error
func SafeUpdatePlatformStatus ¶
func SafeUpdatePlatformStatus(ctx context.Context, target *operatorapi.SonataFlowPlatform) error
func UpdateSonataFlowPlatformDBMigrationPhase ¶
func UpdateSonataFlowPlatformDBMigrationPhase(dbMigrationStatus *operatorapi.SonataFlowPlatformDBMigrationPhase, status operatorapi.DBMigrationStatus, message string, reason string) *operatorapi.SonataFlowPlatformDBMigrationPhase
UpdateSonataFlowPlatformDBMigrationPhase Updates a given SonataFlowPlatformDBMigrationPhase with the supplied values
Types ¶
type Action ¶
type Action interface {
client.Injectable
// a user friendly name for the action
Name() string
// returns true if the action can handle the platform
CanHandle(platform *v08.SonataFlowPlatform) bool
// executes the handling function
Handle(ctx context.Context, platform *v08.SonataFlowPlatform) (*v08.SonataFlowPlatform, *corev1.Event, error)
}
Action --.
func NewCreateAction ¶
func NewCreateAction() Action
NewCreateAction returns an action that creates resources needed by the platform.
func NewInitializeAction ¶
func NewInitializeAction() Action
NewInitializeAction returns an action that initializes the platform configuration when not provided by the user.
func NewMonitorAction ¶
func NewMonitorAction() Action
NewMonitorAction returns an action that monitors the build platform after it's fully initialized.
func NewServiceAction ¶
func NewServiceAction() Action
NewServiceAction returns an action that deploys the services.
func NewWarmAction ¶
type DBMigrationJobCfg ¶
type DBMigratorJob ¶
type DBMigratorJob struct {
MigrateDBDataIndex bool
DataIndexDataSource *QuarkusDataSource
MigrateDBJobsService bool
JobsServiceDataSource *QuarkusDataSource
}
func NewDBMigratorJobData ¶
func NewDBMigratorJobData(ctx context.Context, client client.Client, platform *operatorapi.SonataFlowPlatform, pshDI services.PlatformServiceHandler, pshJS services.PlatformServiceHandler) *DBMigratorJob
func (DBMigratorJob) GetDBMigrationJobStatus ¶
func (dbmj DBMigratorJob) GetDBMigrationJobStatus(ctx context.Context, client client.Client, platform *operatorapi.SonataFlowPlatform) (*DBMigratorJobStatus, error)
GetDBMigrationJobStatus Returns db migration job status
func (DBMigratorJob) ReconcileDBMigrationJob ¶
func (dbmj DBMigratorJob) ReconcileDBMigrationJob(ctx context.Context, client client.Client, platform *operatorapi.SonataFlowPlatform) (*DBMigratorJobStatus, error)
ReconcileDBMigrationJob Check the status of running DB migration job and return status
type DBMigratorJobStatus ¶
type LocalRegistryHostingV1 ¶
type LocalRegistryHostingV1 struct {
// Host documents the host (hostname and port) of the registry, as seen from
// outside the cluster.
//
// This is the registry host that tools outside the cluster should push images
// to.
Host string `yaml:"host,omitempty"`
// HostFromClusterNetwork documents the host (hostname and port) of the
// registry, as seen from networking inside the container pods.
//
// This is the registry host that tools running on pods inside the cluster
// should push images to. If not set, then tools inside the cluster should
// assume the local registry is not available to them.
HostFromClusterNetwork string `yaml:"hostFromClusterNetwork,omitempty"`
// HostFromContainerRuntime documents the host (hostname and port) of the
// registry, as seen from the cluster's container runtime.
//
// When tools apply Kubernetes objects to the cluster, this host should be
// used for image name fields. If not set, users of this field should use the
// value of Host instead.
//
// Note that it doesn't make sense semantically to define this field, but not
// define Host or HostFromClusterNetwork. That would imply a way to pull
// images without a way to push images.
HostFromContainerRuntime string `yaml:"hostFromContainerRuntime,omitempty"`
// Help contains a URL pointing to documentation for users on how to set
// up and configure a local registry.
//
// Tools can use this to nudge users to enable the registry. When possible,
// the writer should use as permanent a URL as possible to prevent drift
// (e.g., a version control SHA).
//
// When image pushes to a registry host specified in one of the other fields
// fail, the tool should display this help URL to the user. The help URL
// should contain instructions on how to diagnose broken or misconfigured
// registries.
Help string `yaml:"help,omitempty"`
}
LocalRegistryHostingV1 describes a local registry that developer tools can connect to. A local registry allows clients to load images into the local cluster by pushing to this registry.