Documentation ¶
Overview ¶
Package trait contains implementations of all available traits (features)
Index ¶
- Constants
- Variables
- func AddSourceDependencies(source v1.SourceSpec, catalog *camel.RuntimeCatalog) *strset.Set
- func AddToTraits(factory Factory)
- func CollectConfigurationPairs(configurationType string, configurable ...v1.Configurable) map[string]string
- func CollectConfigurationValues(configurationType string, configurable ...v1.Configurable) []string
- func FilterTransferableAnnotations(annotations map[string]string) map[string]string
- func GetIntegrationKit(ctx context.Context, c client.Client, integration *v1.Integration) (*v1.IntegrationKit, error)
- type BaseTrait
- func (trait *BaseTrait) ID() ID
- func (trait *BaseTrait) InfluencesKit() bool
- func (trait *BaseTrait) InjectClient(c client.Client)
- func (trait *BaseTrait) InjectContext(ctx context.Context)
- 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 ControllerStrategy
- type ControllerStrategySelector
- type Environment
- func (e *Environment) AddSourcesProperties()
- func (e *Environment) CollectConfigurationPairs(configurationType string) map[string]string
- func (e *Environment) CollectConfigurationValues(configurationType string) []string
- func (e *Environment) ComputeApplicationProperties() *corev1.ConfigMap
- func (e *Environment) ComputeConfigMaps() []runtime.Object
- func (e *Environment) ConfigureVolumesAndMounts(vols *[]corev1.Volume, mnts *[]corev1.VolumeMount)
- func (e *Environment) DetermineControllerStrategy() (ControllerStrategy, error)
- func (e *Environment) DetermineNamespace() string
- func (e *Environment) DetermineProfile() v1.TraitProfile
- 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) IntegrationKitInPhase(phases ...v1.IntegrationKitPhase) bool
- type Factory
- type ID
- type Identifiable
- type Trait
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 OpenAPITraitName = "openapi"
OpenAPITraitName ---
const True = "true"
True --
Variables ¶
var ( // BasePath -- BasePath = "/etc/camel" // ConfPath -- ConfPath = path.Join(BasePath, "conf") // ConfdPath -- ConfdPath = path.Join(BasePath, "conf.d") // SourcesMountPath -- SourcesMountPath = path.Join(BasePath, "sources") // ResourcesMountPath -- ResourcesMountPath = path.Join(BasePath, "resources") // ConfigMapsMountPath -- ConfigMapsMountPath = path.Join(ConfdPath, "_configmaps") // SecretsMountPath -- SecretsMountPath = path.Join(ConfdPath, "_secrets") )
var FactoryList []Factory
FactoryList contains the default list of trait Factory
Functions ¶
func AddSourceDependencies ¶ added in v1.3.0
func AddSourceDependencies(source v1.SourceSpec, catalog *camel.RuntimeCatalog) *strset.Set
AddSourceDependencies --
func CollectConfigurationPairs ¶
func CollectConfigurationPairs(configurationType string, configurable ...v1.Configurable) map[string]string
CollectConfigurationPairs --
func CollectConfigurationValues ¶
func CollectConfigurationValues(configurationType string, configurable ...v1.Configurable) []string
CollectConfigurationValues --
func FilterTransferableAnnotations ¶
FilterTransferableAnnotations returns a map containing annotations that are meaningful for being transferred to child resources.
func GetIntegrationKit ¶
func GetIntegrationKit(ctx context.Context, c client.Client, integration *v1.Integration) (*v1.IntegrationKit, error)
GetIntegrationKit retrieves the kit set on the integration
Types ¶
type BaseTrait ¶
type BaseTrait struct { TraitID ID `json:"-"` // Can be used to enable or disable a trait. All traits share this common property. Enabled *bool `property:"enabled" json:"enabled,omitempty"` Client client.Client `json:"-"` Ctx context.Context `json:"-"` ExecutionOrder int `json:"-"` L log.Logger `json:"-"` }
BaseTrait is the root trait with noop implementations for hooks
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) InjectContext ¶
InjectContext allows to inject a context 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 NewCatalog ¶
NewCatalog creates a new trait Catalog
func (*Catalog) ComputeTraitsProperties ¶
ComputeTraitsProperties returns all key/value configuration properties that can be used to configure traits
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 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(*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 C context.Context Client client.Client Platform *v1.IntegrationPlatform IntegrationKit *v1.IntegrationKit Integration *v1.Integration Resources *kubernetes.Collection PostActions []func(*Environment) error PostStepProcessors []func(*Environment) error PostProcessors []func(*Environment) error BuildTasks []v1.Task ConfiguredTraits []Trait ExecutedTraits []Trait EnvVars []corev1.EnvVar ApplicationProperties map[string]string Interceptors []string }
A Environment provides the context where the trait is executed
func Apply ¶
func Apply(ctx context.Context, c client.Client, integration *v1.Integration, kit *v1.IntegrationKit) (*Environment, error)
Apply --
func (*Environment) AddSourcesProperties ¶ added in v1.2.0
func (e *Environment) AddSourcesProperties()
AddSourcesProperties --
func (*Environment) CollectConfigurationPairs ¶
func (e *Environment) CollectConfigurationPairs(configurationType string) map[string]string
CollectConfigurationPairs --
func (*Environment) CollectConfigurationValues ¶
func (e *Environment) CollectConfigurationValues(configurationType string) []string
CollectConfigurationValues --
func (*Environment) ComputeApplicationProperties ¶
func (e *Environment) ComputeApplicationProperties() *corev1.ConfigMap
ComputeApplicationProperties --
func (*Environment) ComputeConfigMaps ¶
func (e *Environment) ComputeConfigMaps() []runtime.Object
ComputeConfigMaps --
func (*Environment) ConfigureVolumesAndMounts ¶
func (e *Environment) ConfigureVolumesAndMounts(vols *[]corev1.Volume, mnts *[]corev1.VolumeMount)
ConfigureVolumesAndMounts --
func (*Environment) DetermineControllerStrategy ¶
func (e *Environment) DetermineControllerStrategy() (ControllerStrategy, error)
DetermineControllerStrategy determines the type of controller that should be used for the integration
func (*Environment) DetermineNamespace ¶
func (e *Environment) DetermineNamespace() string
DetermineNamespace --
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) InPhase ¶
func (e *Environment) InPhase(c v1.IntegrationKitPhase, i v1.IntegrationPhase) bool
InPhase --
func (*Environment) IntegrationInPhase ¶
func (e *Environment) IntegrationInPhase(phases ...v1.IntegrationPhase) bool
IntegrationInPhase --
func (*Environment) IntegrationKitInPhase ¶
func (e *Environment) IntegrationKitInPhase(phases ...v1.IntegrationKitPhase) bool
IntegrationKitInPhase --
type Identifiable ¶
type Identifiable interface {
ID() ID
}
Identifiable represent an identifiable type
type Trait ¶
type Trait interface { Identifiable client.Injectable // InjectContext to inject a context InjectContext(context.Context) // Configure the trait Configure(environment *Environment) (bool, 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 tels if the trait supports the given profile IsAllowedInProfile(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
Source Files ¶
- affinity.go
- builder.go
- camel.go
- container.go
- cron.go
- dependencies.go
- deployer.go
- deployment.go
- doc.go
- environment.go
- gc.go
- ingress.go
- init.go
- istio.go
- jolokia.go
- jvm.go
- kamelets.go
- knative.go
- knative_service.go
- openapi.go
- owner.go
- pdb.go
- platform.go
- prometheus.go
- pull_secret.go
- quarkus.go
- route.go
- service.go
- trait.go
- trait_catalog.go
- trait_factory.go
- trait_register.go
- trait_types.go
- util.go
- zz_desc_generated.go
- zz_generated_doc.go