Documentation ¶
Overview ¶
Package trait contains implementations of all available traits (features)
Index ¶
- Constants
- Variables
- func AddToTraits(factory Factory)
- func AssertTraitsType(traits interface{}) error
- func CapabilityPropertyKey(camelPropertyKey string, vars map[string]string) string
- func ConfigureTraits(options []string, traits interface{}, catalog Finder) error
- func Equals(i1 Options, i2 Options) bool
- func ExtractAndMaybeDeleteTraits(c client.Client, annotations map[string]string, del bool) (*v1.Traits, error)
- func ExtractSourceDependencies(source v1.SourceSpec, catalog *camel.RuntimeCatalog) (*sets.Set, error)
- func HasMatchingTraits(traitMap Options, kitTraitMap Options) (bool, error)
- func IntegrationAndKameletBindingSameTraits(c client.Client, i1 *v1.Integration, i2 *v1alpha1.KameletBinding) (bool, error)
- func IntegrationAndPipeSameTraits(c client.Client, i1 *v1.Integration, i2 *v1.Pipe) (bool, error)
- func IntegrationsHaveSameTraits(c client.Client, i1 *v1.Integration, i2 *v1.Integration) (bool, error)
- func KameletBindingsHaveSameTraits(c client.Client, i1 *v1alpha1.KameletBinding, i2 *v1alpha1.KameletBinding) (bool, error)
- func MigrateLegacyConfiguration(trait map[string]interface{}) error
- func PipesHaveSameTraits(c client.Client, i1 *v1.Pipe, i2 *v1.Pipe) (bool, error)
- func ToAddonTrait(t *testing.T, config map[string]interface{}) v1.AddonTrait
- func ToPropertyMap(trait interface{}) (map[string]interface{}, error)
- func ToTrait(trait map[string]interface{}, target interface{}) error
- func ValidateTrait(catalog *Catalog, trait string) error
- func ValidateTraits(catalog *Catalog, traits []string) error
- type BasePlatformTrait
- type BaseTrait
- func (trait *BaseTrait) ID() ID
- func (trait *BaseTrait) InfluencesKit() bool
- func (trait *BaseTrait) InjectClient(c client.Client)
- func (trait *BaseTrait) IsAllowedInProfile(v1.TraitProfile) bool
- func (trait *BaseTrait) IsPlatformTrait() bool
- func (trait *BaseTrait) Order() int
- func (trait *BaseTrait) RequiresIntegrationPlatform() bool
- type Catalog
- type Comparable
- type ComparableTrait
- type ControllerStrategy
- type ControllerStrategySelector
- type Environment
- func (e *Environment) DetermineCatalogNamespace() string
- func (e *Environment) DetermineControllerStrategy() (ControllerStrategy, error)
- func (e *Environment) DetermineProfile() v1.TraitProfile
- func (e *Environment) GetIntegrationContainer() *corev1.Container
- func (e *Environment) GetIntegrationContainerName() string
- func (e *Environment) GetIntegrationPodSpec() *corev1.PodSpec
- func (e *Environment) GetTrait(id ID) Trait
- func (e *Environment) InPhase(c v1.IntegrationKitPhase, i v1.IntegrationPhase) bool
- func (e *Environment) IntegrationInPhase(phases ...v1.IntegrationPhase) bool
- func (e *Environment) IntegrationInRunningPhases() bool
- func (e *Environment) IntegrationKitInPhase(phases ...v1.IntegrationKitPhase) bool
- func (e *Environment) PlatformInPhase(phases ...v1.IntegrationPlatformPhase) bool
- type Factory
- type Finder
- type ID
- type Identifiable
- type Options
- func NewSpecTraitsOptionsForIntegration(c client.Client, i *v1.Integration) (Options, error)
- func NewSpecTraitsOptionsForIntegrationAndPlatform(c client.Client, i *v1.Integration, pl *v1.IntegrationPlatform) (Options, error)
- func NewSpecTraitsOptionsForIntegrationKit(c client.Client, i *v1.IntegrationKit) (Options, error)
- func NewTraitsOptionsForKameletBinding(c client.Client, kb *v1alpha1.KameletBinding) (Options, error)
- func NewTraitsOptionsForPipe(c client.Client, pipe *v1.Pipe) (Options, error)
- func ToTraitMap(traits interface{}) (Options, error)
- type Trait
- type TraitCondition
- func NewIntegrationCondition(traitID string, ict v1.IntegrationConditionType, cs corev1.ConditionStatus, ...) *TraitCondition
- func NewIntegrationConditionPlatformDisabledCatalogMissing() *TraitCondition
- func NewIntegrationConditionPlatformDisabledWithMessage(traitID string, message string) *TraitCondition
- func NewIntegrationConditionUserDisabled(traitID string) *TraitCondition
- func NewIntegrationConditionUserEnabledWithMessage(traitID string, message string) *TraitCondition
Constants ¶
const ( // TraitOrderBeforeControllerCreation can be used to inject configuration such as properties and environment variables // into the running integration, before the actual controller is created. TraitOrderBeforeControllerCreation = 850 // TraitOrderControllerSelection can be used if you intend to provide an alternative controller for the integration // (e.g. Deployment, CronJob, ...). TraitOrderControllerSelection = 950 // TraitOrderPostProcessResources is executed after all other traits are executed (except for important core traits such as // the "owner" trait), so it can be used to post-process generated resources before their actual creation. TraitOrderPostProcessResources = 2450 )
A list of named orders, useful for correctly binding addons.
const (
CamelPropertiesType = "camel-properties"
)
const KameletBundleType = "kamelets-bundle"
const (
KameletLocationProperty = "camel.component.kamelet.location"
)
const (
QuarkusNativeDefaultBaseImageName = "quay.io/quarkus/quarkus-micro-image:2.0"
)
Variables ¶
var FactoryList []Factory
FactoryList contains the default list of trait Factory.
Functions ¶
func AssertTraitsType ¶
func AssertTraitsType(traits interface{}) error
AssertTraitsType asserts that traits is either v1.Traits or v1.IntegrationKitTraits. This function is provided because Go doesn't have Either nor union types.
func CapabilityPropertyKey ¶ added in v2.3.0
CapabilityPropertyKey returns the key or expand any variable provided in it. vars variable contain the possible dynamic values to use.
func ConfigureTraits ¶ added in v2.4.0
func ExtractAndMaybeDeleteTraits ¶ added in v2.4.0
func ExtractAndMaybeDeleteTraits(c client.Client, annotations map[string]string, del bool) (*v1.Traits, error)
ExtractAndDeleteTraits will extract the annotation traits into v1.Traits struct, removing from the value from the input map.
func ExtractSourceDependencies ¶
func ExtractSourceDependencies(source v1.SourceSpec, catalog *camel.RuntimeCatalog) (*sets.Set, error)
ExtractSourceDependencies extracts dependencies from source.
func HasMatchingTraits ¶ added in v2.3.0
HasMatchingTraits verifies if two traits options match.
func IntegrationAndKameletBindingSameTraits ¶
func IntegrationAndKameletBindingSameTraits(c client.Client, i1 *v1.Integration, i2 *v1alpha1.KameletBinding) (bool, error)
IntegrationAndKameletBindingSameTraits return if traits are the same. The comparison is done for the subset of traits defines on the binding as during the trait processing, some traits may be added to the Integration i.e. knative configuration in case of sink binding. Deprecated.
func IntegrationAndPipeSameTraits ¶
IntegrationAndPipeSameTraits return if traits are the same. The comparison is done for the subset of traits defines on the binding as during the trait processing, some traits may be added to the Integration i.e. knative configuration in case of sink binding.
func IntegrationsHaveSameTraits ¶
func IntegrationsHaveSameTraits(c client.Client, i1 *v1.Integration, i2 *v1.Integration) (bool, error)
IntegrationsHaveSameTraits return if traits are the same.
func KameletBindingsHaveSameTraits ¶
func KameletBindingsHaveSameTraits(c client.Client, i1 *v1alpha1.KameletBinding, i2 *v1alpha1.KameletBinding) (bool, error)
KameletBindingsHaveSameTraits return if traits are the same. Deprecated.
func MigrateLegacyConfiguration ¶
MigrateLegacyConfiguration moves up the legacy configuration in a trait to the new top-level properties. Values of the new properties always take precedence over the ones from the legacy configuration with the same property names.
func PipesHaveSameTraits ¶
PipesHaveSameTraits return if traits are the same.
func ToAddonTrait ¶
func ToAddonTrait(t *testing.T, config map[string]interface{}) v1.AddonTrait
func ToPropertyMap ¶
ToPropertyMap accepts a trait and converts it to a map of trait properties.
func ValidateTrait ¶ added in v2.4.0
func ValidateTraits ¶ added in v2.4.0
Types ¶
type BasePlatformTrait ¶ added in v2.1.0
type BasePlatformTrait struct {
BaseTrait
}
BasePlatformTrait is the root for platform traits with noop implementations for hooks.
func NewBasePlatformTrait ¶ added in v2.1.0
func NewBasePlatformTrait(id string, order int) BasePlatformTrait
func (*BasePlatformTrait) IsPlatformTrait ¶ added in v2.1.0
func (trait *BasePlatformTrait) IsPlatformTrait() bool
IsPlatformTrait marks all fundamental traits that allow the platform to work.
type BaseTrait ¶
type BaseTrait struct { TraitID ID `json:"-"` Client client.Client `json:"-"` ExecutionOrder int `json:"-"` L log.Logger `json:"-"` }
BaseTrait is the root trait with noop implementations for hooks.
func NewBaseTrait ¶
func (*BaseTrait) InfluencesKit ¶
InfluencesKit determines if the trait has any influence on Integration Kits.
func (*BaseTrait) InjectClient ¶
InjectClient implements client.ClientInject and allows to inject a client into the trait.
func (*BaseTrait) IsAllowedInProfile ¶
func (trait *BaseTrait) IsAllowedInProfile(v1.TraitProfile) bool
IsAllowedInProfile returns true for any profile by default.
func (*BaseTrait) IsPlatformTrait ¶
IsPlatformTrait marks all fundamental traits that allow the platform to work.
func (*BaseTrait) RequiresIntegrationPlatform ¶
RequiresIntegrationPlatform indicates that the trait cannot work without an integration platform set.
type Catalog ¶
Catalog collects all information about traits in one place.
func (*Catalog) Configure ¶
func (c *Catalog) Configure(env *Environment) error
Configure reads trait configurations from environment and applies them to catalog.
func (*Catalog) TraitsForProfile ¶
func (c *Catalog) TraitsForProfile(profile v1.TraitProfile) []Trait
TraitsForProfile returns all traits associated with a given profile.
Traits may depend on the result of previously executed ones, so care must be taken while changing the lists order.
type Comparable ¶
Comparable is the interface exposing comparable funcs.
type ComparableTrait ¶
type ComparableTrait interface { Trait Comparable }
ComparableTrait is the interface used to compare two traits between them.
type ControllerStrategy ¶
type ControllerStrategy string
ControllerStrategy is used to determine the kind of controller that needs to be created for the integration.
const ( ControllerStrategyDeployment ControllerStrategy = "deployment" ControllerStrategyKnativeService ControllerStrategy = "knative-service" ControllerStrategyCronJob ControllerStrategy = "cron-job" DefaultControllerStrategy = ControllerStrategyDeployment )
List of controller strategies.
type ControllerStrategySelector ¶
type ControllerStrategySelector interface { // SelectControllerStrategy tells if the trait with current configuration can select a specific controller to use SelectControllerStrategy(env *Environment) (*ControllerStrategy, error) // ControllerStrategySelectorOrder returns the order (priority) of the controller strategy selector ControllerStrategySelectorOrder() int }
ControllerStrategySelector is the interface for traits that can determine the kind of controller that will run the integration.
type Environment ¶
type Environment struct { CamelCatalog *camel.RuntimeCatalog RuntimeVersion string Catalog *Catalog // The Go standard context for the traits execution Ctx context.Context // The client to the API server Client client.Client // The active Platform Platform *v1.IntegrationPlatform // The active IntegrationProfile IntegrationProfile *v1.IntegrationProfile // The current Integration Integration *v1.Integration // The IntegrationKit associated to the Integration IntegrationKit *v1.IntegrationKit // The IntegrationKits to be created for the Integration IntegrationKits []v1.IntegrationKit // The resources owned by the Integration that are applied to the API server Resources *kubernetes.Collection PostActions []func(*Environment) error PostStepProcessors []func(*Environment) error PostProcessors []func(*Environment) error Pipeline []v1.Task ConfiguredTraits []Trait ExecutedTraits []Trait EnvVars []corev1.EnvVar ApplicationProperties map[string]string Interceptors []string }
An Environment provides the context for the execution of the traits.
func Apply ¶
func Apply(ctx context.Context, c client.Client, integration *v1.Integration, kit *v1.IntegrationKit) (*Environment, error)
func NewSyntheticEnvironment ¶ added in v2.3.0
func NewSyntheticEnvironment(ctx context.Context, c client.Client, integration *v1.Integration, kit *v1.IntegrationKit) (*Environment, error)
NewSyntheticEnvironment creates an environment suitable for a synthetic Integration. If the application which generated the synthetic Integration has no longer the label, it will return a nil result.
func (*Environment) DetermineCatalogNamespace ¶
func (e *Environment) DetermineCatalogNamespace() string
func (*Environment) DetermineControllerStrategy ¶
func (e *Environment) DetermineControllerStrategy() (ControllerStrategy, error)
DetermineControllerStrategy determines the type of controller that should be used for the integration.
func (*Environment) DetermineProfile ¶
func (e *Environment) DetermineProfile() v1.TraitProfile
DetermineProfile determines the TraitProfile of the environment. First looking at the Integration.Spec for a Profile, next looking at the IntegrationKit.Spec and lastly the Platform Profile.
func (*Environment) GetIntegrationContainer ¶
func (e *Environment) GetIntegrationContainer() *corev1.Container
func (*Environment) GetIntegrationContainerName ¶
func (e *Environment) GetIntegrationContainerName() string
func (*Environment) GetIntegrationPodSpec ¶
func (e *Environment) GetIntegrationPodSpec() *corev1.PodSpec
GetIntegrationPodSpec return the Integration Template Pod Specification, regardless of the deployment strategy.
func (*Environment) GetTrait ¶
func (e *Environment) GetTrait(id ID) Trait
func (*Environment) InPhase ¶
func (e *Environment) InPhase(c v1.IntegrationKitPhase, i v1.IntegrationPhase) bool
func (*Environment) IntegrationInPhase ¶
func (e *Environment) IntegrationInPhase(phases ...v1.IntegrationPhase) bool
func (*Environment) IntegrationInRunningPhases ¶
func (e *Environment) IntegrationInRunningPhases() bool
func (*Environment) IntegrationKitInPhase ¶
func (e *Environment) IntegrationKitInPhase(phases ...v1.IntegrationKitPhase) bool
func (*Environment) PlatformInPhase ¶
func (e *Environment) PlatformInPhase(phases ...v1.IntegrationPlatformPhase) bool
type Identifiable ¶
type Identifiable interface {
ID() ID
}
Identifiable represent an identifiable type.
type Options ¶
func NewSpecTraitsOptionsForIntegration ¶ added in v2.3.0
func NewSpecTraitsOptionsForIntegrationAndPlatform ¶ added in v2.3.0
func NewSpecTraitsOptionsForIntegrationAndPlatform(c client.Client, i *v1.Integration, pl *v1.IntegrationPlatform) (Options, error)
func NewSpecTraitsOptionsForIntegrationKit ¶ added in v2.3.0
func NewTraitsOptionsForKameletBinding ¶
func NewTraitsOptionsForKameletBinding(c client.Client, kb *v1alpha1.KameletBinding) (Options, error)
Deprecated.
func NewTraitsOptionsForPipe ¶
func ToTraitMap ¶
ToTraitMap accepts either v1.Traits or v1.IntegrationKitTraits and converts it to a map of traits.
type Trait ¶
type Trait interface { Identifiable client.Injectable // Configure the trait Configure(environment *Environment) (bool, *TraitCondition, error) // Apply executes a customization of the Environment Apply(environment *Environment) error // InfluencesKit determines if the trait has any influence on Integration Kits InfluencesKit() bool // IsPlatformTrait marks all fundamental traits that allow the platform to work IsPlatformTrait() bool // RequiresIntegrationPlatform indicates that the trait cannot work without an integration platform set RequiresIntegrationPlatform() bool // IsAllowedInProfile tells if the trait supports the given profile IsAllowedInProfile(traitProfile v1.TraitProfile) bool // Order is the order in which the trait should be executed in the normal flow Order() int }
Trait is the interface of all traits.
func NewInitTrait ¶
func NewInitTrait() Trait
type TraitCondition ¶ added in v2.2.0
type TraitCondition struct {
// contains filtered or unexported fields
}
TraitCondition is used to get all information/warning about a trait configuration. It should either use an IntegrationConditionType or IntegrationKitConditionType.
func NewIntegrationCondition ¶ added in v2.2.0
func NewIntegrationCondition(traitID string, ict v1.IntegrationConditionType, cs corev1.ConditionStatus, reason, message string) *TraitCondition
func NewIntegrationConditionPlatformDisabledCatalogMissing ¶ added in v2.3.1
func NewIntegrationConditionPlatformDisabledCatalogMissing() *TraitCondition
This one is reused among different traits in order to avoid polluting the conditions with the same message.
func NewIntegrationConditionPlatformDisabledWithMessage ¶ added in v2.3.1
func NewIntegrationConditionPlatformDisabledWithMessage(traitID string, message string) *TraitCondition
func NewIntegrationConditionUserDisabled ¶ added in v2.2.0
func NewIntegrationConditionUserDisabled(traitID string) *TraitCondition
func NewIntegrationConditionUserEnabledWithMessage ¶ added in v2.3.0
func NewIntegrationConditionUserEnabledWithMessage(traitID string, message string) *TraitCondition
Source Files ¶
- affinity.go
- builder.go
- camel.go
- container.go
- cron.go
- dependencies.go
- deployer.go
- deployment.go
- doc.go
- environment.go
- error_handler.go
- gc.go
- health.go
- ingress.go
- init.go
- istio.go
- jolokia.go
- jvm.go
- kamelets.go
- kamelets_support.go
- knative.go
- knative_service.go
- logging.go
- mount.go
- openapi.go
- owner.go
- pdb.go
- platform.go
- pod.go
- prometheus.go
- pull_secret.go
- quarkus.go
- registry.go
- route.go
- security_context.go
- service.go
- service_binding.go
- test_support.go
- toleration.go
- trait.go
- trait_catalog.go
- trait_condition_types.go
- trait_configure.go
- trait_factory.go
- trait_register.go
- trait_support.go
- trait_types.go
- util.go
- zz_desc_generated.go
- zz_generated_doc.go