platform

package
v1.44.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultPlatformName is the standard name used for the platform.
	DefaultPlatformName = "kogito-serverless-platform"

	OperatorWatchNamespaceEnvVariable = "WATCH_NAMESPACE"
)
View Source
const OperatorLockName = "kogito-serverless-lock"

Variables

This section is empty.

Functions

func ConfigureDefaults

func ConfigureDefaults(ctx context.Context, c client.Client, p *operatorapi.SonataFlowPlatform, verbose bool) error

func ConfigureRegistry

func ConfigureRegistry(ctx context.Context, c client.Client, p *operatorapi.SonataFlowPlatform, verbose bool) error

func GetActivePlatform

func GetActivePlatform(ctx context.Context, c ctrl.Reader, namespace string) (*operatorapi.SonataFlowPlatform, error)

GetActivePlatform returns the currently installed active platform in the local namespace.

func GetCustomizedDockerfile added in v1.41.0

func GetCustomizedDockerfile(dockerfile string, platform operatorapi.SonataFlowPlatform) string

GetCustomizedDockerfile gets the Dockerfile as defined in the default platform ConfigMap, apply any custom requirements and return.

func GetLocalPlatform

func GetLocalPlatform(ctx context.Context, c ctrl.Reader, namespace string, active bool) (*operatorapi.SonataFlowPlatform, error)

GetLocalPlatform returns the currently installed platform or any platform existing in local namespace.

func GetOperatorLockName

func GetOperatorLockName(operatorID string) string

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 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 IsKanikoCacheEnabled added in v1.40.0

func IsKanikoCacheEnabled(platform *v08.SonataFlowPlatform) bool

func IsNamespaceLocked

func IsNamespaceLocked(ctx context.Context, c ctrl.Reader, namespace string) (bool, error)

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

func IsOperatorHandler(object ctrl.Object) bool

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 ListAllPlatforms

func ListAllPlatforms(ctx context.Context, c ctrl.Reader, namespace string) (*operatorapi.SonataFlowPlatformList, error)

ListAllPlatforms returns all platforms installed in a given namespace.

func ListPrimaryPlatforms

func ListPrimaryPlatforms(ctx context.Context, c ctrl.Reader, namespace string) (*operatorapi.SonataFlowPlatformList, error)

ListPrimaryPlatforms returns all non-secondary platforms installed in a given namespace (only one will be active).

func SetPlatformDefaults

func SetPlatformDefaults(p *operatorapi.SonataFlowPlatform, verbose bool) error

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, 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 NewWarmAction

func NewWarmAction(reader ctrl.Reader) Action

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.

type ResourceCustomizer

type ResourceCustomizer func(object ctrl.Object) ctrl.Object

ResourceCustomizer can be used to inject code that changes the objects before they are created.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL