Documentation
¶
Overview ¶
Package platform allows to retrieve information about the current installed platform
Index ¶
- Constants
- Variables
- func AffinityNodeLabelsAllowList() []string
- func ApplyIntegrationProfile(ctx context.Context, c k8sclient.Reader, o k8sclient.Object) (*v1.IntegrationProfile, error)
- func BuilderNodeSelectorAllowList() []string
- func BuilderTasksEnabled() bool
- func ConfigureDefaults(ctx context.Context, c client.Client, p *v1.IntegrationPlatform, verbose bool) error
- func GetEnvOrDefault(key string, def string) string
- func GetForResource(ctx context.Context, c k8sclient.Reader, o k8sclient.Object) (*v1.IntegrationPlatform, error)
- func GetOperatorLockName(operatorID string) string
- func GetOperatorNamespace() string
- func GetOperatorPodName() string
- func GetOperatorWatchNamespace() string
- func GetOrFindLocal(ctx context.Context, c k8sclient.Reader, namespace string) (*v1.IntegrationPlatform, error)
- func GetTraitProfile(p *v1.IntegrationPlatform) v1.TraitProfile
- func InitPlatform()
- func IsActive(p *v1.IntegrationPlatform) bool
- func IsCurrentOperatorGlobal() bool
- func IsMavenRepoAllowed(mavenRepo string) 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 ListPlatforms(ctx context.Context, c k8sclient.Reader, namespace string) (*v1.IntegrationPlatformList, error)
- func LookupForPlatformName(ctx context.Context, c k8sclient.Reader, name string) (*v1.IntegrationPlatform, error)
- func TolerationTaintsAllowList() []string
- type FilteringFuncs
- type Platform
Constants ¶
const ( DefaultPlatformName = "camel-k" DefaultBuildTimeout = 5 * time.Minute DefaultBuildStrategy = v1.BuildStrategyRoutine DefaultBuildOrderStrategy = v1.BuildOrderStrategyDependencies DefaultPublishStrategy = v1.IntegrationPlatformBuildPublishStrategyJib DefaultMavenCLIOptions = "-V,--no-transfer-progress,-Dstyle.color=never" DefaultMaxRunningBuildsPodStrategy = 10 DefaultMaxRunningBuildsRoutineStrategy = 3 )
const ( OperatorWatchNamespaceEnvVariable = "WATCH_NAMESPACE" OperatorBuildStrategyEnvVar = "BUILD_STRATEGY" )
const OperatorLockName = "camel-k-lock"
Variables ¶
var BuilderServiceAccount = getBuilderServiceAccount()
var OperatorImage string
Functions ¶
func AffinityNodeLabelsAllowList ¶ added in v2.11.0
func AffinityNodeLabelsAllowList() []string
AffinityNodeLabelsAllowList returns the list of label keys that are allowed to be used in affinity.nodeAffinityLabels. When the list is empty (AFFINITY_NODE_LABELS_ALLOWED_KEYS is unset or blank), any key is permitted. When the list is non-empty only expressions whose keys are in the list are accepted; others are dropped and an info message is logged by the trait.
func ApplyIntegrationProfile ¶ added in v2.3.0
func ApplyIntegrationProfile(ctx context.Context, c k8sclient.Reader, o k8sclient.Object) (*v1.IntegrationProfile, error)
ApplyIntegrationProfile resolves integration profile from given object.
func BuilderNodeSelectorAllowList ¶ added in v2.11.0
func BuilderNodeSelectorAllowList() []string
BuilderNodeSelectorAllowList returns the list of node-selector keys that are allowed to be set by the builder trait. When the list is empty (BUILDER_NODE_SELECTOR_ALLOWED_LABELS is unset or blank), any key is permitted. When the list is non-empty only the listed keys are accepted; unlisted keys are dropped; an info message is logged by the trait.
func BuilderTasksEnabled ¶ added in v2.11.0
func BuilderTasksEnabled() bool
BuilderTasksEnabled reports whether CR authors are permitted to inject custom pipeline tasks via the builder.tasks trait. Controlled by the BUILDER_TASKS_ENABLED operator environment variable (default false). Set to "false" to prevent custom task injection across all integrations managed by this operator.
func ConfigureDefaults ¶
func ConfigureDefaults(ctx context.Context, c client.Client, p *v1.IntegrationPlatform, verbose bool) error
ConfigureDefaults fills with default values all missing details about the integration platform. Defaults are set in the status fields, not in the spec.
func GetEnvOrDefault ¶ added in v2.11.0
func GetForResource ¶
func GetOperatorLockName ¶
GetOperatorLockName returns the name of the lock lease that is electing a leader on the particular namespace.
func GetOperatorNamespace ¶
func GetOperatorNamespace() string
GetOperatorNamespace returns the namespace where the current operator is located (if set).
func GetOperatorPodName ¶
func GetOperatorPodName() string
GetOperatorPodName returns the pod that is running the current operator (if any).
func GetOperatorWatchNamespace ¶
func GetOperatorWatchNamespace() string
GetOperatorWatchNamespace returns the namespace the operator watches.
func GetOrFindLocal ¶
func GetTraitProfile ¶ added in v2.3.0
func GetTraitProfile(p *v1.IntegrationPlatform) v1.TraitProfile
GetTraitProfile returns the current profile of the platform (if present) or returns the default one for the cluster.
func InitPlatform ¶ added in v2.11.0
func InitPlatform()
InitPlatform is in charge to parse the environment variables of the operator and initialize the environment Platform.
func IsActive ¶
func IsActive(p *v1.IntegrationPlatform) 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 IsMavenRepoAllowed ¶ added in v2.9.3
IsMavenRepoAllowed is used to verify if a given maven repository can be used or not.
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 checks on resource operator id annotation and this operator instance id. 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 ListPlatforms ¶ added in v2.3.0
func ListPlatforms(ctx context.Context, c k8sclient.Reader, namespace string) (*v1.IntegrationPlatformList, error)
ListPlatforms returns all platforms installed in a given namespace.
func LookupForPlatformName ¶
func LookupForPlatformName(ctx context.Context, c k8sclient.Reader, name string) (*v1.IntegrationPlatform, error)
LookupForPlatformName finds integration platform with given operator id as name in any namespace.
func TolerationTaintsAllowList ¶ added in v2.11.0
func TolerationTaintsAllowList() []string
TolerationTaintsAllowList returns the list of taint keys that are allowed to be used in toleration.taints. When the list is empty (TOLERATION_TAINTS_ALLOWED_KEYS is unset or blank), any key is permitted. When the list is non-empty only taints whose key is in the list are accepted; others are dropped and an info message is logged by the trait.
Types ¶
type FilteringFuncs ¶
type FilteringFuncs[T ctrl.Object] struct { // Create returns true if the Create event should be processed CreateFunc func(event.TypedCreateEvent[T]) bool // Delete returns true if the Delete event should be processed DeleteFunc func(event.TypedDeleteEvent[T]) bool // Update returns true if the Update event should be processed UpdateFunc func(event.TypedUpdateEvent[T]) bool // Generic returns true if the Generic event should be processed GenericFunc func(event.TypedGenericEvent[T]) bool }
FilteringFuncs do preliminary checks to determine if certain events should be handled by the controller based on labels on the resources (e.g. camel.apache.org/operator.id) and the operator configuration, before handing the computation over to the user code.
func (FilteringFuncs[T]) Create ¶
func (f FilteringFuncs[T]) Create(e event.TypedCreateEvent[T]) bool
func (FilteringFuncs[T]) Delete ¶
func (f FilteringFuncs[T]) Delete(e event.TypedDeleteEvent[T]) bool
func (FilteringFuncs[T]) Generic ¶
func (f FilteringFuncs[T]) Generic(e event.TypedGenericEvent[T]) bool
func (FilteringFuncs[T]) Update ¶
func (f FilteringFuncs[T]) Update(e event.TypedUpdateEvent[T]) bool
type Platform ¶ added in v2.11.0
type Platform struct {
CatalogNamespace string
BuildRuntimeVersion string
BuildRuntimeProvider v1.RuntimeProvider
BuildTimeout time.Duration
BuildConfiguration v1.BuildConfiguration
BuildBaseImage string
PublishStrategy v1.IntegrationPlatformBuildPublishStrategy
Registry v1.RegistrySpec
Maven v1.MavenBuildSpec
MaxRunningBuilds int32
}
Platform contains a series of configuration required during build and packaging.
func GetPlatform ¶ added in v2.11.0
func GetPlatform(itp *v1.IntegrationPlatform, itpr *v1.IntegrationProfile) Platform
GetPlatform is in charge to return a Platform based on priority: 1. From IntegrationPlatform 2. From IntegrationProfile 3. From default environment variable setting